当前位置: 首页>>代码示例>>PHP>>正文


PHP Notification::where方法代码示例

本文整理汇总了PHP中app\Notification::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Notification::where方法的具体用法?PHP Notification::where怎么用?PHP Notification::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Notification的用法示例。


在下文中一共展示了Notification::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $notification = $this->notification->where('slug', $this->argument('notification'))->first();
     if (!$notification) {
         $this->error('Invalid notification provided.');
         return 1;
     }
     $users = $notification->subscribers;
     if (!count($users)) {
         $this->error('No subscribers to send to!');
         return 1;
     }
     if (method_exists($this, $notification->slug)) {
         $users = $this->{$notification->slug}($users);
     }
     if ($this->option('pretend')) {
         $this->info('Notification ' . $notification->name . ' would be sent to the following subscribers:');
         foreach ($users as $user) {
             $this->line($user->name . ' <' . $user->email . '>');
         }
         return 0;
     }
     foreach ($users as $user) {
         Mail::queue('emails.notifications.' . $notification->template, ['user' => $user], function ($message) use($user, $notification) {
             $message->to($user->email, $user->name);
             $message->subject($notification->subject);
         });
         $this->info('Queued notification for ' . $user->name . ' <' . $user->email . '>');
     }
     return 0;
 }
开发者ID:Cheddam,项目名称:health,代码行数:36,代码来源:SendNotification.php

示例2: index

 public function index()
 {
     $logged_user_id = Auth::user()->id;
     $users = User::find($logged_user_id);
     $notification = Notification::where('user_id', $logged_user_id)->orderBy('created_at', 'desc')->paginate(5);
     return View::make('notification')->with('users', $users)->with('notification', $notification);
 }
开发者ID:sagaekakristi,项目名称:ppla02,代码行数:7,代码来源:NotificationController.php

示例3: notifications

 public function notifications(View $view)
 {
     //Fetch all notifications for this user alone
     $notifications = Notification::where('user_id', auth()->user()->id)->paginate(3);
     $data = ['notifications' => $notifications];
     $view->with($data);
 }
开发者ID:carlosqueiroz,项目名称:laravel-hospital-record-system,代码行数:7,代码来源:DoctorComposer.php

示例4: notification

 /**
  * @return \Illuminate\View\View
  */
 public function notification()
 {
     //Fetch all notifications for this user alone
     $notifications = Notification::where('user_id', auth()->user()->id)->paginate(10);
     $data = ['notifications' => $notifications];
     return view('frontend.user.notification', $data);
 }
开发者ID:carlosqueiroz,项目名称:laravel-hospital-record-system,代码行数:10,代码来源:UserController.php

示例5: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $notifications = Notification::where('user_id', Auth::user()->id)->orderBy('id', 'desc')->paginate(10);
     $toUpdate = Notification::where('user_id', Auth::user()->id)->where('new', 1)->get();
     foreach ($toUpdate as $n) {
         $n->new = 0;
         $n->save();
     }
     return view('notifications.index', compact('notifications'));
 }
开发者ID:Techraav,项目名称:PolyMusic,代码行数:15,代码来源:NotificationController.php

示例6: testNotificationDelete

 public function testNotificationDelete()
 {
     $admin = User::find(1);
     $notification = new Notification();
     $notification->title = "Test title 123";
     $notification->type = "Alarm test";
     $notification->notes = "Test property ";
     $notification->data = "Test data ";
     $notification->save();
     $savedNotification = Notification::where('title', '=', 'Test title 123')->first();
     $this->actingAs($admin)->withSession(['foo' => 'bar'])->visit($this->modelUrl . (string) $savedNotification->id)->press('Delete')->seePageIs($this->modelUrl);
 }
开发者ID:Tanprasit,项目名称:property-management-system-web,代码行数:12,代码来源:NotificationsTest.php

示例7: read

 public static function read($user_id, $unread = true, int $limit = 500, $paginate = false)
 {
     if ($unread === true) {
         $notifications = Notification::where('user_id', $user_id)->where('is_read', 0)->orderBy('id', 'desc');
     } else {
         $notifications = Notification::where('user_id', $user_id)->orderBy('id', 'desc');
     }
     if (is_numeric($paginate) && $paginate > 0) {
         $notifications = $notifications->paginate($paginate);
     } else {
         $notifications = $notifications->limit($limit)->get();
     }
     return $notifications;
 }
开发者ID:svetlinyotov,项目名称:Timeline_v2.0,代码行数:14,代码来源:Notification.php

