Can you show me routes.php
file ? Maybe some filter caused that.
Sure,
<?php
# Home
Route::get('/', ['as' => 'home', 'uses' => 'PagesController@index']);
# Registration
Route::get('/register', ['as' => 'registration.create', 'uses' => 'RegistrationController@create']);
Route::post('/register', ['as' => 'registration.store', 'uses' => 'RegistrationController@store']);
# Authentication
Route::get('/login', ['as' => 'login', 'uses' => 'SessionsController@create']);
Route::get('/logout', ['as' => 'logout', 'uses' => 'SessionsController@destroy']);
Route::resource('/sessions', 'SessionsController', ['only' => ['create', 'store', 'destroy']]);
Thanks for helping!
oh! Sorry, I mean filters.php and User.php too :)
The filters.php is the standard file, haven't touched. User.php has a few things added, but not much.
See both here: https://nkhs.dk/f/redirect-problem/
Weirdest thing is that I'm using {{ URL::route('home') }} in my Blade views, which gives the correct URL, and I use Redirect::home() in the Logout-function, also giving me the correct route.
However after creating the user, it redirects to /register
I couldn't see any problem in your script :( sorry. You can try:
Redirect::route('home');
To redirect to a named route. And one more question, after the registration, can you use login with the account
Do you have any filter that auto redirect to the '/register' if the user have not logged in yet? I guess the problem is somehow your Auth::login($user) does not work.
Okay.. Solved. Stupidest mistake possible. I wrote Redirect::home() instead of return Redirect::home()
Thanks for your help, bomberman1990.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community