Very Simple Auth Helper - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Addins (https://forum.codeigniter.com/forumdisplay.php?fid=34) +--- Thread: Very Simple Auth Helper (/showthread.php?tid=77772) |
Very Simple Auth Helper - nc03061981 - 10-16-2020 PHP Code: <?php RE: Very Simple Auth Helper - MGatner - 10-16-2020 Very simple indeed! Folks looking for a functional approach will probably appreciate this. One recommendation: check out the framework guidelines for Authentication extensions: https://codeigniter4.github.io/CodeIgniter4/extending/authentication.html Following these ensures that developers can build on common expectations for Authentication that are not specific to one package. RE: Very Simple Auth Helper - nc03061981 - 10-16-2020 (10-16-2020, 06:35 AM)MGatner Wrote: Very simple indeed! Folks looking for a functional approach will probably appreciate this. Thanks @MGatner RE: Very Simple Auth Helper - InsiteFX - 10-19-2020 Instead of using getResult(); which is for multiple records use getRow(); single record. You could also useĀ $this->db->countAllResults(); Instead of count(); RE: Very Simple Auth Helper - nc03061981 - 10-19-2020 (10-19-2020, 06:02 AM)InsiteFX Wrote: Instead of using getResult(); which is for multiple records use getRow(); single record. - countAllResults() will execute query again and then count results, so only use this method when you not yet executed query - count($query->getResult()) only count nums of result return, so use this when you executed query - count($query->getResult()) will faster count($query->getRow()), because getRow will call ->getFirstRow before count - to check have result or not, should use empty($query->getResult()) - to check nums rows, should use count($query->getResult()) |