示例8: compose

 public function compose(View $view)
 {
     $array_task = [];
     $array_alert = [];
     $array_notification = [];
     $tasks_count = 0;
     $alerts_count = 0;
     $notifications_count = 0;
     //menus
     $packages = Package::with('modules')->get();
     //datas of the user logged
     $userAuth = Sentinel::getUser();
     $today = Carbon::now();
     //  tareas
     $tasks = Task::where('user_id', '=', $userAuth->id)->orwhere('role_id', '=', $userAuth->roles[0]->id)->orderBy('created_at', 'DESC')->get();
     foreach ($tasks as $task) {
         if (is_null($task->read)) {
             array_push($array_task, $task);
             $tasks_count++;
         } elseif (!in_array($userAuth->id, unserialize($task->read))) {
             array_push($array_task, $task);
             $tasks_count++;
         }
     }
     //  alertas
     $alerts = Task::where('expire_time', '<', $today)->Where(function ($query) use($userAuth) {
         $query->where('user_id', '=', $userAuth->id)->orwhere('role_id', '=', $userAuth->roles[0]->id);
     })->with('hasAlert')->get();
     foreach ($alerts as $alert) {
         if (is_null($alert->hasAlert[0]->alert_display)) {
             array_push($array_alert, $alert);
             $alerts_count++;
         } elseif (!in_array($userAuth->id, unserialize($alert->hasAlert[0]->alert_display))) {
             array_push($array_alert, $alert);
             $alerts_count++;
         }
     }
     //  notifications
     $notifications = Notification::where('user_id', '=', $userAuth->id)->orwhere('role_id', '=', $userAuth->roles[0]->id)->get();
     foreach ($notifications as $notification) {
         if (is_null($notification->read)) {
             array_push($array_notification, $notification);
             $notifications_count++;
         } elseif (!in_array($userAuth->id, unserialize($notification->read))) {
             array_push($array_notification, $notification);
             $notifications_count++;
         }
     }
     $view->with(array('packages' => $packages, 'userAuth' => $userAuth, 'alerts' => $array_alert, 'alerts_count' => $alerts_count, 'notifications' => $array_notification, 'notifications_count' => $notifications_count, 'tasks' => $array_task, 'tasks_count' => $tasks_count));
 }
开发者ID:gitfreengers,项目名称:larus,代码行数:50,代码来源:ProfileComposer.php

示例9: getNotifications

 /**
  * @return $this|\Illuminate\View\View
  */
 public function getNotifications()
 {
     //
     $user = Sentinel::getUser();
     $user_id = $user->id;
     $array_notification = [];
     // notifications
     $notifications = Notification::where('user_id', '=', $user->id)->orwhere('role_id', '=', $user->roles[0]->id)->get();
     foreach ($notifications as $notification) {
         if (is_null($notification->status)) {
             array_push($array_notification, $notification);
         } elseif (!in_array($user->id, unserialize($notification->status))) {
             array_push($array_notification, $notification);
         }
     }
     return view('notifications.notifications.index', compact('array_notification', 'user_id'));
 }
开发者ID:gitfreengers,项目名称:larus,代码行数:20,代码来源:NotificationsController.php

示例10: store

 /**
  * 更新消息
  *
  * @return void
  */
 public function store()
 {
     // get params & validate
     $id = Request::get('id');
     $message = Request::get('message');
     $durationAt = Request::get('duration_at');
     $state = Request::get('state');
     $redirectUrl = Request::get('_redirect_url');
     $rules = ['message' => 'required|max:500', 'duration_at' => 'required|date', 'state' => 'required|in:0,1'];
     $validator = Validator::make(Request::all(), $rules);
     if ($validator->fails()) {
         return Redirect::to($redirectUrl)->with('error', '保存失败~');
     }
     // save
     $data = ['message' => $message, 'duration_at' => $durationAt, 'state' => $state];
     if ($id) {
         Notification::where('id', $id)->update($data);
     } else {
         Notification::create($data);
     }
     // redirect
     return Redirect::to($redirectUrl)->with('success', '保存成功~');
 }
开发者ID:popfeng,项目名称:zao,代码行数:28,代码来源:NotificationsController.php

