adrema/app/Initialize/InitializeActivities.php

29 lines
565 B
PHP

<?php
namespace App\Initialize;
use Illuminate\Support\Facades\DB;
use Zoomyboy\LaravelNami\Api;
class InitializeActivities
{
private Api $api;
public function __construct(Api $api)
{
$this->api = $api;
}
public function handle(): void
{
app(ActivityCreator::class)->createFor($this->api, $this->api->groups()->first());
}
public function restore(): void
{
DB::table('activity_subactivity')->delete();
DB::table('activities')->delete();
DB::table('subactivities')->delete();
}
}