diff --git a/app/Console/Commands/ChargeCreditsCommand.php b/app/Console/Commands/ChargeCreditsCommand.php index e51bfdf9..145943c7 100644 --- a/app/Console/Commands/ChargeCreditsCommand.php +++ b/app/Console/Commands/ChargeCreditsCommand.php @@ -67,7 +67,7 @@ class ChargeCreditsCommand extends Command $server->suspend(); //add user to notify list - if (! in_array($user, $this->usersToNotify)) { + if (!in_array($user, $this->usersToNotify)) { array_push($this->usersToNotify, $user); } } catch (\Exception $exception) { @@ -85,7 +85,7 @@ class ChargeCreditsCommand extends Command */ public function notifyUsers() { - if (! empty($this->usersToNotify)) { + if (!empty($this->usersToNotify)) { /** @var User $user */ foreach ($this->usersToNotify as $user) { $this->line("Notified user: {$user->name}"); diff --git a/app/Console/Commands/CleanupOpenPayments.php b/app/Console/Commands/CleanupOpenPayments.php new file mode 100644 index 00000000..31510b6a --- /dev/null +++ b/app/Console/Commands/CleanupOpenPayments.php @@ -0,0 +1,42 @@ +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; + } +} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 5f081211..28d1d36a 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -18,10 +18,11 @@ class Kernel extends ConsoleKernel { $schedule->command('credits:charge')->hourly(); $schedule->command('cp:versioncheck:get')->daily(); + $schedule->command('payments:open:clear')->daily(); //log cronjob activity $schedule->call(function () { - Storage::disk('logs')->put('cron.log', 'Last activity from cronjobs - '.now()); + Storage::disk('logs')->put('cron.log', 'Last activity from cronjobs - ' . now()); })->everyMinute(); } @@ -32,7 +33,7 @@ class Kernel extends ConsoleKernel */ protected function commands() { - $this->load(__DIR__.'/Commands'); + $this->load(__DIR__ . '/Commands'); require base_path('routes/console.php'); } diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 23b41bb0..5a511758 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -111,7 +111,7 @@ class HomeController extends Controller return view('home')->with([ 'usage' => $usage, '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, 'boxText' => $boxText, 'unit' => $unit, diff --git a/app/Models/Payment.php b/app/Models/Payment.php index 04c32831..79352327 100644 --- a/app/Models/Payment.php +++ b/app/Models/Payment.php @@ -13,6 +13,7 @@ class Payment extends Model use HasFactory; public $incrementing = false; + protected $primaryKey = 'id'; /** * @var string[] diff --git a/themes/default/views/admin/usefullinks/create.blade.php b/themes/default/views/admin/usefullinks/create.blade.php index b7174657..2c09571a 100644 --- a/themes/default/views/admin/usefullinks/create.blade.php +++ b/themes/default/views/admin/usefullinks/create.blade.php @@ -95,6 +95,7 @@
+ @foreach ($positions as $position) diff --git a/themes/default/views/home.blade.php b/themes/default/views/home.blade.php index 76c4e8e5..720e39aa 100644 --- a/themes/default/views/home.blade.php +++ b/themes/default/views/home.blade.php @@ -133,7 +133,7 @@
- @foreach ($useful_links as $useful_link) + @foreach ($useful_links_dashboard as $useful_link)