jeudi 22 septembre 2016

Upgrade from 5.0 to 5.1 vendor trait not load

I upgrade my Laravel 5.0 to 5.1 I notice that my TrustyTrait is not loaded in 5.1 I need to use the method "is",

Here is the debug output from 5.0, I simply change the method from "is" to "asd" to display the error. As you can see, it actually called TrustyTrait.php line 155

in Builder.php line 1999
at Builder->__call('asd', array('administrator'))
at Builder->asd('administrator')
at call_user_func_array(array(object(Builder), 'asd'), array('administrator')) in Builder.php line 933
at Builder->__call('asd', array('administrator'))
at Builder->asd('administrator')
at call_user_func_array(array(object(Builder), 'asd'), array('administrator')) in TrustyTrait.php line 155
at User->__call('asd', array('administrator')) in AdminController.php line 19
at User->asd('administrator') in AdminController.php line 19

Here is the debug output from 5.1, the correct method from "is" but it display the error. After Builder.php then it go to Model.php, but for 5.0, it go to TrustyTrait.php

in Builder.php line 2093
at Builder->__call('is', array('administrator'))
at Builder->is('administrator')
at call_user_func_array(array(object(Builder), 'is'), array('administrator')) in Builder.php line 1015
at Builder->__call('is', array('administrator'))
at Builder->is('administrator')
at call_user_func_array(array(object(Builder), 'is'), array('administrator')) in Model.php line 3444
at Model->__call('is', array('administrator')) in AdminController.php line 19
at User->is('administrator') in AdminController.php line 19

What is the thing I missed out?

Here is the code for AdminController:

public function isAdmin(){
        //Check Member Auth
        $this->beforeFilter('@filterRequests');
    }

    public function filterRequests()
    {

        if (!is_object(\Auth::user()) || !\Auth::user()->is('administrator')) return \Redirect::guest('/admin/login')->with('error','You are not Unauthorized');
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire