2022-01-02 12:32:57 +01:00
|
|
|
<?php
|
2020-04-12 00:26:44 +02:00
|
|
|
|
|
|
|
namespace App\Initialize;
|
|
|
|
|
2022-09-02 00:45:39 +02:00
|
|
|
use DB;
|
2022-02-12 16:16:56 +01:00
|
|
|
use Zoomyboy\LaravelNami\Api;
|
2021-11-17 23:58:28 +01:00
|
|
|
|
2022-03-11 20:19:17 +01:00
|
|
|
class InitializeActivities
|
|
|
|
{
|
2022-02-12 16:16:56 +01:00
|
|
|
private Api $api;
|
2021-11-11 23:46:56 +01:00
|
|
|
|
2022-03-11 20:19:17 +01:00
|
|
|
public function __construct(Api $api)
|
|
|
|
{
|
2020-04-12 00:26:44 +02:00
|
|
|
$this->api = $api;
|
|
|
|
}
|
|
|
|
|
2022-02-19 18:06:07 +01:00
|
|
|
public function handle(): void
|
2022-02-12 16:16:56 +01:00
|
|
|
{
|
2022-02-19 18:06:07 +01:00
|
|
|
$groupId = $this->api->groups()->first()->id;
|
|
|
|
app(ActivityCreator::class)->createFor($this->api, $groupId);
|
2020-04-12 00:26:44 +02:00
|
|
|
}
|
2022-09-02 00:45:39 +02:00
|
|
|
|
|
|
|
public function restore(): void
|
|
|
|
{
|
|
|
|
DB::table('activity_subactivity')->delete();
|
|
|
|
DB::table('activities')->delete();
|
|
|
|
DB::table('subactivities')->delete();
|
|
|
|
}
|
2020-04-12 00:26:44 +02:00
|
|
|
}
|