Google News
logo
Laravel - Interview Questions
What are Models?
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 = [];
}
Advertisement