| @@ 56-63 (lines=8) @@ | ||
| 53 | * @param int $location_id |
|
| 54 | * @return Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection |
|
| 55 | */ |
|
| 56 | public function orderedSiteLocationsBy($site_id, $location_id) |
|
| 57 | { |
|
| 58 | $locations = self::query()->select(['id', 'name']) |
|
| 59 | ->where('site_id', '=', $site_id) |
|
| 60 | ->orderByRaw(DB::raw("(id = " . $location_id . ") DESC")) |
|
| 61 | ->get(); |
|
| 62 | return $locations; |
|
| 63 | } |
|
| 64 | ||
| 65 | /** |
|
| 66 | * Create a new location and return its id |
|
| @@ 43-49 (lines=7) @@ | ||
| 40 | * @param int $id |
|
| 41 | * @return Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection |
|
| 42 | */ |
|
| 43 | public function orderedSitesBy($id) |
|
| 44 | { |
|
| 45 | $sites = self::query()->select(['id', 'name']) |
|
| 46 | ->orderByRaw(DB::raw("(id = " . $id . ") DESC")) |
|
| 47 | ->get(); |
|
| 48 | return $sites; |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * Create a new site and return its id |
|