moon rental form

This commit is contained in:
2021-07-10 22:05:05 -05:00
parent d49695e7e8
commit 0b0faf26d2
2 changed files with 8 additions and 5 deletions

View File

@@ -72,7 +72,6 @@ class MiningTaxesController extends Controller
public function storeMoonRentalForm(Request $request) { public function storeMoonRentalForm(Request $request) {
$this->validate($request, [ $this->validate($request, [
'moon_id' => 'required', 'moon_id' => 'required',
'moon_name' => 'required',
'rental_start' => 'required', 'rental_start' => 'required',
'rental_end' => 'required', 'rental_end' => 'required',
'entity_name' => 'required', 'entity_name' => 'required',
@@ -99,6 +98,11 @@ class MiningTaxesController extends Controller
//Create the uniqid for the billing cycle. //Create the uniqid for the billing cycle.
$invoiceId = "MR" . uniqid(); $invoiceId = "MR" . uniqid();
//Get the moon's information from the database so we know how much to make the bill for
$moon = AllianceMoon::where([
'moon_id' => $request->moon_id,
])->first();
//Update the data on the Alliance Moon //Update the data on the Alliance Moon
AllianceMoon::where([ AllianceMoon::where([
'moon_id' => $request->moon_id, 'moon_id' => $request->moon_id,
@@ -108,9 +112,9 @@ class MiningTaxesController extends Controller
//Insert a new moon rental into the database //Insert a new moon rental into the database
AllianceMoonRental::insert([ AllianceMoonRental::insert([
'moon_id' => $request->moon_id, 'moon_id' => $moon->moon_id,
'moon_name' => $request->moon_name, 'moon_name' => $moon->name,
'rental_amount' => $rentalAmount, 'rental_amount' => $moon->rental_amount,
'rental_start' => $request->rental_start, 'rental_start' => $request->rental_start,
'rental_end' => $request->rental_end, 'rental_end' => $request->rental_end,
'next_billing_date' => $nextBillingDate, 'next_billing_date' => $nextBillingDate,

View File

@@ -13,7 +13,6 @@
<div class="card-body"> <div class="card-body">
{!! Form::open(['action' => 'MiningTaxes\MiningTaxesController@storeMoonRentalForm', 'method' => 'POST']) !!} {!! Form::open(['action' => 'MiningTaxes\MiningTaxesController@storeMoonRentalForm', 'method' => 'POST']) !!}
{{ Form::hidden('moon_id', $moon->moon_id) }} {{ Form::hidden('moon_id', $moon->moon_id) }}
{{ Form::hidden('moon_name', $moon->name) }}
<div class="form-group"> <div class="form-group">
{{ Form::label('rental_start', 'Day of Rental Start') }} {{ Form::label('rental_start', 'Day of Rental Start') }}
{{ Form::date('rental_start', Carbon\Carbon::now(), ['class' => 'form-control']) }} {{ Form::date('rental_start', Carbon\Carbon::now(), ['class' => 'form-control']) }}