Hi i want to fetch data row from database in model i created model but how to get multiple rows and single row query.
Answer (1)
Hi use some thing like this in laravel 5.5
public static function getTotalJobList($employerId = Null)
{
$query = self::select('*')
->orderBy('candidate', 'desc')
->get();
return $query;
}
> to get multiple row use above :
public static function getTotalJobList($employerId = Null)
{
$query = self::select('*')
->orderBy('candidate', 'desc')
->first();
return $query;
}
> If you want to get single row use as above.
fully tested and workable.
By : Deepak Sharma | 28-09-2019 | 45 Likes