I'm trying to implement a clean architecture in laravel, thus I'm moving my own code to a src
folder.
My controller is located in src\notebook\infrastructure
but when i call it from routes\web.php
this way:
Route::get('/notebook', 'src\notebook\infrastructure\NotebooksController@show');
i got this error:
Illuminate\Contracts\Container\BindingResolutionException
Target class [src\notebook\infrastructure\NotebooksController] does not exist.
http://127.0.0.1:8000/notebook
i also changed the namespace value in the class RouteServiceProvider
from:
protected $namespace = 'App\Http\Controllers';
to
protected $namespace = '';
This is my notebook controller class:
namespace src\notebook\infrastructure;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class NotebooksController extends Controller
{
public function show($id)
{
echo 'controller from infrastructure folder';
}
}
My laravel and php version in composer.json
are:
"php": "^7.2.5",
"laravel/framework": "^7.24",
I feel like i'm missing something stupid but can't figure it out what.