- Contents
- Ness
- Model
You can include this library to your code file by typing the below code;
use Ness\Model
About Models #top
Model is a class which designed to help you with information in your database. We can call it 'Hand' of human body, because when you request a data they should bring information from database. Also when you say to a model to hold this information untill I put it to database, model classes should hold that information. All your model class files must be located in 'model' folder, Ness framework look this directory for autoloading a model file. You can read more about folder structure
Load Models #top
Load is a static method to locate and load a model.
Model::Load(string $prm_file);
Load model when not autoloading | ||
Return | Void | |
Parameters | $prm_file String; File name of your model file. |
Example Model #top
This UserModel should be saved in app_folder/Application/Model/UserModel.php
class UserModel
{
public $name;
public $surname;
public $email;
public $password;
public $role;
public $registerdate;
public $__id;
public function Save()
{
//database codes...
}
public function Update()
{
//database codes...
}
public function Delete()
{
//database codes...
}
public function Show()
{
//database codes...
}
}