Laravel updating from 5.2 to 5.3


Laravel updating from 5.2 to 5.3



I have a project in Laravel 5.2 and i'm trying to update it to 5.5. I first started following the official guide to update to 5.3 from 5.2, i did all the steps and my app isn't working properly. When I go to the site, it opens the login but after i enter username and password it looks "loading" but all it do is reload the login page. Checked and re-checked all items from update guide and i don't get how to make it work..



this is my web.php routes file:






/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
use IlluminateSupportFacadesAuth;
use IlluminateSupportFacadesURL;

Route::get('/', function () {


if (Auth::user()->isPrestador())
return redirect('/home');
elseif (Auth::user()->isAuditor())
return redirect('/auditor');
else return view('welcome');

})->middleware('auth')->name('home');
Auth::routes();
Route::get('/token', function (){
return csrf_token();
})->middleware('auth');
Route::get('/home', 'HomeController@index');
Route::get('/ayuda', function (){
if (Auth::guest() || Auth::user()->isPrestador()){
return Response::make(file_get_contents('./Manual-prestador-CAD.pdf'), 200, [
'Content-Type' => 'application/pdf',
'Content-Disposition' => "inline; filename='Manual-prestador-CAD.pdf'"
]);
}
elseif (Auth::user()->isAuditor())
return Response::make(file_get_contents('./Manual-auditor-CAD.pdf'), 200, [
'Content-Type' => 'application/pdf',
'Content-Disposition' => "inline; filename='Manual-auditor-CAD.pdf'"
]);
});

Route::get('/auditor/{idEstado?}/{idSolicitud?}', 'AuditorController@index')->where('idSolicitud', '[0-9]+');
Route::get('/auditor/form/{idItem}/{backUrl}', 'AuditorController@auditarForm')->where('idItem', '[0-9]+');
Route::get('/auditor/view/{idItem}/{backUrl}', 'AuditorController@auditarView')->where('idItem', '[0-9]+');
Route::post('/auditor/auditar', 'AuditorController@auditar');

Route::post('/afiliado/estado', 'AfiliadoController@consultarEstadoAfiliado');
Route::post('/prestacion/estado', 'PrestacionController@estado');

//ajax autocomplete
Route::get('/prestacion/codigo', 'PrestacionController@codigo');
Route::get('/prestacion/descripcion', 'PrestacionController@descripcion');
Route::get('/prestacion/view/{idItem}/{backUrl}', 'PrestacionController@viewItem')->where('idItem', '[0-9]+');

Route::post('solicitud/crear', 'SolicitudController@crear');
Route::get('solicitud/{idEstado?}/{idSolicitud?}', 'SolicitudController@index')->where('idSolicitud', '[0-9]+');
Route::get('solicitud/emitir/{idSolicitud}/{backUrl}', 'SolicitudController@emitir')->where('idSolicitud', '[0-9]+');
Route::post('solicitud/imprimir/{backUrl}', 'SolicitudController@imprimir');





After 5.4, there are major changes in framework. So you should read & follow: laravel.com/docs/5.5/upgrade
– Lovepreet Singh
Jun 29 at 11:48





I know, but all i did is try to update from 5.2 to 5.3 first, so i didn't face the major changes of 5.4 yet.
– L Nico
Jun 29 at 12:01





As a sidenote, this is why I hate updating Laravel. Everything points to them adhering to semantic versioning, while under the hood, every minor update breaks functionality on at least 20 levels. Anyway, if you look at the network tab of your inspector, is the page actually reloading?
– Loek
Jun 29 at 12:14






If i look at the network tab of the inspector, the page reloads. I tried writing anything in username and password and it works the same, so verification isn't working.
– L Nico
Jun 29 at 17:18




1 Answer
1



Finally I've found the answer to my problem.
As I use an username for login to my app, i checked LoginController and added "protected $username = 'USERNAME';" just like my controller in 5.2, it didn't help so i keep looking and found that the login didn't work 'cause nobody was returning the username, so i create:


public function username()
{
return 'USERNAME';
}



inside the LoginController, tried again and it works!
Thanks for the other answers, hope this can help other people.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

JMeter fails on beanshell imports

Why in node-red my HTTP POST no receive payload from inject?

PHP contact form sending but not receiving emails