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


PHP Notification::create方法代码示例

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


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

示例1: handle

 /**
  * Handle the event.
  *
  * @param  Events  $event
  * @return void
  */
 public function handle(NotifiableEvent $event)
 {
     $notification = Notification::create($event->getData());
     $notification->notifiable()->associate($event->getNotifiable());
     $notification->save();
     $event->getUser()->notifications()->save($notification);
 }
开发者ID:bluecipherz,项目名称:bczapi,代码行数:13,代码来源:NotifyUser.php

示例2: create

 /**
  * Create new notification.
  *
  * @param CreateNotificationRequest $request
  * @return mixed
  */
 public function create(CreateNotificationRequest $request)
 {
     Notification::create(['title' => $request->get('title'), 'message' => $request->get('message'), 'notification_type_id' => NotificationType::where('type', $request->get('type'))->first()->id, 'targeted_user_id' => TargetedUser::first()->id]);
     $response = new AjaxResponse();
     $response->setSuccessMessage(trans('notifications.notification_created'));
     return response($response->get())->header('Content-Type', 'application/json');
 }
开发者ID:bitller,项目名称:nova,代码行数:13,代码来源:NotificationsController.php

示例3: editPost

 public function editPost($id, EditPostRequest $request)
 {
     $post = Post::findOrFail($id);
     $post->update(['post' => $request->input('post'), 'editor_id' => \Auth::id(), 'editor_name' => \Auth::user()->name, 'was_edited' => 1, 'edit_reason' => $request->input('edit_reason')]);
     Notification::create(['not_title' => 'Kliknij i przejdź do posta, aby sprawdzić szczegóły', 'not_body' => 'Twój post w artykule został edytowany', 'not_status' => 5, 'not_from_user_name' => \Auth::user()->name, 'user_id' => $post->user['id'], 'not_route' => '' . $request->input('take_uri') . '#post' . $id . '']);
     flash()->success('Udało Ci się edytować post o ID <b>' . $id . '</b>!');
     return redirect('/admin/article/' . $request->input('take_article_id') . '');
 }
开发者ID:AdrianKuriata,项目名称:projekt,代码行数:8,代码来源:ModController.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $v = Validator::make($request->all(), ['title' => 'required', 'body' => 'required', 'will_be' => 'required']);
     if ($v->fails()) {
         return redirect()->back()->withErrors($v->errors());
     }
     $notification = Notification::create($request->all());
     return Redirect::to('admin/notifications');
 }
开发者ID:amatelic,项目名称:skavti,代码行数:15,代码来源:NotificationController.php

示例5: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     $this->call('UsersTableSeeder');
     DB::table('package')->delete();
     \App\Package::create(['name' => 'hoc', 'content' => 'hoc hanh']);
     DB::table('notification')->delete();
     \App\Notification::create(['title' => 'hoc bong abc', 'content' => 'hoc hanh', 'package_id' => 1]);
     // Add calls to Seeders here
 }
开发者ID:kimnv57,项目名称:laravel-simple-api-ueter-aide,代码行数:15,代码来源:DatabaseSeeder.php

示例6: update

 public function update($id)
 {
     // save updated
     $record = $this->records->find($id);
     if (!$record) {
         Notification::create(Input::all());
         return $this->respond($record);
     }
     $record->fill(Input::all())->save();
     return $this->respond($record);
 }
开发者ID:wyrover,项目名称:lenda-api,代码行数:11,代码来源:NotificationsController.php

示例7: handle

 /**
  * Execute the console command. TODO: This could probably be better? Ok for now though, it works:)
  *
  * @return mixed
  */
 public function handle()
 {
     try {
         $this->ping("google.com");
     } catch (\Exception $e) {
         // If we can't ping google I'll assume we're offline, so let's notify admins.
         $users = User::where('UserLevel', '=', 1)->get();
         foreach ($users as $admin) {
             Notification::create(array('UserId' => $admin->Id, 'Created' => date('Y-m-d H:i:s'), 'Reason' => 'Aergia ha detectado de que no tiene conexion a internet, por favor restablecer la conexion para que el sistema pueda mantener su correcto funcionamiento!', 'Url' => '#', 'Seen' => false));
         }
     }
 }
开发者ID:patrickdamery,项目名称:Eirene,代码行数:17,代码来源:CheckConnectivity.php

