0

In web.php routes file, I have defined all the routes in route group, but some of them do not work and display a blank page but shows the page when defined outside of route group without prefix.

Route::group(['middleware' => 'auth', 'prefix' => 'admin'], function () {
    Route::get('/home', 'HomeController@index')->name('home');

    Route::resource('/category', 'CategoryController')->except(['destroy']);
    Route::get('/category/delete/{category}', 'CategoryController@destroy')->name('category.delete');

    Route::resource('/post', 'PostController')->except(['destroy']);
    Route::get('/post/delete/{post}', 'PostController@destroy')->name('post.delete');

    Route::get('/post/{post}/restore', 'PostController@restore')->name('post.restore');
    Route::get('/post/{post}/forceDelete', 'PostController@forceDelete')->name('post.forceDelete');
    Route::resource('/tag', 'TagController')->except(['destroy']);
    Route::get('/tag/{tag}/delete', 'TagController@destroy')->name('tag.destroy');

    Route::resource('user', 'UserController')->except(['destroy']);
    Route::get('/user/{user}/delete', 'UserController@destroy')->name('user.delete');
    Route::get('user/{user}/admin', 'UserController@makeAdmin')->name('user.admin')->middleware('admin');
    Route::get('/user/{user}/makeUser', 'UserController@makeUser')->name('user.user');
    Route::get('user/profile', 'ProfileController@index')->name('user.profile');
    Route::post('user/profile/update', 'ProfileController@update')->name('user.profile.update');
});
Karl Hill
  • 12,937
  • 5
  • 58
  • 95
  • 2
    Can you post the output of `php artisan route:list` command? – Amirmasoud May 06 '19 at 02:47
  • use the artisan command above and review those routes that aren't listed if any – Kevin May 06 '19 at 02:50
  • already tried that(show that routes are defined) and also used route:clear – samyak tuladhar May 06 '19 at 02:57
  • 1
    You should also make sure that you are authenticated because of `auth` middleware, check and see if this route works: `Route::get('/home', 'HomeController@index')->middleware('auth')->name('home');` if you need Laravel scaffold authentication you need to run `php artisan make:auth` – Amirmasoud May 06 '19 at 03:10
  • Route list show there is Auth middleware – samyak tuladhar May 06 '19 at 03:11
  • Can you make sure that you are authenticated and login/register routes/views exist? – Amirmasoud May 06 '19 at 03:29
  • Can you clarify, which route are you trying to access and what are you writing in browser? Your question just showing the list of route but it's not showing how you are trying to access. As a result we have no clue why you are facing this problem. – Imran May 06 '19 at 04:44
  • An idea; when VueJS fails to render, sometime the whole `body` html tag gets empty and you see a blank page. – Clément Baconnier May 06 '19 at 06:42

1 Answers1

0

You're routes are getting conflicted with each other, the routes generated with Route::resource are causing conflict with the routes that you have defined by yourselfenter code here.

There could be an issue here

Route::get('/user/{user}/delete', 'UserController@destroy')->name('user.delete');
Route::get('user/profile', 'ProfileController@index')->name('user.profile');

'profile' might be getting passed as a parameter user, throwing a blank page.

Aditya Thakur
  • 2,562
  • 2
  • 10
  • 21