/** * 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]); } }
/** * 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]); }