InterviewSolution
Saved Bookmarks
| 1. |
What are Models? |
|
Answer» With LARAVEL, each DATABASE table can have a model representation using a model file which can be used to interact with that table using Laravel Eloquent ORM. We can create a model using this ARTISAN command: php artisan make:model Post This will create a file in the models’ directory and will look like below: class Post EXTENDS Model{ /** * The attributes that are mass assignable. * * @var array */ PROTECTED $fillable = []; /** * The attributes that should be hidden for arrays. * * @var array */ protected $hidden = [];}A Model can have properties like table, fillable, hidden, etc which defines properties of the table and model. |
|