2017-03-07 13 views
1

質問があります。 私のルートはLaravelサブドメインのルートとコントローラのパラメーター

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

ですそして、私のコントローラメソッドは、私は2 parametrs $ドメインと$ハッシュを使用する必要があり、私はルートを変更する必要がありますどのように持っている私の方法では

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"; 
    } 

} 

ある

function confirmEmail($hash) 

答えて

2

リクエストのヘルパーからルートパラメータにアクセスできます

request()->route('domain') 

request()->route('hash') 
関連する問題