I've got an error in laravel named
Target class [App\Http\Controllers\PostController] does not exist
The code below is from my PostsController
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Post;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
public function postCreate(Request $request)
{
$id = Auth::id();
$gebrnaam = Auth::name();
$post = new Post();
$image = $request->file('image')->getClientOriginalName();
$post->image_path = $image;
$request->image->move(public_path('img'), $image);
$post->Titel = $request->input('txtTitle');
$post->Inleiding = $request->input('txtinleiding');
$post->Inhoud = $request->input('txtinhoud');
$post->user_id = $id;
$post->userNaam = $gebrnaam;
$post->save();
}
And this is the code of my web.php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\PostController;
Route::get('/', function () {
return view('welcome');
});
Route::middleware(['auth:sanctum', 'verified'])->get('/dashboard', function () {
return view('dashboard');
})->name('dashboard');
Route::get('/', [PostController::class, 'getpost']);
Route::post('/', [PostController::class, 'postCreate']);
PostControllerexist in theapp/Http/Controllersdirectory and do you have the correct spelling?PostsController != PostController