I’m currently working on FCC laravel 5.8 tutorial
However, i’m trying to build it on laravel 8.
Cant seem to find a way to make the route post work
Route::post('/p', [AppHttpControllersPostsController::class, 'store']);
<?php
namespace AppHttpControllers;
use IlluminateHttpRequest;
class PostsController extends Controller
{
public function create()
{
return view('posts.create');
}
public function store(){
//dd('hit');
dd(request()->all());
}
}
I’ve tried using @csrf
2
Answers
I was able to solve this issue because of the button type="button" that I included should be type="submit" or totally blank.
You can try importing the Controller at the top and then referring it inside the Route initiation.
Also, check whether the Full URL that you’re calling matches the route URI correctly.