1// Retrieve flight by name, or create it if it doesn't exist...
2$flight = App\Flight::firstOrCreate(['name' => 'Flight 10']);
3
4// Retrieve flight by name, or create it with the name, delayed, and arrival_time attributes...
5$flight = App\Flight::firstOrCreate(
6 ['name' => 'Flight 10'],
7 ['delayed' => 1, 'arrival_time' => '11:30']
8);
9
10// Retrieve by name, or instantiate...
11$flight = App\Flight::firstOrNew(['name' => 'Flight 10']);
12
13// Retrieve by name, or instantiate with the name, delayed, and arrival_time attributes...
14$flight = App\Flight::firstOrNew(
15 ['name' => 'Flight 10'],
16 ['delayed' => 1, 'arrival_time' => '11:30']
17);
1Schema::table('flights', function (Blueprint $table) {
2 $table->softDeletes();
3});