File: documentation/en/

Recommend this page to a friend!
  Classes of Fernando Val  >  Springy  >  documentation/en/  >  Download  
File: documentation/en/
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: Springy
Microframework for Web application development
Author: By
Last change:
Date: 3 years ago
Size: 1,148 bytes


Class file image Download



Model is part of MVC architecture of the framework. They are objects representing business data, rules and logic.

Creating Models

You can create model classes by extending Springy\\Model or its child classes.

The script files of your models must be located in the classes directory.

The names of the files must be correspondent to the name of the model, followed by the extension .php.

The follow example show a simple model code:

use Springy\Model;

class MyModel extends Model
    /// The table name
    protected $tableName = 'users';
    /// The primary key column
    protected $primaryKey = 'id';
    /// The name of the column where the insert datetime is saved
    protected $insertDateColumn = 'created_at';
    /// The name of the column to set a logic exclusion
    protected $deletedColumn = 'deleted';
    /// Columns who can be updated by application
    protected $writableColumns = ['first_name', 'last_name', 'email'];

For more information send a message to info at phpclasses dot org.