Am new to Laravel and am using Laravel 8.83.5. I created a new controller called Posts PostsController using php artisan and I also created a new directory called posts in the layouts directory but when I try accessing that file using http://127.0.0.1:8000/p I get an error that TIlluminate\Contracts\Container\BindingResolutionException Target class [PostsController] does not exist.
here is my web.php file
<?php
// use Illuminate\Support\Facades\Auth;
// use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Auth;
// use Illuminate\Routing\Route;
use Illuminate\Support\Facades\Route;
Route::get('/',function(){
return view('welcome');
});
Auth::routes();
Route::get('/p','PostsController@create');
Route::get('/profile/{user}','ProfilesController@index')->name('profile.show');
here is the file called create.blade.php i want to display when I run http://127.0.0.1:8000/p
@extends('layouts.app')
@section('content')
@endsection
and here is my postsController file <?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class PostsController extends Controller
{
public function create(){
return view('posts.create');
}
}