What you get
- The whole database and the administration interface are generated from the admin model settings.
- Relations between models are mapped automatically. You no longer write relation methods — calling a method named after the related model binds the relation, for example
$article->gallery()or$article->gallery. $fillableand$castsare filled automatically from the defined fields.- And more.
Creating an admin model
Admin models are created with php artisan.app/Models/Article.php, or app/Article.php when the Models directory does not exist.
app/Models/Article.php
A name starting with the plural of an existing admin model sets the parent:
admin:model ArticlesComment generates protected $belongsToModel = Article::class;. A name ending with Gallery generates a multirows image field.
Then create the table with php artisan admin:migrate, see Migrations.
Next steps
Model parameters
Overview of every parameter that shapes the model in the administration.
Fields
Field types, their parameters, groups and tabs.
Listing and search
Order, filter and export the records of the table.
Permissions
Restrict creating, editing and deleting records.