How to pass query string params to routes in Laravel4

半城伤御伤魂 提交于 2019-12-01 00:27:46

You might want to implement this in your BaseController. This is one of the possible solutions:

class BaseController extends Controller {

    protected $fields;

    public function __construct(){

        if (Input::has('fields')) {
            $this->fields = Input::get('fields');
        }
    }
}

After that $fields could be accessed in every route which is BaseController child:

class AccountApiController extends \BaseController {

    public function index()
    {
        dd($this->fields);
    }
} 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!