lundi 10 décembre 2018

Setting up named routes within a subdomain group in Laravel 5.7

thanks in advance...

I have been working on a multi-tenant app and I'm trying to set up the routes in sub-domains according to the documentation:https://laravel.com/docs/5.7/routing#route-group-sub-domain-routing

In my web.php route file, I have something like this:

Route::domain('{account}.example.test')->group(function () {        
    Route::get('/home', 'HomeController@index')->name('home');        
});

Right now, the problem is using named routes in blade, but I suppose I may run into the same problem eventually in my Controllers.

Whenever I try to used a name route like this:

Blade Code

<a href="">Home</a>

I get the following error:

Missing required parameters for [Route: home] [URI: home]. (View: /home/vagrant/Code/example/resources/views/example.blade.php)

I have found a way for solving this, you just have to:

<a href="">Home</a>

But I was wondering if there's a cleaner way to do this, maybe with some middleware that always injects the parameter?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire