TestModel:
PHP Code:
<?php namespace Modules\Test\Models;
/**
* -----------------------------------------------------------------------
* Class TestModel
*
* @project ci4admin
* @author Raymond L King Sr.
* @link https://www.procoversfx.com
* @copyright Copyright (c) 2009 - 2019 Custom Software Designers, LLC.
* @license https://www.procoversfx.com/license
* -----------------------------------------------------------------------
*/
use CodeIgniter\Model;
class TestModel extends Model
{
/**
* Class properties go here.
* -------------------------------------------------------------------
* public, private, protected, static and const.
*/
/**
* Name of database table
*
* @var string
*/
protected $table = 'tableName';
// -------------------------------------------------------------------
/**
* __construct ()
* -----------------------------------------------------------------------
*
* Class Constructor
*
* NOTE: Not needed if not setting values or extending a Class.
*
*/
public function __construct()
{
parent::__construct();
}
// -----------------------------------------------------------------------
} // End of TestModel Model Class.
/**
* -----------------------------------------------------------------------
* Filename: TestModel.php
* Location: ./Modules/Test/Models/TestModel.php
* -----------------------------------------------------------------------
*/
A test model for setting up a model in modules.
I have code templates made up in my phpStorm for everything, like above model.
You can setup the other variables from CodeIgniter's model in your new model.
I try to use Entity Classes for my models, Entity Class is a good read in the User Guide.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )