Laravel and Json : return the name of the array
$posts = DB::table('posts')
->Join('releases', 'posts.release_id', '=', 'releases.id')
->Join('artists', 'posts.artist_id', '=', 'artists.id')
->select('posts.*', 'artists.title as artist_title', 'releases.title as release_title', 'artists.thumbnail_path as artistImg', 'releases.thumbnail_path as releaseImg')
->get();
return json_encode(['datapack'=>$posts],200);
or
return Response::json(['datapack'=>$posts],200);
Laravel and Json : return the name of the array
Reviewed by TechTubeHQ
on
April 17, 2022
Rating:

No comments: