Merge branch 'ControlPanel-gg:development' into development
This commit is contained in:
commit
3522dfe4c7
42
app/Console/Commands/CleanupOpenPayments.php
Normal file
42
app/Console/Commands/CleanupOpenPayments.php
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Models\Payment;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
|
class CleanupPayments extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'payments:open:clear';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Clears all payments from the database that have state "open"';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
// delete all payments that have state "open" and are older than 1 hour
|
||||||
|
try {
|
||||||
|
Payment::where('status', 'open')->where('updated_at', '<', now()->subHour())->delete();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$this->error('Could not delete payments: ' . $e->getMessage());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->info('Successfully deleted all open payments');
|
||||||
|
return Command::SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,6 +18,7 @@ class Kernel extends ConsoleKernel
|
||||||
{
|
{
|
||||||
$schedule->command('credits:charge')->hourly();
|
$schedule->command('credits:charge')->hourly();
|
||||||
$schedule->command('cp:versioncheck:get')->daily();
|
$schedule->command('cp:versioncheck:get')->daily();
|
||||||
|
$schedule->command('payments:open:clear')->daily();
|
||||||
|
|
||||||
//log cronjob activity
|
//log cronjob activity
|
||||||
$schedule->call(function () {
|
$schedule->call(function () {
|
||||||
|
|
|
@ -111,7 +111,7 @@ class HomeController extends Controller
|
||||||
return view('home')->with([
|
return view('home')->with([
|
||||||
'usage' => $usage,
|
'usage' => $usage,
|
||||||
'credits' => $credits,
|
'credits' => $credits,
|
||||||
'useful_links' => UsefulLink::where("position","like","%dashboard%")->get()->sortby("id"),
|
'useful_links_dashboard' => UsefulLink::where("position","like","%dashboard%")->get()->sortby("id"),
|
||||||
'bg' => $bg,
|
'bg' => $bg,
|
||||||
'boxText' => $boxText,
|
'boxText' => $boxText,
|
||||||
'unit' => $unit,
|
'unit' => $unit,
|
||||||
|
|
|
@ -13,6 +13,7 @@ class Payment extends Model
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
public $incrementing = false;
|
public $incrementing = false;
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string[]
|
* @var string[]
|
||||||
|
|
|
@ -95,6 +95,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
<label for="position">{{__('Position')}}</label>
|
||||||
<select id="position" style="width:100%" class="custom-select" name="position[]"
|
<select id="position" style="width:100%" class="custom-select" name="position[]"
|
||||||
required multiple autocomplete="off" @error('position') is-invalid @enderror>
|
required multiple autocomplete="off" @error('position') is-invalid @enderror>
|
||||||
@foreach ($positions as $position)
|
@foreach ($positions as $position)
|
||||||
|
|
|
@ -96,6 +96,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
<label for="position">{{__('Position')}}</label>
|
||||||
<select id="position" style="width:100%" class="custom-select" name="position[]"
|
<select id="position" style="width:100%" class="custom-select" name="position[]"
|
||||||
required multiple autocomplete="off" @error('position') is-invalid @enderror>
|
required multiple autocomplete="off" @error('position') is-invalid @enderror>
|
||||||
@foreach ($positions as $position)
|
@foreach ($positions as $position)
|
||||||
|
|
|
@ -133,7 +133,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- /.card-header -->
|
<!-- /.card-header -->
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@foreach ($useful_links as $useful_link)
|
@foreach ($useful_links_dashboard as $useful_link)
|
||||||
<div class="alert alert-dismissible">
|
<div class="alert alert-dismissible">
|
||||||
<button type="button" class="close" data-dismiss="alert"
|
<button type="button" class="close" data-dismiss="alert"
|
||||||
aria-hidden="true">×</button>
|
aria-hidden="true">×</button>
|
||||||
|
|
Loading…
Reference in a new issue