adrema/app/Actions/PullMembershipsAction.php

29 lines
571 B
PHP
Raw Normal View History

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