/** * 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]); } }
public function run() { $notification_types = [["name" => "like"], ["name" => "follow"], ["name" => "comment"], ["name" => "ownership"]]; NotificationType::truncate(); foreach ($notification_types as $notification_type) { NotificationType::create($notification_type); } }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('notification_types')->delete(); $data = [['type' => 'text']]; foreach ($data as $value) { NotificationType::create($value); } }
/** * 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'); }