Support the ongoing development of Laravel.io →
Requests Forms
Last updated 2 years ago.
0

Can you show me routes.php file ? Maybe some filter caused that.

Last updated 2 years ago.
0

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!

Last updated 2 years ago.
0

oh! Sorry, I mean filters.php and User.php too :)

Last updated 2 years ago.
0

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/

Last updated 2 years ago.
0

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

Last updated 2 years ago.
0

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

Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

Okay.. Solved. Stupidest mistake possible. I wrote Redirect::home() instead of return Redirect::home()

Thanks for your help, bomberman1990.

Last updated 2 years ago.
0

Haha! I couldn't see it too! =))

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

skovmand skovmand Joined 27 May 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.