how to create model in laravel
snippet in php

how to create model in laravel

user9597

php artisan make:model Flight

laravel create model and migration

user4451

# If you would like to generate a database migration when you 
# generate the model, you may use the --migration or -m option:

php artisan make:model Flight --migration
php artisan make:model Flight -m

laravel update

user594

<!-mass update-->
App\Models\Flight::where('active', 1)
          ->where('destination', 'San Diego')
          ->update(['delayed' => 1]);

laravel find query

user2123

return Destination::orderByDesc(
    Flight::select('arrived_at')
        ->whereColumn('destination_id', 'destinations.id')
        ->orderBy('arrived_at', 'desc')
        ->limit(1)
)->get();

crrate model in laravel

user6960

php artisan make:model Flight -mcr
  #it will make model with name of Flight
  #it will also create conctroller file with FlightController name 
  #all function will present in this Controller (index, create, store, show, edit, update, destroy)