-
Video : Showing all the results in Codeigniter 4
-
Video : Update the record in Codeigniter 4
-
Video : Delete operation in Codeigniter 4
-
Video : Adding Bootstrap 4 in Codeigniter 4 in the Crud Application
-
Video : Create the form in Codeigniter 4 and insert the record
-
Video : Conclusion of CRUD operation in codeigniter 4
Creating the model in codeigniter 4
Please Login and enroll in this course to view the lesson.
Creating the model in Codeigniter 4
Creating the model in Codeigniter 4 is different from Codeigniter 3; in CodeIgniter 3, you always define the whole body of the method, but here in Codeigniter 4, you don't need to define the entire function. Just configure the table with your Codeigniter 4 and pass some variables. That's it; now you are ready to go. In this lesson, you will learn how to create the model in Codeigniter 4.
<?php namespace AppModels;
use CodeIgniterModel;
class MyStudents extends Model
{
protected $DBGroup = 'default';
protected $table = 'students';
protected $primaryKey = 's_id';
protected $returnType = 'array';
protected $useTimestamps = true;
protected $allowedFields = ['s_name','s_date','s_subject','s_update'];
protected $createdField = 's_date';
protected $updatedField = 's_update';
}