本文整理汇总了PHP中app\Notification::format方法的典型用法代码示例。如果您正苦于以下问题:PHP Notification::format方法的具体用法?PHP Notification::format怎么用?PHP Notification::format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Notification
的用法示例。
在下文中一共展示了Notification::format方法的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]);
}