update laravel-nami
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
2a939e2f77
commit
09b2c4fc6f
|
@ -2,11 +2,9 @@
|
|||
|
||||
namespace App\Member;
|
||||
|
||||
use App\Activity;
|
||||
use App\Actions\MemberPullAction;
|
||||
use App\Confession;
|
||||
use App\Group;
|
||||
use App\Setting\NamiSettings;
|
||||
use App\Subactivity;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
|
@ -67,22 +65,9 @@ class CreateJob implements ShouldQueue
|
|||
'first_activity_id' => $member->firstActivity->nami_id,
|
||||
'first_subactivity_id' => $member->firstSubactivity->nami_id,
|
||||
]);
|
||||
Member::withoutEvents(function () use ($response, $api, $member) {
|
||||
$version = $api->member($member->group->nami_id, $response['id'])['version'];
|
||||
$member->update(['version' => $version, 'nami_id' => $response['id']]);
|
||||
Member::withoutEvents(function () use ($response, $member, $api) {
|
||||
$member->update(['nami_id' => $response['id']]);
|
||||
app(MemberPullAction::class)->member($member->group->nami_id, $member->nami_id)->api($api)->execute();
|
||||
});
|
||||
|
||||
$memberships = $member->getNamiMemberships($api);
|
||||
foreach ($memberships as $membership) {
|
||||
$member->memberships()->create([
|
||||
'activity_id' => Activity::nami($membership['activity_id'])->id,
|
||||
'subactivity_id' => $membership['subactivity_id']
|
||||
? Subactivity::nami($membership['subactivity_id'])->id
|
||||
: null,
|
||||
'group_id' => Group::nami($membership['group_id'])->id,
|
||||
'nami_id' => $membership['id'],
|
||||
'created_at' => $membership['starts_at'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Zoomyboy\LaravelNami\Api;
|
||||
use Zoomyboy\LaravelNami\Data\MembershipEntry;
|
||||
|
||||
/**
|
||||
* @property string $subscription_name
|
||||
|
@ -100,9 +101,12 @@ class Member extends Model
|
|||
return null !== $this->nami_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, MembershipEntry>
|
||||
*/
|
||||
public function getNamiMemberships(Api $api): array
|
||||
{
|
||||
return $api->group($this->group->nami_id)->member($this->nami_id)->memberships()->toArray();
|
||||
return $api->group($this->group->nami_id)->member($this->nami_id)->memberships();
|
||||
}
|
||||
|
||||
public function getNamiFeeId(): ?int
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 5f667686d0643473c0674b74cafda9154e8e84f7
|
||||
Subproject commit 3515387570e3b34dbe7239961bd93a0ced5b1175
|
Loading…
Reference in New Issue