laravel get first record code example
Example 1: laravel get first record
'First email'
User::whereEmail($email)->first();
'First Record'
User::first();
Example 2: how to get just the first row from a table in laravel
$user = User::whereEmail($email)->first();
Example 3: laravel eloquent get first
$user = App\User::where('id',$id)->first();
$userId = App\User::where(...)->pluck('id');
Example 4: laravel query builder select first
$user = DB::table('users')->where('name', 'John')->first();
var_dump($user->name);
Example 5: collection get first element laravel
$first = $msgs->first();