Hello Friends 👋,

Welcome To Infinitbility! ❤️

this article explain how to Select only first row or single row in laravel.

laravel provide first() method to Select only single row using first() you will not required to write like this $array[0].

If you just need to retrieve a single row from a database table, you may use the DB facade’s first method. This method will return a single stdClass object:

$user = DB::table('users')->where('name', 'John')->first();

return $user->email;

Thanks For Reading…