Reputation: 13
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.
Upvotes: 1
Views: 3432
Reputation: 1381
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';
Upvotes: 0
Reputation: 81
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
Upvotes: 7
Reputation: 1
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,
],
Upvotes: 0