adrema/app/Console/Commands/MemberResyncCommand.php

42 lines
875 B
PHP
Raw Normal View History

2022-05-26 01:29:19 +02:00
<?php
namespace App\Console\Commands;
2023-02-06 00:24:57 +01:00
use App\Actions\PullMemberAction;
2022-05-26 01:29:19 +02:00
use App\Setting\NamiSettings;
use Illuminate\Console\Command;
use Zoomyboy\LaravelNami\Member as NamiMember;
class MemberResyncCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'member:resync';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Execute the console command.
*
* @return int
*/
public function handle(NamiSettings $settings)
{
$api = $settings->login();
$api->search([])->each(
2023-02-06 00:24:57 +01:00
fn (NamiMember $member) => app(PullMemberAction::class)->api($api)->member($member->group_id, $member->id)->execute()
2022-05-26 01:29:19 +02:00
);
return 0;
}
}