/** * Get the Release with artist * Show Action * * @param Query $query * @param string $permalink * @return Query */ public function scopereleaseWithArtistAndTracks($query, $permalink) { $query->with(['artist' => function ($query) { $query->select('id', 'name', 'permalink'); }])->with('tracks')->where('permalink', '=', $permalink); }