Double Insert Data in Filter Before CI4 - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31) +--- Thread: Double Insert Data in Filter Before CI4 (/showthread.php?tid=81968) |
Double Insert Data in Filter Before CI4 - flux1on - 05-28-2022 app/Config/Service.php PHP Code: public static function validationApiKey(string $apiKey) app/Helpers/api_helper.php PHP Code: <?php app/Filters/APIAuthFilter.php PHP Code: <?php app/Models/ApiModel.php PHP Code: <?php app/Models/ApiLogModel.php PHP Code: <?php I have API Key Validation with Filter and if no issue to criteria validation, i want to save logs anyone hit my API. But logs save 2 times. Can i save logs one only if everyone hit one my api? RE: Double Insert Data in Filter Before CI4 - iRedds - 05-29-2022 You are calling the function twice. PHP Code: if (Services::validationApiKey($tokenApi)) { // <-- here You need to review all code. RE: Double Insert Data in Filter Before CI4 - flux1on - 05-29-2022 (05-29-2022, 06:47 PM)iRedds Wrote: You are calling the function twice. Okay thankyou @iRedds, now no double data again in database with PHP Code: // JWT is sent from client in the format Bearer XXXXXXXXX |