/** * Display a listing of the resource. * * @param \App\Models\Track $track * * @return \Illuminate\Http\Response */ public function index(Track $track) { $tracks = apihelper($track->with('tagged', 'media'))->collection(); $tracks->each(function ($track) { $track->prepare(); }); return response()->json($tracks); }
/** * Find resource by id using api helper. * * @param mixed $resource * @param int $id * @param string|null $message * * @return \Illuminate\Http\Response */ protected function findResource($resource, $id, $message = null) { $data = apihelper($resource)->find($id); if (is_null($data)) { $this->response->errorNotFound($message); } return response()->json($data); }
/** * Find resource by id using api helper. * * @param mixed $resource * @param int $id * @param string|null $message * @return \Illuminate\Http\Response */ protected function findResource($resource, $id, $message = null) { $resource = apihelper($resource)->findOrFail($id); return $resource; }
/** * Display a listing of the resource. * * @param \App\Models\Artist $artist * * @return \Illuminate\Http\Response */ public function index(Artist $artist) { return response()->json(apihelper($artist)->collection()); }
/** * Display a listing of the resource. * * @param \App\Models\User $user * * @return \Illuminate\Http\Response * * @Get("/") * @Versions({"v1"}) */ public function index(User $user) { return response()->json(apihelper($user)->collection()); }