get and insert in laravel code example
Example 1: laravel db insert get last id
$id = DB::table('users')
->insertGetId(
['name' => 'Akash Savani', 'email'=>'[email protected]']
);
Example 2: laravel query builder select first
$user = DB::table('users')->where('name', 'John')->first();
var_dump($user->name);