wahdan
wahdan

Reputation: 1258

Adding prefix as a variable in route::group in laravel

I got this error message when i am trying to add prefix as a variable in route group

error message :

UrlGenerationException in UrlGenerationException.php line 17:
Missing required parameters for [Route: client.login] [URI: login].

web.php :

Route::group(['prefix' => '{account}'], function()
{
    Route::GET('login', ['as' => 'client.login', 'uses' => 'Client\Auth\LoginController@showLoginForm']);

}

controller :

public function showLoginForm()
{

    return view('client.auth.login', $this->data);
}

Upvotes: 1

Views: 929

Answers (1)

Cruncher
Cruncher

Reputation: 7796

Your controller function must accept as arguments the URL params defined in the routes.

In this case it should be

public function showLoginForm($account)
{
    return view('client.auth.login', $this->data);
}

But you probably want to do something with account

Upvotes: 1

Related Questions