1

I have a problem with my Laravel project. I created an admin route group (domain.co/admin/). The root /admin/ at one point was working then i added a few more pages have updated composer, installed doctrine/dbal, and installed chart.js since then. Now for some reason the /admin/ route no longer works but all other routes work perfectly normal.

my web.php routes look like this:

Route::get('/', function () { return view('home'); }); Auth::routes(); // tried commenting this out Route::middleware(['web','auth','rolecheck:Super'])->prefix('admin')- >group(function(){ Route::get('/', 'AdminController@index'); Route::get('/test', 'AdminController@index'); Route::get('/test2', 'AdminController@test'); .... }); ... 

There are more route groups that also work

/admin/ gives me a permission error. /admin/test/ /admin/test2/ work fine

here is the controller

namespace App\Http\Controllers; use Illuminate\Http\Request; class AdminController extends Controller { public function index(){ echo '2'; //return view('admin.dashboard'); } public function test(){ echo '1'; } } 

.htaccess doesnt show anything weird (default from laravel). I have also tried clearing caches.

I found nothing in the /etc/httpd conf files.

I have tired looking through all the code for the word 'admin' and can't find anything that is pointing to why its saying permission denied.

If i change the prefix to 'admins' it works so i am guessing some part of laravel is blocking the admin/ route. Where else can i look to see where its being blocked.

3 Answers 3

7

Check your public folder if you have 'admin' folder there, then rename it. In my case it was a reason of such a behavior.folders structure

Sign up to request clarification or add additional context in comments.

1 Comment

It's a very funny issue. =)
0

Check the config/auth file in your laravel directory and check the guards and providers array in it default look like this.

'providers' => [ 'users' => [ 'driver' => 'eloquent', 'model' => App\User::class, ], 'admins' => [ 'driver' => 'eloquent', 'model' => App\Admin::class, ], 

1 Comment

mine looks like this 'guards' => [ 'web' => [ 'driver' => 'session', 'provider' => 'users', ], 'api' => [ 'driver' => 'token', 'provider' => 'users', 'hash' => false, ], ], 'providers' => [ 'users' => [ 'driver' => 'eloquent', 'model' => App\User::class, ], // 'users' => [ // 'driver' => 'database', // 'table' => 'users', // ], ], there is nothing that says admin
0

Copy/Paste these files (.htaccess, index.php, favicon.ico, robots.txt) from the /public folder to the /public/admin folder.

Edit the /public/admin/index.php file and add "/.." to all 3 required php files:

from

require __DIR__.'/../vendor/autoload.php'; 

to

require __DIR__.'/../../vendor/autoload.php'; 

1 Comment

I did the same but then all other route will not work

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.