本文整理匯總了PHP中app\Notification::read方法的典型用法代碼示例。如果您正苦於以下問題:PHP Notification::read方法的具體用法?PHP Notification::read怎麽用?PHP Notification::read使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\Notification
的用法示例。
在下文中一共展示了Notification::read方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: boot
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
view()->composer('layouts.master', function ($view) {
$notification_obj = Notification::read(Auth::user()->id, true, 3);
$notification_list = Notification::format($notification_obj);
$view->with('user_notification_count', Notification::count(Auth::user()->id));
$view->with('user_notification_list', $notification_list);
$view->with('user_messages_count', Messages::countUnseen());
$view->with('user_messages_list', Messages::topUnseen(3));
});
view()->composer('users.list', function ($view) {
$view->with('company_id', User::where('id', Auth::user()->id)->with(['company' => function ($q) {
$q->select('companies.id', 'companies.name');
}])->first()->company->pluck('id')->toArray()[0] ?? "");
$view->with('company_name', User::where('id', Auth::user()->id)->with(['company' => function ($q) {
$q->select('companies.id', 'companies.name');
}])->first()->company->pluck('name')->toArray()[0] ?? "");
});
}
示例2: showAllNotifications
public function showAllNotifications($id = null)
{
if ($id == null) {
$id = Auth::user()->id;
}
$notification_count = Notification::count($id);
$notification_obj = Notification::read($id, false, 1000, 12);
$notifications = Notification::format($notification_obj);
$user = User::with('info')->where('id', $id)->first();
return view('users.notifications')->with(['notifications' => $notifications, 'notifications_obj' => $notification_obj, 'notification_count' => $notification_count, 'user' => $user]);
}