2017-03-07 89 views
1

我有问题。 我的路线是Laravel子域路由和控制器参数

Route::group(['domain' => '{account}.'.$domain], function() { 
    Route::get('/confirmmail/{hash}', 'Auth\[email protected]'); 
}); 

而且我的控制方法是

public function confirmEmail($domain, $hash) 
{ 
    $user = User::where('confirm_token', $hash)->firstOrFail(); 
    $affectedRows = $user->update(array('active' => 1)); 
    if ($affectedRows) { 
     Auth::login($user); 
     return Redirect::to('http://'.$user->workshop->slug.'.'.config('app.domain')); 
    } else { 
     echo "nie"; 
    } 

} 

在我的方法,我必须使用两个parametrs $域和$哈希,我如何必须改变路线,有

function confirmEmail($hash) 

回答

2

您可以从请求助手访问路由参数

request()->route('domain') 

request()->route('hash')