Grocery Crud custom model with CI4 |
Hi!
I want to implement a custom model from Grocery Crud but I see that CI4 does not have `get_instance` anymore. As per the example I need to do: ``` <?php //CustomersModel.php use GroceryCrud\Core\Model; use GroceryCrud\Core\Model\ModelFieldType; class CustomersModel extends Model { protected $ci; protected $db; function __construct($databaseConfig) { $this->setDatabaseConnection($databaseConfig); $this->ci = & get_instance(); $this->db = $this->ci->db; } public function getFieldTypes($tableName) { ... ``` The question is, how may I get a CI4 context as this example is for CI3? Example website: https://www.grocerycrud.com/docs/custom-model Thank you.
Use service("codeigniter")
All new users are under moderation.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |