laravel 4在直接登录后注销?

laravel 4在直接登录后注销?,laravel,authentication,login,laravel-4,login-attempts,Laravel,Authentication,Login,Laravel 4,Login Attempts,我尝试通过电子邮件和密码登录 auth::尝试成功登录,但登录后重定向到链接时,它会自动注销,在本地主机上一切正常,但当我在主机上上载项目时,出现了此问题 登录功能 public function login(){ $validator=Validator::make(Input::all(),array( 'email' => 'email|required', 'pa

我尝试通过电子邮件和密码登录 auth::尝试成功登录,但登录后重定向到链接时,它会自动注销,在本地主机上一切正常,但当我在主机上上载项目时,出现了此问题

登录功能

public function login(){

            $validator=Validator::make(Input::all(),array(

                    'email'     =>  'email|required',

                    'password'  =>  'required'

                ));



            if($validator->fails()){

                $messages = $validator->messages();

                $msg='';

                foreach ($messages->all() as $message)

                {

                    $msg .= "<li>".$message."</li><br />";

                }

                return $msg;

            }

            else{

                $email = Input::get('email');

                $password = Input::get('password');

                $user=Auth::attempt(array(

                    'email' =>  $email,

                    'password'  =>  $password,

                    'activated' =>  1

                ),true);
                //die(Auth::user()->rule);
                if($user){
                    //Auth::login($user);
                    //die('1111111111');
                    return 1;

                }

                else{

                    return "يوجد خطأ فى البريد الإلكترونى أو كلمة المرور";

                }
                //die('11111111111111111');
            }

        }
公共函数登录(){
$validator=validator::make(输入::all(),数组(
“电子邮件”=>“电子邮件|必需”,
'密码'=>'必需'
));
如果($validator->fails()){
$messages=$validator->messages();
$msg='';
foreach($messages->all()作为$message)
{
$msg.=“
  • ”“$message。”

  • ”; } 返回$msg; } 否则{ $email=Input::get('email'); $password=Input::get('password'); $user=Auth::尝试(数组)( “email”=>$email, “密码”=>$password, “已激活”=>1 ),对); //die(Auth::user()->规则); 如果($user){ //Auth::login($user); //模具('1111111'); 返回1; } 否则{ 返回“返回”; } //模具('11111111'); } }
    模型


    您是否使用jquery重定向页面?是的,但我尝试过在没有ajax的情况下直接发布,并导致了相同的问题,我建议在laravel中进行重定向。您更喜欢使用jquery还是laravel?
    
    <?php
    use Illuminate\Auth\UserInterface;
    use Illuminate\Auth\Reminders\RemindableInterface;
    use Mmanos\Social\SocialTrait;
    
    class User extends Eloquent implements UserInterface, RemindableInterface
    {
        use SocialTrait;
    
         protected $fillable = array('username','password','rule', 'email','active','phone','address','add_info','image','first_name','sec_name','country','area','baqah_id');
        /**
         * The database table used by the model.
         *
         * @var string
         */
        protected $table = 'users';
    
        public static function is_admin(){
            if(Auth::user()->rule=='admin'){
                return true;
            }
            return false;
        }
    
        /*
        one to one relation 
        */
        /**
         * The attributes excluded from the model's JSON form.
         *
         * @var array
         */
        protected $hidden = array('password');
    
        /**
         * Get the unique identifier for the user.
         *
         * @return mixed
         */
        public function getAuthIdentifier()
        {
            return $this->getKey();
        }
    
        /**
         * Get the password for the user.
         *
         * @return string
         */
        public function getAuthPassword()
        {
            return $this->password;
        }
    
    
        /**
         * Get the e-mail address where password reminders are sent.
         *
         * @return string
         */
        public function getReminderEmail()
        {
            return $this->email;
        }
        public function getRememberToken()
        {
            return $this->remember_token;
        }
    
        public function setRememberToken($value)
        {
            $this->remember_token = $value;
        }
    
        public function getRememberTokenName()
        {
            return 'remember_token';
        }
    }