#How do I call Module class from the web route?

24 messages · Page 1 of 1 (latest)

dreamy scarab
#

I am using nwidart laravel package and I am trying to call the Class inside the Modules/Dining
I am sure to correctly reference it but the error always returns Target class [Modules\Dining\Http\Controllers\DiningController] does not exist.

//Modules\Dining\Http\Controllers\DiningController
Route::get('/', [ControllersDiningController::class, 'index']);

Tried also Route::get('/', [Modules\Dining\app\Http\Controllers\DiningController::class, 'index']);

Is this some composer issue or whaaat?

muted kestrel
#

Let's see your composer.json?

dreamy scarab
#

@muted kestrel No issues as you can see

muted kestrel
#

Is your Modules\Dining\Http\Controllers\DiningController namespace in the controller correct or any errors in case sensitivity?

dreamy scarab
#

No there is no syntax errors.

#

References are correct

muted kestrel
#

try composer dump-autoload

#

might not be correctly picking up the module as a package

dreamy scarab
#

Is yours working correctly?

#

In the root web route are you able to do this?

muted kestrel
#

You should be able to but why not register the routes in /Modules/Dining?

#

Doesn't that module have it's own web.php?

#

The modules are supposed to be independent/separate

dreamy scarab
#

Is that so?

#

You are right that each modules has its own route

#

So lets say that if I commented the /dining route on the root/main web route will it use the module's dining routes ?

muted kestrel
dreamy scarab
#

I am using nwidarts

muted kestrel
#

do php artisan route:list and see if they're being registered

dreamy scarab
#

@muted kestrel just deleted the bootstrap/cache this solved the issue

muted kestrel