2019-07-31 08:59 阅读 43

在laravel 4.2中登录后如何重定向?

I'm used to working on laravel 5.4 and above, i just got this project with a problem in authentification that is rather weird. Locally, the authentification works just fine but when i try to log using the project on prod i always get redirected to login page. this is the login function:

public function loginadmin()
    $pseudo = Input::get('pseudo');
    $pass = Input::get('pass');

    $user = Admin::where('pseudo',$pseudo)->where('pass',$pass)->get()->first();
      Auth::admin()->loginUsingId( $user->id );
      return Redirect::back();
      Session::flash('errorAuth', "ok");
      return Redirect::back();

this is the routes.php

 /* Connexion */
Route::get('admin-igd', function(){ 
  if( !Auth::admin()->get())
    return View::make('admin.login');

  return Redirect::to('admin-igd/slider');

and this is the filters.php:

 Route::filter('loginadmin', function($route, $request)
if ( !Auth::admin()->get()) {
    return Redirect::to('admin-igd');
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • douzongmu2543 douzongmu2543 2019-08-01 14:35

    Try once after executing below command on your project.

    php artisan route:clear

    点赞 评论 复制链接分享