I am creating routes in codeigniter-4 and I want to know if I can use namespace for some routes like with laravel given below: Laravel namespace Code Can I implement something similar in codeigniter-4 ? My Codeigniter code Answer Yes you can. https://codeigniter.com/user_guide/incoming/routing.html#assigning-namespace
Tag: codeigniter-4
How to call affected_rows method from ci4 model
I have a model that extends CI4 builtin Model.. Any idea how do i perform the following? thinking of getting it after deleting a row, most of the example using custom model, not extending ci4 model. Answer First, be sure to set your database connection up correctly in app/Config/App.php or in your .env file. Then $this->db from the core Model
CORS issue in codeigniter 4: Response to preflight request doesn’t pass access control check
I’m making an api with Codeigniter 4 for a react application. Everything works fine in postman but when I make requests with axios (also tried fetch), it gets CORS error Access to XMLHttpRequest at ‘http://localhost:8080/testpost’ from origin ‘http://localhost:3000’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the
Can’t create project with Composer
I am trying to create project with Composer using command composer create-project codeigniter4/appstarter myproject and i get this Exception [InvalidArgumentException] Could not find package codeigniter4/appstarter with stability stable in a version installable using your PHP version 5.6.40. I am using Wamp Server 3.2.0 and PHP 7.3.12 Please help Answer I edited Path variable, changed path to php from C:wamp64binphpphp5.6.40 to
Debug Toolbar in Codeigniter 4 not working
I installed Codeigniter 4.0.2 and did following changes: 1- CI_ENVIRONMENT = development in .env file 2- SetEnv CI_ENVIRONMENT development in .htaccess in public folder 3- Added $useKint = true; in main index.php file in public folder When I open at localhost, welcome page is rendered but no Debug Toolbar is rendered. Am I missing anything? Answer This fixed it for
How to get specific columns in CodeIgniter 4?
I wanna select specific columns from table. Not all columns. I’m using this but it returns all data. Answer According to the CI4 query builder documentation you can use select() in this way: where() could be possible to use in 4 ways, you can choose. This stuff should be placed in Model file, method of which would return $query set
CodeIgniter 4… documentRoot is not in public… htaccess is not working
I am starting to dabble in CodeIgniter 4. Completed a simple app. On local, I have the documentroot setup to be /public/ where as on the product hosting environment, I am unable to set the …