In this post, we will see how to resolve What is the best way to save token (JWT) in cakephp 4? Question: I have a project and I made the backend using nodejs. I made a user registration module and ...

In this post, we will see how to resolve Cakephp redirect in isAuthorized method not working Question: So after login in isAuthorized method I’m trying to redirect user based on a condition. But problem is it’s not redirecting. Below the ...

In this post, we will see how to resolve Problem with plugin routes and multilanguage in a Cakephp4 Question: I’ve built a multilanguage NewsManager plugin that has a NewsController I’m try to write routes in this plugin to be able ...

Question: Is there any way of running a shell command DIRECTLY on the Command Class for CAkePHP4? I would like something like this. Answer: Command::run() is used to run the current command, you don’t call it yourself for any other ...

Question: I have time in seconds when the session should end. If the user has not selected the checkbox “remember_me” – the session will last 2 hours. When the checkbox is selected – should last – 48 hours. I have ...

Question: CakePHP Version: 4.2.6 Xampp: Apache/2.4.51 (Win64) OpenSSL/1.1.1l PHP/8.0.11 Server version: 10.4.21-MariaDB – mariadb.org binary distribution PHP version: 8.0.11 Introduction I’m trying to construct a deleteAll query with the order by and limit clauses. SQL When the following sql is ...

Question: I cannot seem to override TemplateCommand from my plugin. Original TemplateCommand located here: vendor/cakephp/bake/src/Command/TemplateCommand.php I stored mine here: plugins/MyPlugin/src/Command/TemplateCommand: When I run bin/cake bake template books -t "MyPlugin", I get: Edit #2 In Plugin.php, in bootstrap(), I was able ...

Question: I have the two following associations : AgendaDates hasOne ImageDescriptive AgendaDates hasMany Photos When I do this query : I have the following error : SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of ORDER BY clause is ...

Question: I am using CakeDC Users and as part of the registration I would like the registrant to choose some checkbox values that correspond to another Model in the application. I am able to get the form to load the ...

Question: Problem Description I want to cache the query results with the key as a whole SQL statement instead part of the SQL statement like the below example: Above example taken from this link : https://book.cakephp.org/4/en/orm/query-builder.html#caching-loaded-results What I have tried ...