Exemplo n.º 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]);
     }
 }
Exemplo n.º 2
0
 /**
  * Update targeted users group for given $notificationId.
  *
  * @param string $group
  * @param int $notificationId
  */
 private static function _updateTargetGroup($group, $notificationId)
 {
     Notification::where('id', $notificationId)->update(['targeted_user_id' => TargetedUser::where('name', $group)->first()->id]);
 }
Exemplo n.º 3
0
 /**
  * Return targeted users.
  *
  * @param GetTargetedUsersRequest $request
  * @param AjaxResponse $response
  * @return mixed
  */
 public function getTargetedUsers(GetTargetedUsersRequest $request, AjaxResponse $response)
 {
     $targetedUsers = TargetedUser::all();
     $response->setSuccessMessage(trans('notifications.targeted_users_returned'));
     $response->addExtraFields(['targeted_users' => $targetedUsers, 'number_of_targeted_users' => count($targetedUsers)]);
     return response($response->get())->header('Content-Type', 'application/json');
 }