示例11: boot

 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     view()->composer('includes-update.header', function ($view) {
         $thanksCount = 0;
         $followCount = 0;
         if (Auth::user()->identifier == 1 || Auth::user()->identifier == 3) {
             $user = Induser::where('id', '=', Auth::user()->induser_id)->first();
             $favourites = Postactivity::with('user')->where('fav_post', '=', 1)->where('user_id', '=', Auth::user()->id)->orderBy('id', 'desc')->get(['id', 'fav_post', 'fav_post_dtTime', 'user_id', 'post_id']);
             $thanksCount = Postactivity::with('user', 'post')->join('postjobs', 'postjobs.id', '=', 'postactivities.post_id')->where('postjobs.individual_id', '=', Auth::user()->induser_id)->where('postactivities.thanks', '=', 1)->orderBy('postactivities.id', 'desc')->sum('postactivities.thanks');
             $linksCount = Connections::where('user_id', '=', Auth::user()->induser_id)->where('status', '=', 1)->orWhere('connection_user_id', '=', Auth::user()->induser_id)->where('status', '=', 1)->count('id');
             $linkrequestCount = Connections::where('connection_user_id', '=', Auth::user()->induser_id)->where('status', '=', 0)->count('id');
             $groupCount = Groups_users::where('user_id', '=', Auth::user()->induser_id)->count('id');
             $postCount = Postjob::where('individual_id', '=', Auth::user()->induser_id)->count('id');
             $profilePer = 0;
             if (Auth::user()->induser->fname != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->lname != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->email != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->mobile != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->dob != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->city != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->fb_page != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->in_page != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->gender != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->about_individual != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->education != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->experience != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->working_status != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->working_at != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->role != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->linked_skill != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->resume != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->prefered_location != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->prefered_jobtype != null) {
                 $profilePer = $profilePer + 1;
             }
             if (Auth::user()->induser->profile_pic != null) {
                 $profilePer = $profilePer + 1;
             }
             $profilePer = round($profilePer / 20 * 100);
         } else {
             if (Auth::user()->identifier == 2 || Auth::user()->identifier == 3) {
                 $user = Corpuser::where('id', '=', Auth::user()->corpuser_id)->first();
                 $followCount = Follow::where('corporate_id', '=', 1)->orWhere('individual_id', '=', 1)->count('id');
                 $linksCount = "";
                 $linkrequestCount = "";
                 $groupCount = "";
                 $postCount = Postjob::where('corporate_id', '=', Auth::user()->corpuser_id)->count('id');
                 $favourites = Postactivity::with('user')->where('fav_post', '=', 1)->where('user_id', '=', Auth::user()->id)->orderBy('id', 'desc')->get(['id', 'fav_post', 'fav_post_dtTime', 'user_id', 'post_id']);
                 $profilePer = 0;
                 if (Auth::user()->corpuser->firm_name != null) {
                     $profilePer = $profilePer + 1;
                 }
                 if (Auth::user()->corpuser->username != null) {
                     $profilePer = $profilePer + 1;
                 }
                 if (Auth::user()->corpuser->firm_type != null) {
                     $profilePer = $profilePer + 1;
                 }
                 if (Auth::user()->corpuser->emp_count != null) {
//.........这里部分代码省略.........
开发者ID:devvicky,项目名称:Jobb-new,代码行数:101,代码来源:UserServiceProvider.php

示例12: notificationNumber

 /**
  * Function that gets number of notifications.
  *
  * @return Response
  */
 public function notificationNumber()
 {
     // Check that user is part of authorized staff.
     if (Auth::user()->Type != 1) {
         // If they are unauthorized no point in returning anything.
         return response()->json(array());
     }
     $notifications = Notification::where('UserId', '=', Auth::user()->Id)->orderBy('Created', 'DES')->take(30)->get();
     $unloaded = 0;
     foreach ($notifications as $notification) {
         if (!$notification->Loaded) {
             $unloaded++;
         }
     }
     // Return response.
     $response['state'] = 'Success';
     $response['number'] = $unloaded;
     return response()->json($response);
 }
开发者ID:patrickdamery,项目名称:Eirene,代码行数:24,代码来源:GeneralController.php

示例13: editMessage

 /**
  * Edit notification message.
  *
  * @param EditNotificationMessageRequest $request
  * @param AjaxResponse $response
  * @return mixed
  */
 public function editMessage(EditNotificationMessageRequest $request, AjaxResponse $response)
 {
     Notification::where('id', $request->get('notification_id'))->update(['message' => $request->get('notification_message')]);
     $response->setSuccessMessage(trans('notifications.notification_message_updated'));
     return response($response->get())->header('Content-Type', 'application/json');
 }
开发者ID:bitller,项目名称:nova,代码行数:13,代码来源:NotificationsController.php

示例14: downvote

 public function downvote($id)
 {
     if (Request::ajax()) {
         $post = Post::find($id);
         $_upvote_handle = Vote::where('object_id', '=', Auth::id())->where('type', '=', 'upvote')->where('post_id', '=', $id)->first();
         if ($_upvote_handle) {
             $_upvote_handle->delete();
             $_notification_handle = Notification::where('type', '=', 'post')->where('object_id', '=', $id)->where('sender_id', '=', Auth::id())->where('user_id', '=', $post->author_id)->first();
             $_notification_handle->delete();
         }
         $post->newVote()->withType('downvote')->regarding(Auth::user())->deliver();
         $user = Auth::user();
         $post_author = User::find($post->author_id);
         $post_author->newNotification()->withType('post')->withSender($user->id)->withSubject($user->name . ' ' . $user->surname . ' downvoted your post.')->withBody('"' . $post->body . '"')->regarding($post)->deliver();
         return array('data1' => $post->votes()->type('downvote')->get()->count(), 'data2' => $post->votes()->type('upvote')->get()->count());
     }
 }
开发者ID:eldorplus,项目名称:laravel5.1_social_network,代码行数:17,代码来源:PostsController.php

示例15: seen

 public function seen($id)
 {
     $notification = Notification::where('id', $id)->first();
     $notification->seen = true;
     $notification->save();
 }
开发者ID:mcoyevans,项目名称:personiv-productivity-quality-report,代码行数:6,代码来源:NotificationController.php


注:本文中的app\Notification::where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。