added remove renter functionality to update moon

This commit is contained in:
2019-05-21 16:28:44 -05:00
parent 3826bcd8c8
commit e7bf9ec5e4
3 changed files with 21 additions and 4 deletions

View File

@@ -116,7 +116,6 @@ class MoonMailerCommand extends Command
if($today > $rental->Paid_Until)
$this->UpdateNotPaid($rental);
}
}
//Mark the job as finished

View File

@@ -82,8 +82,22 @@ class MoonsAdminController extends Controller
'Contact' => $contact,
])->first();
//If the entry is found, we are most likely just updating an entry to include new paid until data
if($found) {
if($found && $request->removal == true) {
MoonRental::where([
'System' => $request->system,
'Planet' => $request->planet,
'Moon' => $request->moon,
])->delete();
MoonRental::insert([
'System' => $request->system,
'Planet' => $request->planet,
'Moon' => $request->moon,
'Contact' => 'None',
'Paid' => 'No',
'Paid_Until' => Carbon::now()->endOfMonth(),
]);
} else if($found && $request->removal != true) {
if($allianceId = 99004116) {
MoonRental::where([
'System' => $request->system,
@@ -116,7 +130,7 @@ class MoonsAdminController extends Controller
'RentalEnd' => $date,
'Contact' => $contact,
'Price' => $price['outofalliance'],
'Type' => 'alliance',
'Type' => 'outofalliance',
'Paid' => $paid,
'Paid_Until' => $request->paid_until,
]);

View File

@@ -30,6 +30,10 @@
{{ Form::label('paid', 'Yes') }}
{{ Form::radio('paid', 'Yes') }}
</div>
<div class="form-group">
{{ Form::label('removal', 'Remove Renter') }}
{{ Form::checkbox('removal', true, false, ['class' => 'form-control']) }}
</div>
{{ Form::submit('Submit', ['class' => 'btn btn-primary']) }}
{!! Form::close() !!}
</div>