Models will assume that each table has a primary key column named id. String that contains the connection name that's utilised by the model by default. Values are fields made hidden when serializing the model data. Values are fields made visible when serializing the model data. Values are fields guarded from mass assignment. Values are fields accessible to mass assignment. Values are encoded as JSON before saving and converted to arrays after fetching. Values are converted to an instance of Carbon/DateTime objects after fetching.īoolean that if true will automatically set created_at and updated_at fields. Primary key name used to identify the model.īoolean that if false indicates that the primary key is not an incrementing integer value.īoolean that if true indicates that the model exists. The most basic representation of a model used inside a Plugin looks like this: All model classes must extend the Model class. In most cases, you should create one model class for each database table. The model configuration directory name matches the model class name written in lowercase. The model configuration directory could contain the model's list column and form field definitions. An example of a model directory structure: Model classes reside in the models subdirectory of a plugin directory. Models allow you to query for data in your tables, as well as insert new records into the table. Each database table has a corresponding "Model" which is used to interact with that table. October CMS provides a beautiful and simple Active Record implementation for working with your database, based on Eloquent by Laravel (opens new window).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |