dongxi1320 2015-05-19 13:42
浏览 35

Laravel路线认证

if(Auth::attempt($credentials))
{
    return Redirect::to('admin');
}

after that it drops me to a project.dev/

my route:

Route::group(array('before' => 'auth'), function(){
 Route::get('admin', 'AdminController@getIndex');
}); 

AdminController

class AdminController extends \BaseController 
{ 

      public function getIndex() { 
            return View::make('admin.index'); 
      } 
} 

views -> admin-> index.blade.php not loading

Why i'm entering right email and password and after 'login' button it drops me again to login page? Error is somewhere in route

Master.blade.php

<ul class="nav nav-list well">
        @if(Auth::user())
        <li class="nav-header">{{ ucwords(Auth::user()->loginname) }}</li>
        <li>{{ HTML::link('post', 'Add Post') }}</li>
        <li>{{ HTML::link('users', 'View Users') }}</li>
        <li>{{ HTML::link('logout', 'Logout') }}</li>
        @else
        <li>{{ HTML::link('login', 'Login') }}</li>
        @endif
    </ul>

this if auth not working...

p.s. I am very grateful for your trying to help me..

my project is identical, but i have different table name (not 'users'). Also he has a 4.0.5 version of Laravel, but I have 4.2.7 or something like that. Where can be mistake?

  • 写回答

1条回答 默认 最新

  • doudaochu1699 2015-05-19 13:43
    关注

    Use this:

    if(Auth::attempt($credentials))
    {
       return redirect()->intended('admin'); 
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题