process mining payments

This commit is contained in:
2021-04-24 01:01:48 +09:00
parent c77b7e3821
commit d62b4b3790
4 changed files with 125 additions and 1 deletions

View File

@@ -0,0 +1,46 @@
<?php
namespace App\Http\Controllers\MoonRental;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Carbon\Carbon;
use Log;
class MoonRentalAdminController extends Controller
{
//Constructor
public function __construct() {
$this->middleware('role:Admin');
$this->middleware('permission:moon.rental.manager');
}
/**
* Display rental requests
*/
public function displayRentalRequests() {
}
/**
* Create monthly moon rental
*/
public function storeRentalRequest() {
}
/**
* Delete / remove monthly moon rental
*/
public function updateRentalRequest() {
}
/**
* Display current monthly moon rentals
*/
public function displayCurrentRentals() {
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace App\Http\Controllers\MoonRental;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Carbon\Carbon;
use Log;
class MoonRentalController extends Controller
{
//Constructor
public function __construct() {
$this->middleware('role:user');
}
/**
* Display all of the available moons for rental
*/
public function displayMoons() {
}
/**
* Display form to request new moon structure be placed
*/
public function displayNewMoonRequestForm() {
}
/**
* Display moon rental request form
*/
public function displayMoonRentalRequestForm() {
}
/**
* Store moon rental from the request form
*/
public function storeMoonRentalRequest() {
}
}

View File

@@ -58,7 +58,7 @@ class ProcessMiningTaxesPayments implements ShouldQueue
])->count();
//If we have received the invoice, then mark the invoice as paid
if($count > 0) {
if($found > 0) {
//If we have the count, then grab the journal entry in order to do some things with it
$journal = AllianceWalletJournal::where([
'reason' => "MMT: " . $invoice->invoice_id,
@@ -82,6 +82,36 @@ class ProcessMiningTaxesPayments implements ShouldQueue
'status' => 'Paid Late',
]);
}
} else {
$count = AllianceWalletJournal::where([
'reason' => $invoice->invoice_id,
])->count();
if($count > 0) {
//If we have the count, then grab the journal entry in order to do some things with it
$journal = AllianceWalletJournal::where([
'reason' => "MMT: " . $invoice->invoice_id,
])->orWhere([
'reason' => $invoice->invoice_id,
])->first();
//If the bill is paid on time, then update the invoice as such
if($currentTime->lessThanOrEqualTo($journal->inserted_at)) {
Invoice::where([
'invoice_id' => $invoice->invoice_id,
])->update([
'status' => 'Paid',
]);
}
if($currentTime->greaterThan($journal->inserted_at)) {
Invoice::where([
'invoice_id' => $invoice->invoice_id,
])->update([
'status' => 'Paid Late',
]);
}
}
}
}

View File

@@ -88,6 +88,10 @@ Route::group(['middleware' => ['auth']], function(){
Route::get('/miningtax/admin/display/paid', 'MiningTaxes\MiningTaxesAdminController@DisplayPaidInvoices');
Route::any('/miningtax/admin/display/unpaid/search', 'MiningTaxes\MiningTaxesAdminController@SearchUnpaidInvoice');
/**
* Moon Rental display pages
*/
/**
* Scopes Controller display pages
*/