1# The easiest way to create a model instance is using the
2# make:model Artisan command:
3
4php artisan make:model Flight
5
6# If you would like to generate a database migration when you
7# generate the model, you may use the --migration or -m option:
8
9php artisan make:model Flight --migration
10php artisan make:model Flight -m
1# If you would like to generate a database migration when you
2# generate the model, you may use the --migration or -m option:
3
4php artisan make:model Flight --migration
5php artisan make:model Flight -m
1$user = User::create([
2 'first_name' => 'Taylor',
3 'last_name' => 'Otwell',
4 'title' => 'Developer',
5]);
6
7$user->title = 'Painter';
8
9$user->isDirty(); // true
10$user->isDirty('title'); // true
11$user->isDirty('first_name'); // false
12
13$user->isClean(); // false
14$user->isClean('title'); // false
15$user->isClean('first_name'); // true
16
17$user->save();
18
19$user->isDirty(); // false
20$user->isClean(); // true
1return Destination::orderByDesc(
2 Flight::select('arrived_at')
3 ->whereColumn('destination_id', 'destinations.id')
4 ->orderBy('arrived_at', 'desc')
5 ->limit(1)
6)->get();