Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird issue with route groups #34

Closed
duncanmcclean opened this issue Jun 8, 2019 · 3 comments
Closed

Weird issue with route groups #34

duncanmcclean opened this issue Jun 8, 2019 · 3 comments

Comments

@duncanmcclean
Copy link

When I use route groups in my web.php file it sometimes breaks my app.

For example I tried to do this and my entire app showed a blank screen (although the login screens seem to work)

Route::group(['suffix' => 'profile'], function() {
     Route::get('/', 'ProfileController@index')->name('profile.index');
});

However, when I take my routes out of groups, like this everything works perfectly fine.

Route::get('/profile', 'ProfileController@index')->name('profile.index');

This is what my ProfileController.php file looks like:

<?php

namespace App\Http\Controllers;

use App\User;
use Inertia\Inertia;
use Illuminate\Http\Request;

class ProfileController extends Controller
{
    public function __construct()
    {
        $this->middleware('auth');
    }

    public function index()
    {
        return Inertia::render('Profile/Index');
    }
}
@sylarbg
Copy link
Contributor

sylarbg commented Jun 8, 2019

@damcclean
prefix not suffix

@njoguamos
Copy link

@damcclean
prefix not suffix

As @damcclean said, you should use prefix not suffix i.e

Route::group(['prefix' => 'profile'], function() {
     Route::get('/', 'ProfileController@index')->name('profile.index');
});

@duncanmcclean
Copy link
Author

I've decided to not build my app in Inertia so I'm going to close this issue. Although thanks @sylarbg and @njoguamos for your help 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants