Add last_remembered_at date to new payments
continuous-integration/drone/push Build is passing Details

This commit is contained in:
philipp lang 2021-10-30 00:50:03 +02:00
parent 753c115b34
commit 42ac6ee7a1
3 changed files with 9 additions and 2 deletions

View File

@ -58,6 +58,13 @@ class Member extends Model
$this->update(['version' => $version]);
}
public function createPayment(array $attributes): void
{
$this->payments()->create(array_merge($attributes, [
'last_remembered_at' => now(),
]));
}
//----------------------------------- Getters -----------------------------------
public function getFullnameAttribute(): string {
return $this->firstname.' '.$this->lastname;

View File

@ -23,7 +23,7 @@ class AllpaymentController extends Controller
]);
foreach (Member::payable()->whereNoPayment($request->year)->get() as $member) {
$member->payments()->create([
$member->createPayment([
'nr' => $request->year,
'subscription_id' => $member->subscription_id,
'status_id' => Status::default(),

View File

@ -21,7 +21,7 @@ class PaymentController extends Controller
}
public function store(Request $request, Member $member) {
$member->payments()->create($request->validate([
$member->createPayment($request->validate([
'nr' => 'required|numeric',
'subscription_id' => 'required|exists:subscriptions,id',
'status_id' => 'required|exists:statuses,id',