How to get the current controller instance in laravel?
淡淡烟草味
淡淡烟草味 2017-05-16 16:56:29
0
1
318

Some properties are set in BaseController, User, Param, etc. How to call it from other location?

For example, when an administrator updates user information, logs need to be recorded, so the user.update event is triggered

$response = Event::fire('user.update',array($user));

Then in UserHandler@update, you need to obtain the current user's id, role and other information, which is in BaseControler

public $user;
public $param;
...
__construct(){
    $this->user = Auth::user();
    $this->param = Input::all();
    ...
}    

How to get the current controller instance in UserHandler@update to access parameters such as $user, $param?

淡淡烟草味
淡淡烟草味

reply all(1)
習慣沉默
    use App\Http\Controller;
    class UserHandler extends baseController{

    }
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!