How to add page number to laravel-dompdf?

found this way on the Internet, but I don"t know how to add this script.
is there a boss who can give a complete process?
clipboard.png

Mar.09,2021

Link description

        $pdfManager = new DOMPDF();

        $pdfManager->loadHtml($html);
        $pdfManager->render();

        $canvas = $pdfManager->get_canvas();
        $footer = $canvas->open_object();
        $w = $canvas->get_width();
        $h = $canvas->get_height();
        $canvas->page_text($w-60,28," {PAGE_NUM} / {PAGE_COUNT}", '',12);
        $canvas->close_object();
        $canvas->add_object($footer,"all");
        return $pdfManager->stream();

$html is your html code

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf7ddd-54d0c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf7ddd-54d0c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?