I want to select from a database table e.g
select artist.name as name from albums WHERE
albums.title != ''
AND
artists.id = albums.artist
ORDER BY
artist DESC LIMIT 8 ";
How can i use this to build my API in laravel?
public function index()
{
//Get albums
$albums = Album::select('artist.name as name')->from('albums')->orderBy('artist', 'desc')->limit(8)->get();
//Return collection of albums as a resource
return AlbumResource::collection($albums);
}