Support the ongoing development of Laravel.io →
posted 10 years ago
Packages
Last updated 2 years ago.
0

Make sure you've namespaced the AdminController file as you have written in your route, and don't forget to dump the autoloader with

php artisan dump-auto

Let us know if you've already done this.

Last updated 2 years ago.
0

Thank you jlaswell,

I did

php artisan dump-auto

And it shows:

{"error":{"type":"ReflectionException","message":"Class Vendor\\Package\\AdminController does not exist","file":"\/laravel\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/ControllerInspector.php","line":28}}

The thing is, my controller is:

- workbench
-  vendor
-   package
-    src
-     controllers
-      AdminController.php
-     vendor
-      package
-       AdminServiceProvider.php

Is it the path configuration?

Last updated 2 years ago.
0

Yep, it's just the paths. Folder structure for a workbench package should be as follows.

- workbench
-  vendor
-   package
-    src
-     Vendor
-      Package
-       AdminServiceProvider.php
-       AdminController.php

You can also move AdminController.php to it's own controllers folder if you namespace it accordingly!

<?php Vendor/Package/Controllers;
- workbench
-  vendor
-   package
-    src
-     Vendor
-      Package
-       AdminServiceProvider.php
-       Controllers
-        AdminController.php
Last updated 2 years ago.
0

Thanks again, it worked.

Then I was trying to replicate the folder structure here: https://github.com/FrozenNode/Laravel-Administrator/tree/master/src

Where controllers are separated from ServiceProvider, wondering if there's anything specific about the structure here. You see, when I tried FrozenNode's structure the 'not-found' error appears.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

fzhan fzhan Joined 4 Apr 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.