【发布时间】:2020-03-27 07:14:22
【问题描述】:
我的控制器:
<?php
public function Dashboard()
{
foreach ($roles as $item) {
if (Auth::User()->hasRole("$item->name")) {
$office_role = $item->name;
}
}
$office_id = Auth::User()->office_id;
$return_counter = Notification::where('recipient_office_id', $office_id)->where('recipient_office_role', $office_role)->where('status', 0)->where('type', 'Return')->count();
$return_counter_pending = Notification::where('recipient_office_id', $office_id)->where('recipient_office_role', $office_role)->where('status', 2)->where('type', 'Return')->count();
return view('Dashboard', compact('return_counter', 'return_counter_pending'));
}
我想通过视图编辑器将这些数据传递给所有视图。但是如何实现这一点,我尝试过,但是每当我尝试使用身份验证时,我都在引导方法中无法访问登录页面。
【问题讨论】:
标签: laravel