Add last_remembered_at date to new payments
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
753c115b34
commit
42ac6ee7a1
|
@ -58,6 +58,13 @@ class Member extends Model
|
||||||
$this->update(['version' => $version]);
|
$this->update(['version' => $version]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function createPayment(array $attributes): void
|
||||||
|
{
|
||||||
|
$this->payments()->create(array_merge($attributes, [
|
||||||
|
'last_remembered_at' => now(),
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------- Getters -----------------------------------
|
//----------------------------------- Getters -----------------------------------
|
||||||
public function getFullnameAttribute(): string {
|
public function getFullnameAttribute(): string {
|
||||||
return $this->firstname.' '.$this->lastname;
|
return $this->firstname.' '.$this->lastname;
|
||||||
|
|
|
@ -23,7 +23,7 @@ class AllpaymentController extends Controller
|
||||||
]);
|
]);
|
||||||
|
|
||||||
foreach (Member::payable()->whereNoPayment($request->year)->get() as $member) {
|
foreach (Member::payable()->whereNoPayment($request->year)->get() as $member) {
|
||||||
$member->payments()->create([
|
$member->createPayment([
|
||||||
'nr' => $request->year,
|
'nr' => $request->year,
|
||||||
'subscription_id' => $member->subscription_id,
|
'subscription_id' => $member->subscription_id,
|
||||||
'status_id' => Status::default(),
|
'status_id' => Status::default(),
|
||||||
|
|
|
@ -21,7 +21,7 @@ class PaymentController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(Request $request, Member $member) {
|
public function store(Request $request, Member $member) {
|
||||||
$member->payments()->create($request->validate([
|
$member->createPayment($request->validate([
|
||||||
'nr' => 'required|numeric',
|
'nr' => 'required|numeric',
|
||||||
'subscription_id' => 'required|exists:subscriptions,id',
|
'subscription_id' => 'required|exists:subscriptions,id',
|
||||||
'status_id' => 'required|exists:statuses,id',
|
'status_id' => 'required|exists:statuses,id',
|
||||||
|
|
Loading…
Reference in New Issue