Create Model in Laravel

Friends, today I will tell you how to create a model in the laravel framework, so let’s go.
By the way, we create model so that we can define the name of database table in it.
The model is defined inside the app directory.

Keywords :- Model Create In Laravel 6.0, Laravel 5.8, Laravel 5.7, Laravel 5.6, Laravel 5.5, Laravel 5.4+

The easiest way to create a model instance is using the make:model Artisan command:

php artisan make:model Flight
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Flight extends Model
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'my_flights';
}

Leave a Reply

Your email address will not be published. Required fields are marked *