I have a route:
Route::get('activate/{key}', function($key) {
Login::activateAccount($key);
})->where('key', '[a-z0-9]{40}');
and inside activateAccount
action I try to redirect to another route:
public static function activateAccount($key) {
$affectedRows = User::where('activation_code', '=', $key)->update(array('is_active' => 1));
if ($affectedRows > 0) {
return Redirect::to('/signin')->with('activatedAccount', 'Your account is activated. You can sign in now.');
}
}
but it does not redirect, just show me a blank page and the response than I get from Firebug->Net->Response is:
Reload the page to get source for: localhost/myProject/public/activate/89b322bc6da6bbfd0c690c0f6bee2d2adebc9a8a
Update: when this code is inside the Route it works normally.
Update2: here is the view
<div>
{{ Session::get('activatedAccount') }}
{{ Session::get('serverError') }}
</div>
{{ Form::open(array('action' => 'Login@signIn', 'method' => 'post')) }}
<input type="text"
name="email"
placeholder="Email" />
<input type="password"
name="password"
placeholder="Password" />
<input type="submit"
value="Sign In" />
{{ Form::close() }}
{{ link_to('choose_signup', 'Sign Up', $secure = null) }}
@foreach ($errors->all() as $message)
<div>
{{ $message }}
</div>
@endforeach