insert in laravel code example
Example 1: laravel insert
DB::table('users')->insert([
'email' => '[email protected]',
'votes' => 0
]);
Example 2: laravel 8 orderby
$flights = App\Models\Flight::where('active', 1)
->orderBy('name', 'desc')
->take(10)
->get();
Example 3: insert into laravel 8
DB::insert('insert into users (id, name) values (?, ?)', [1, 'Dayle']);
Example 4: laravel db inserr
$id = DB::table('users')->insertGetId(
['email' => '[email protected]', 'votes' => 0]
);