Get the single post by id in Laravel
<?php
public function show($id)
{
//return Post::find($id);
return 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')
->where('posts.id', '=', $id)->first();
//->get();
//$project = Project::join('groups', 'groups.project_id','=', 'project.id')->where('project.id',$id)->first()
}
Get the single post by id in Laravel
Reviewed by TechTubeHQ
on
April 16, 2022
Rating:

No comments: