I'm not sure if this is the βrightβ way of doing things, but the logic works. I have my own class in my Laravel setup, which I am usein the controller. In my controller, I call the function in my custom class, however I would like to redirect the user if something happens inside this function.
After talking to the IRC, they told me that you cannot redirect in your class, you need to "return the redirect response object from the controller."
Not quite sure what this means, but I think you need to do a redirect from the controller.
Code (simplified, it works):
Controller method:
$v = new SteamValidation( $steam64Id );
$v->checkFirstTimeUser();
This goes into my SteamValidation class (app / Acme / Steam / SteamValidation.php and namespaced) and it checks:
public function checkFirstTimeUser() {
if( \User::count() == 0 ) {
$user_data = [
];
$newUser = \User::create( $user_data );
\Auth::login($newUser);
return \Redirect::route('settings');
}
return;
}
, 0, , . , , (return \Redirect::route('settings');), !
, :