Skip to content
Advertisement

Tag: codeigniter-4

How to use foreign keys migration with database migrations. (errno: 150 “Foreign key constraint is incorrectly formed”)?

CodeIgniter 4 has a handy solution for migrations and seeders. Without the usage of foreign keys, everything is working perfectly. But when I use foreign keys I get “Unable to add foreign key”. This is because of the order of happenings: Quick example: So when I now run php spark migrate or php spark migrate:refresh the foreign key can not

Codeigniter 4 localization issue with UTF-8 characters

The context I am trying to perform a lemmatization of some texts and I figured out that I can use CI4 localization for this. Basically I created some files in AppLanguagesro-RO and I am “translating” the words to their linguistic root. The language files are encoded in UTF-8 (I checked it on the server with file -i command). PHP has

Setting Parameters in CI4s redirecting function

is there any possible way to send parameters within the redirection function from Codeigniter 4? Important, it is a named route: And i want to do a redirect like this: this works fine: this would be nice, if it works: or Why? I have HMVC and I would like to name every module with the same routes but different functions

Codeigniter4 how to call parent controller’s constructor from derived class constructor

In Codeignter 4 we can’t use constructor in BaseController. But the method initController() will do it. But how can call this method from derived controller’s constructor? My question is that BaseController::is_allowed() method will do all basic features that are commonly useful for all derived controller classes. But to work BaseController::is_allowed() , BaseController::__construct() should be execute before this. But as in

How to use CI4 parser service to render view from module

I’m trying to load views from module folder, since CI always look for views in App/View folder, how this can be overwritten to give complete path from ROOTPATH instead of APPPATH/Views Error CodeIgniterViewExceptionsViewException Invalid file: {path/to/project}/app/Config/../Views/modules/PluginName/Views/index.php Answer You are using a path relative to the default Views path. You could either: 1. Edit the line below in your Config/Path.php file

Load View in Custom Helper Codeigniter 4

In CI 3 i can load view file in helper like this. But in CI 4, when i use this function in my custom helper, it shows following error. Call to undefined function get_instance() How can i load view file in helper in CI 4 ? Answer There’s no need for any of that. In codeigniter 4 all you need

Module view file showing invalid in Codeigniter 4

I’ve added the module folder in …appConfigAutoload.php My directory: Routes.php Blog.php After running my_domain/index.php/blog, it’s showing this error: Didn’t get any solution from this one: Codeigniter 4 View file invalid Where am I wrong? Answer Changing Blog.php to this, worked for me. Credit: CI Forum

Advertisement