示例#1
0
 /**
  * Seed table.
  */
 public function run()
 {
     $types = \App\NotificationType::all();
     foreach ($types as $type) {
         factory(\App\Notification::class)->create(['notification_type_id' => $type->id, 'targeted_user_id' => \App\TargetedUser::where('key', 'none')->first()->id]);
     }
 }
示例#2
0
 /**
  * Return notification types.
  *
  * @param GetNotificationTypesRequest $request
  * @return mixed
  */
 public function types(GetNotificationTypesRequest $request)
 {
     $response = new AjaxResponse();
     $response->setSuccessMessage(trans('notifications.notification_types_returned'));
     $response->addExtraFields(['notification_types' => NotificationType::all()]);
     return response($response->get())->header('Content-Type', 'application/json');
 }