2022-11-16 23:52:38 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Initialize;
|
|
|
|
|
2023-02-17 14:54:35 +01:00
|
|
|
use Illuminate\Support\Facades\DB;
|
2022-11-16 23:52:38 +01:00
|
|
|
use Zoomyboy\LaravelNami\Api;
|
|
|
|
|
|
|
|
class InitializeActivities
|
|
|
|
{
|
|
|
|
private Api $api;
|
|
|
|
|
|
|
|
public function __construct(Api $api)
|
|
|
|
{
|
|
|
|
$this->api = $api;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function handle(): void
|
|
|
|
{
|
2023-02-17 14:54:35 +01:00
|
|
|
app(ActivityCreator::class)->createFor($this->api, $this->api->groups()->first());
|
2022-11-16 23:52:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function restore(): void
|
|
|
|
{
|
|
|
|
DB::table('activity_subactivity')->delete();
|
|
|
|
DB::table('activities')->delete();
|
|
|
|
DB::table('subactivities')->delete();
|
|
|
|
}
|
|
|
|
}
|