是否可以检查请求页面的Laravel控制器?

时间:2017-11-06 18:43:45

标签: php laravel

在我的控制器中,我有一个功能welcome,可由未经身份验证的用户和管理员调用。

在我的@auth视图中,我使用@guestpublic function welcome() { // these are for users and admin $header = Data::where("section", "header")->get(); $header_secondary = Data::where("section", "header_secondary")->get(); $tel = Data::where("section", "tel")->get(); $working_hours = Data::where("section", "working_hours")->get(); // this data is for admins only.. Is there a way not to include it in // the view, if the request is done by a regular user? $important_data = Important::where("year", "2017")->get() return view("welcome", compact("header", "header_secondary", "tel", "working_hours", "important_data")); } 来确定要显示的内容

welcome

但是,我是否可以重新组织我的[ tf.constant([1]), tf.constant([2,3]), tf.zeros([4,4,4]) ] 功能,如果普通用户发出请求,则不会向他发送包含针对管理员的数据的视图?

0 个答案:

没有答案