示例8: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     try {
         $inputs = $request->all();
         unset($inputs['_token']);
         $device_tokens = Customer::where('platform', 'A')->lists('device_token');
         $is_sent = PnS::sendPnsToAndroidDevices($device_tokens, $inputs['body']);
         if ($is_sent) {
             $inputs['user_id'] = Auth::id();
             Notification::create($inputs);
         }
         return redirect()->to('/crm/notification/')->withMessage(Generate::success_message('Success', 'Sent Successfully'));
     } catch (Exception $e) {
         return redirect()->to('/crm/notification/')->withMessage(Generate::error_message('Failed', $e->getMessage()));
     }
 }
开发者ID:vampirethura,项目名称:modelvillage,代码行数:22,代码来源:NotificationController.php

示例9: accept

 public function accept()
 {
     $oMate = Mate::where('from_user_id', Input::get('from_user_id'))->where('status', Mate::MATE_STATUS_ADDED_BY_USER)->orWhere('status', Mate::MATE_STATUS_ADDED_BY_ADMIN)->first();
     $oMate->update(['status' => Mate::MATE_STATUS_ACCEPTED_BY_USER]);
     if ($oMate) {
         $aMate = $oMate->toArray();
         $aUpdate = Update::create(['user_id' => Session::get('user')['id'], 'update_type' => Update::UPDATE_TYPE_MATE, 'status' => Update::UPDATE_STATUS_ACTIVE]);
         $aNotification = Notification::create(['from_user_id' => $aMate['to_user_id'], 'to_user_id' => $aMate['from_user_id'], 'notification_type' => Notification::NOTIFICATION_TYPE_MATE_ACCEPTED_REQUEST_BY_USER, 'status' => Notification::NOTIFICATION_STATUS_ACTIVE, 'mate_id' => $aMate['id']]);
         if ($aUpdate) {
             return response()->json(['status' => true, 'message' => "Successfully accepted", 'mate' => json_encode($aMate)]);
         } else {
             return response()->json(['status' => false, 'message' => "Something went wrong. Please try again"]);
         }
     } else {
         return response()->json(['status' => false, 'message' => "Something went wrong. Please try again"]);
     }
 }
开发者ID:captainbuggythefifth,项目名称:social-media-dating,代码行数:17,代码来源:MatesController.php

示例10: run

 public function run()
 {
     DB::table('notifications')->delete();
     Notification::create(['user_id' => 3, 'loan_id' => 1, 'notification_type' => 'comment', 'task' => 'You have a message']);
     Notification::create(['user_id' => 3, 'loan_id' => 2, 'notification_type' => 'report', 'report_id' => 1, 'task' => 'Confirm Activity Detail Report']);
     Notification::create(['user_id' => 3, 'loan_id' => 1, 'report_id' => 2, 'notification_type' => 'report', 'task' => 'Confirm Customer Budget Report']);
     Notification::create(['user_id' => 3, 'loan_id' => 2, 'report_id' => 3, 'notification_type' => 'report', 'task' => 'Confirm Account Reconciliation Report']);
     Notification::create(['user_id' => 3, 'loan_id' => 1, 'report_id' => 9, 'notification_type' => 'report', 'task' => 'Confirm Crop Mix Report']);
     Notification::create(['user_id' => 4, 'loan_id' => 1, 'notification_type' => 'report', 'report_id' => 1, 'task' => 'Confirm Activity Detail Report']);
     Notification::create(['user_id' => 4, 'loan_id' => 1, 'report_id' => 2, 'notification_type' => 'report', 'task' => 'Confirm Customer Budget Report']);
     Notification::create(['user_id' => 4, 'loan_id' => 1, 'report_id' => 3, 'notification_type' => 'report', 'task' => 'Confirm Account Reconciliation Report']);
     Notification::create(['user_id' => 4, 'loan_id' => 1, 'report_id' => 9, 'notification_type' => 'report', 'task' => 'Confirm Crop Mix Report']);
     Notification::create(['user_id' => 3, 'loan_id' => 1, 'notification_type' => 'vote', 'task' => 'Review Loan: Tony Stark - Glass Towers']);
     Notification::create(['user_id' => 3, 'loan_id' => 2, 'notification_type' => 'vote', 'task' => 'Review Loan: Clint Barton - Nested Row']);
     Notification::create(['user_id' => 3, 'notification_type' => 'office', 'task' => 'Staff Meeting on Wednesday, Dec. 10, 2014', 'status' => 'acknowledged']);
     Notification::create(['user_id' => 4, 'notification_type' => 'office', 'task' => 'Review Site']);
     Notification::create(['user_id' => 4, 'notification_type' => 'office', 'task' => 'Report Progress']);
     Notification::create(['user_id' => 4, 'notification_type' => 'office', 'task' => 'Enjoy life!']);
 }
开发者ID:wyrover,项目名称:lenda-api,代码行数:19,代码来源:NotificationsTableSeeder.php

