How to fetch data row in laravel model class

Hi i want to fetch data row from database in model i created model but how to get multiple rows and single row query.
Harsh Aggrawal
Asked 13-12-2024
140

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.  
Deepak Sharma
Asked 07-05-2019
45 Likes
Comments
fully tested and workable.
By : Deepak Sharma | 28-09-2019 | 45 Likes
Write comment

Submit your answer