コード例 #1
0
 /**
  * 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');
 }