示例11: store

 public function store(Requests\NotifyRequest $request)
 {
     //how to fetch all input and fetch each individual
     //Notification::create($request->all());
     //$input = Request::all();
     //$input = Request::get('title');
     //$input['date'] = ('date');
     //Store the form created
     //Notification::create($input);
     //Using auth
     //$notification = new Notification($request->all());
     //Auth::user()->articles()->save($article);
     //session()->flash('flash_message', 'Your notification has been saved');
     //session()->flash('flash_message_important', 'true');
     //validation
     //Inline to make cleaner
     Notification::create($request->all());
     flash('Notification is created');
     return redirect('notifies');
     //return $input;
 }
开发者ID:AngelWilson,项目名称:BermudaTransit,代码行数:21,代码来源:NotificationsController.php

示例12: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     // Get all calendar entries that are due in two hours.
     $now = date('Y-m-d H:i:s');
     $events = Calendar::where('Reminded', '=', false)->where('Start', '<=', date('Y-m-d H:i:s', strtotime($now) + 7200))->get();
     // Now remind each user.
     foreach ($events as $event) {
         $user = User::where('TypeId', '=', $event->WorkerId)->first();
         $notification = Notification::create(array('UserId' => $user->Id, 'Created' => $now, 'Reason' => 'Recordatorio de Evento: ' . $event->Title, 'Url' => '/calendar/' . $event->Id, 'Seen' => false));
         // Update event.
         $event->Reminded = true;
         $event->save();
         // Now check if this event should be rescheduled.
         switch ($event->Type) {
             case 2:
                 // Add event next week.
                 Calendar::create(array('Start' => date('Y-m-d H:i:s', strtotime($event->Start) + 604800), 'End' => date('Y-m-d H:i:s', strtotime($event->End) + 604800), 'WorkerId' => $event->WorkerId, 'Title' => $event->Title, 'AllDay' => $event->AllDay, 'Type' => $event->Type));
                 break;
             case 3:
                 // Add event next Month.
                 Calendar::create(array('Start' => date('Y-m-d H:i:s', strtotime($event->Start) + 2419200), 'End' => date('Y-m-d H:i:s', strtotime($event->End) + 2419200), 'WorkerId' => $event->WorkerId, 'Title' => $event->Title, 'AllDay' => $event->AllDay, 'Type' => $event->Type));
                 break;
             case 4:
                 // Add event next Year.
                 Calendar::create(array('Start' => date('Y-m-d H:i:s', strtotime($event->Start) + 29030400), 'End' => date('Y-m-d H:i:s', strtotime($event->End) + 29030400), 'WorkerId' => $event->WorkerId, 'Title' => $event->Title, 'AllDay' => $event->AllDay, 'Type' => $event->Type));
                 break;
         }
     }
     // Check for provider payments.
     $events = Calendar::where('Type', '=', 5)->where('Start', '<=', date('Y-m-d H:i:s', strtotime($now) + 172800))->get();
     // Now remind each user.
     foreach ($events as $event) {
         $user = User::where('TypeId', '=', $event->WorkerId)->first();
         $notification = Notification::create(array('UserId' => $user->Id, 'Created' => $now, 'Reason' => 'Dentro de dos dias se deberia pagar: ' . $event->Title, 'Url' => '/calendar/' . $event->Id, 'Seen' => false));
         // Update event.
         $event->Reminded = true;
         $event->save();
     }
 }
开发者ID:patrickdamery,项目名称:Eirene,代码行数:44,代码来源:CheckCalendar.php

示例13: 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

示例14: handle

 /**
  * Handle the event.
  *
  * @param  BookHasCreated  $event
  * @return void
  */
 public function handle(BookHasCreated $event)
 {
     //
     Notification::create(['user_id' => \Auth::id(), 'text' => $event->text, 'url' => $event->url, 'created_on' => Carbon::now(), 'unread' => $event->unread, 'barcode' => $event->barcode]);
 }
开发者ID:nicsmyrn,项目名称:library,代码行数:11,代码来源:NotificationListener.php

示例15: insertNotification

 /**
  * Insert Notification
  * @param $senderId
  * @param $receiverId
  * @param $type
  * @param $message
  * @param $itemId
  * @return bool|mixed
  */
 public function insertNotification($senderId, $receiverId, $type, $message, $itemId)
 {
     $notification = Notification::create(['sender_id' => $senderId, 'receiver_id' => $receiverId, 'message' => $message, 'item_id' => $itemId, 'type' => $type]);
     return $notification->id;
 }
开发者ID:namoosshah,项目名称:basketball,代码行数:14,代码来源:WorkoutSchedulesController.php


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