Laravel从5.2升级到5.3

时间:2018-06-29 11:34:34

标签: php laravel

我在Laravel 5.2中有一个项目,我正在尝试将其更新为5.5。我首先开始按照官方指南从5.2更新到5.3,我完成了所有步骤,并且我的应用无法正常运行。当我转到该站点时,它将打开登录名,但是在我输入用户名和密码后,它看起来像“正在加载”,但它要做的就是重新加载登录页面。

检查并重新检查了更新指南中的所有项目,我不知道如何使它工作。

这是我的web.php路由文件:

/*
|--------------------------------------------------------------------------
| 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 Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\URL;

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');

1 个答案:

答案 0 :(得分:0)

最后,我找到了解决问题的答案。 当我使用用户名登录我的应用程序时,我检查了LoginController并添加了“ protected $ username ='USERNAME';”。就像5.2中的控制器一样,它无济于事,所以我一直在寻找,发现登录无效,因为没有人返回用户名,所以我创建:

public function username()
    {
        return 'USERNAME';
    }
在LoginController内的

,再试一次就可以了! 感谢您提供其他答案,希望这对其他人有帮助。