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


PHP Notification::save方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $notify_report = false;
     for ($i = 0; $i < count($request->all()); $i++) {
         if ($request->input($i . '.include')) {
             $this->validate($request, [$i . '.id' => 'required', $i . '.member.id' => 'required|numeric', $i . '.position_id' => 'required|numeric', $i . '.project_id' => 'required|numeric', $i . '.target_id' => 'required|numeric', $i . '.output' => 'required|numeric', $i . '.date_start' => 'required|date', $i . '.date_end' => 'required|date', $i . '.hours_worked' => 'required|numeric', $i . '.daily_work_hours' => 'required|numeric', $i . '.output_error' => 'required|numeric']);
             // check if a report is already created
             if (!$notify_report) {
                 $admin = User::where('role', 'admin')->first();
                 $report = Report::where('id', $request->input($i . '.report_id'))->first();
                 // create a notification
                 $notification = new Notification();
                 $notification->message = 'updated a ';
                 $notification->sender_user_id = $request->user()->id;
                 $notification->receiver_user_id = $admin->id;
                 $notification->subscriber = 'admin';
                 $notification->state = 'main.weekly-report';
                 $notification->event_id = $report->id;
                 $notification->event_id_type = 'report_id';
                 $notification->seen = false;
                 $notification->save();
                 $notify = DB::table('reports')->join('users', 'users.id', '=', 'reports.user_id')->join('projects', 'projects.id', '=', 'reports.project_id')->join('notifications', 'notifications.event_id', '=', 'reports.id')->select('reports.*', 'users.*', DB::raw('LEFT(users.first_name, 1) as first_letter'), 'projects.*', 'notifications.*')->where('notifications.id', $notification->id)->first();
                 // foreach ($query as $key => $value) {
                 //     $notify = $value;
                 // }
                 event(new ReportSubmittedBroadCast($notify));
                 $activity_type = ActivityType::where('action', 'update')->first();
                 $activity = new Activity();
                 $activity->report_id = $report->id;
                 $activity->user_id = $request->user()->id;
                 $activity->activity_type_id = $activity_type->id;
                 $activity->save();
                 // report
                 $create_report = true;
             }
             $old_performance = Performance::where('id', $request->input($i . '.id'))->first();
             // record history of the performance
             $performance_history = new PerformanceHistory();
             $performance_history->activity_id = $activity->id;
             $performance_history->performance_id = $old_performance->id;
             $performance_history->report_id = $old_performance->report_id;
             $performance_history->member_id = $old_performance->member_id;
             $performance_history->position_id = $old_performance->position_id;
             $performance_history->department_id = $old_performance->department_id;
             $performance_history->project_id = $old_performance->project_id;
             $performance_history->target_id = $old_performance->target_id;
             $performance_history->date_start = $old_performance->date_start;
             $performance_history->date_end = $old_performance->date_end;
             $performance_history->daily_work_hours = $old_performance->daily_work_hours;
             $performance_history->output = $old_performance->output;
             $performance_history->hours_worked = $old_performance->hours_worked;
             $performance_history->output_error = $old_performance->output_error;
             $performance_history->average_output = $old_performance->average_output;
             $performance_history->productivity = $old_performance->productivity;
             $performance_history->quality = $old_performance->quality;
             $performance_history->quadrant = $old_performance->quadrant;
             $performance_history->save();
         }
     }
 }
开发者ID:mcoyevans,项目名称:personiv-productivity-quality-report,代码行数:66,代码来源:PerformanceHistoryController.php

示例2: postCreate

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function postCreate(NotificationRequest $request)
 {
     $notification = new Notification();
     $notification->title = $request->title;
     $notification->content = $request->content;
     $notification->package_id = $request->package_id;
     $notification->save();
 }
开发者ID:kimnv57,项目名称:laravel-simple-api-ueter-aide,代码行数:13,代码来源:NotificationController.php

示例3: handle

 /**
  * Handle the event.
  *
  * @param  BadgeWasEarned  $event
  * @return void
  */
 public function handle(BadgeWasEarned $event)
 {
     $user = $event->user;
     $notification = new Notification();
     $notification->type = "Badge";
     $notification->is_read = false;
     $notification->user_id = $user->id;
     $notification->save();
 }
开发者ID:Clazance,项目名称:developer-shame,代码行数:15,代码来源:SendBadgeNotification.php

示例4: addConnectionNotification

 public function addConnectionNotification($friend)
 {
     $sender = User::findOrFail(Auth::user()->id);
     $notification = new Notification();
     $notification->user_id = $friend->id;
     $notification->title = 'Someone has added you as their connection!';
     $notification->body = $sender->name . ' added you to their connection list, add them back to interact with them if you have not done so already!';
     $notification->save();
 }
开发者ID:mathewsandi,项目名称:Practice,代码行数:9,代码来源:UserRepository.php

示例5: addNtf

 public function addNtf()
 {
     $notification = new Notification();
     $notification->message = 'test';
     $notification->cron = '* * * * * *';
     $notification->receiver_id = 1;
     $notification->save();
     return "added";
 }
开发者ID:dzikimarian,项目名称:hipchat-reminder,代码行数:9,代码来源:NotificationsController.php

