adrema/app/Actions/PullCoursesAction.php

29 lines
555 B
PHP
Raw Permalink Normal View History

2023-02-07 02:45:15 +01:00
<?php
namespace App\Actions;
use App\Member\Member;
2023-02-12 23:18:58 +01:00
use App\Nami\Api\CoursesOfAction;
2023-02-07 02:45:15 +01:00
use App\Setting\NamiSettings;
use Lorisleiva\Actions\Concerns\AsAction;
use Zoomyboy\LaravelNami\Api;
class PullCoursesAction
{
use AsAction;
public function handle(Member $member): void
{
if (!$member->hasNami) {
return;
}
2023-02-12 23:18:58 +01:00
InsertCoursesAction::run($member, CoursesOfAction::run($this->api(), $member->nami_id));
2023-02-07 02:45:15 +01:00
}
private function api(): Api
{
return app(NamiSettings::class)->login();
}
}