I have searched everywhere for an answer but nothing have worked so far. All the listed solutions on stack have not proven to be sufficient.
I get nothing in my lar
Add this line before return header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Origin: *");
Your code should be
public function index() { $posts = Post::with('user', 'tags')->get(); header("Access-Control-Allow-Origin: *"); return response()->json($posts); }