示例6: sentMessageNotification

 public function sentMessageNotification($user)
 {
     $sender = User::findOrFail(Auth::user()->id);
     $notification = new Notification();
     $notification->user_id = $user->id;
     $notification->title = 'You have a new message!!';
     $notification->body = $sender->name . ' has sent you a private message! Go to your inbox to reply now!';
     $notification->save();
 }
开发者ID:mathewsandi,项目名称:Practice,代码行数:9,代码来源:MessageRepository.php

示例7: add

 public static function add($user_id, $type, $more = null)
 {
     $notification = new Notification();
     $notification->user_id = $user_id;
     $notification->type = $type;
     if ($more != null) {
         $notification->more = json_encode($more);
     }
     $notification->save();
 }
开发者ID:svetlinyotov,项目名称:Timeline_v2.0,代码行数:10,代码来源:Notification.php

示例8: save

 private function save(Notification $notification, array $inputs)
 {
     $notification->track_id = intval($inputs['track_id']);
     $notification->sender_id = intval($inputs['sender_id']);
     $notification->user_id = intval($inputs['friend_id']);
     $notification->sender_name = $inputs['sender_name'];
     $notification->track_cover = $inputs['track_cover'];
     $notification->sender_cover = $inputs['sender_cover'];
     $notification->track_name = $inputs['track_name'];
     $notification->seen = 0;
     $notification->save();
 }
开发者ID:flelievre,项目名称:Museek,代码行数:12,代码来源:NotificationRepository.php

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

示例10: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //
     $notification = new Notification();
     if (Request::has('text') && Request::input('text') != "") {
         $notification->text = Request::input('text');
         $notification->save();
         return Response::make("Success", 201);
     } else {
         // Bad request, missing parameters
         return Response::make("Please provide a notification.", 400);
     }
 }
开发者ID:BrynnLawson,项目名称:smarka,代码行数:18,代码来源:NotificationsController.php

示例11: handle

 /**
  * Handle the event.
  *
  * @param  ShameWasUpdated  $event
  * @return void
  */
 public function handle(ShameWasUpdated $event)
 {
     $shame = $event->shame;
     $users = $shame->follows;
     foreach ($users as $user) {
         $notification = new Notification();
         $notification->type = "Shame";
         $notification->is_read = false;
         $notification->user_id = $user->id;
         $notification->shame_id = $shame->id;
         $notification->save();
     }
 }
开发者ID:Clazance,项目名称:developer-shame,代码行数:19,代码来源:SendShameNotification.php

示例12: store

 public function store($type, $to_follow_uuid, $user, $obj_id, $body = 'follow')
 {
     $notification = new Notification();
     //type 1 is cate
     //type 2 is follow
     //type 3 is reply
     //type 4 is upvote
     $notification->type = $type;
     $notification->recipient = $to_follow_uuid;
     $notification->sender = $user;
     $notification->body = $body;
     $notification->obj_id = $obj_id;
     $notification->save();
 }
开发者ID:ktardthong,项目名称:qanya,代码行数:14,代码来源:Notification.php

示例13: handle

 /**
  * Handle the event.
  *
  * @param  CommentWasAdded  $event
  * @return void
  */
 public function handle(CommentWasAdded $event)
 {
     $comment = $event->comment;
     $shame = $comment->shame;
     $users = $shame->follows;
     foreach ($users as $user) {
         $notification = new Notification();
         $notification->type = "Comment";
         $notification->is_read = false;
         $notification->user_id = $user->id;
         $notification->shame_id = $shame->id;
         $notification->comment_id = $comment->id;
         $notification->save();
     }
 }
开发者ID:Clazance,项目名称:developer-shame,代码行数:21,代码来源:SendCommentNotification.php

示例14: saveNotification

 public function saveNotification($data)
 {
     $notify = new Notification();
     $notification_responce_time = '30';
     $time = date('Y-m-d H:i:s');
     $newtime = strtotime("{$time} + {$notification_responce_time} seconds");
     $expire = date('Y-m-d H:i:s', $newtime);
     $notify->sender_id = $data['sender_id'];
     $notify->reciver_id = $data['reciver_id'];
     $notify->message = $data['message'];
     $notify->type = $data['type'];
     $notify->expired_at = $expire;
     $notify->save();
     return $notify;
 }
开发者ID:abhiyadav001,项目名称:Lion,代码行数:15,代码来源:Notification.php

示例15: processRequest

 public function processRequest($userId, $eventId, $permit)
 {
     if ($permit == 0) {
         $status = 'declined';
         \DB::table('event_user')->where('event_id', '=', $eventId)->where('user_id', '=', $userId)->delete();
     } elseif ($permit == 1) {
         $status = 'approved';
         \DB::table('event_user')->where('event_id', $eventId)->where('user_id', $userId)->update(array('status' => $status));
         $notification = new Notification();
         $notification->user_id = $userId;
         $notification->text = 'You have been accepted for ';
         $notification->object_id = $eventId;
         $notification->save();
     }
     return redirect('/events/' . $eventId);
 }
开发者ID:RuseHackV2,项目名称:MeetUpr,代码行数:16,代码来源:RequestsController.php


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