I\'m new to Laravel. I want to display all post including the user who posted the post. I have a simple query which displays all post, and displays selected post using post
public function($id){
$posts = Posts::where('uid','=',auth()->user()->id)->findOrFail($id);
return view('your_blade.php',compact('posts'));
OR either you can return this
return response()->json([$posts], 200);
}
Note: don't forgot to add trait also use App\Posts;