Update Notification on Overview
This commit is contained in:
parent
540bb95291
commit
bfa24facf9
43
app/Console/Commands/GetGithubVersion.php
Normal file
43
app/Console/Commands/GetGithubVersion.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class GetGithubVersion extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'cp:versioncheck:get';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Get the latest Version from Github';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
try{
|
||||
$latestVersion = Http::get('https://api.github.com/repos/controlpanel-gg/dashboard/tags')->json()[0]['name'];
|
||||
Storage::disk('local')->put('latestVersion', $latestVersion);
|
||||
} catch (Exception $e) {
|
||||
Storage::disk('local')->put('latestVersion', "unknown");
|
||||
Log::error($e);
|
||||
}
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
|
@ -17,6 +17,7 @@ class Kernel extends ConsoleKernel
|
|||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
$schedule->command('credits:charge')->hourly();
|
||||
$schedule->command('cp:versioncheck:get')->daily();
|
||||
|
||||
//log cronjob activity
|
||||
$schedule->call(function () {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<div class="col-sm-6">
|
||||
<h1>{{__('Admin Overview')}}</h1>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="{{route('home')}}">{{__('Dashboard')}}</a></li>
|
||||
|
@ -17,6 +18,14 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if(Storage::get('latestVersion') && config("app.version") < Storage::get('latestVersion'))
|
||||
<div class="alert alert-danger" role="alert">
|
||||
<b><i class="fas fa-shield-alt"></i> {{__("Version Outdated:")}}</b></br>
|
||||
{{__("You are running on")}} v{{config("app.version")}}-{{config("BRANCHNAME")}}.
|
||||
{{__("The latest Version is")}} v{{Storage::get('latestVersion')}}</br>
|
||||
<a href="https://controlpanel.gg/docs/Installation/updating">{{__("Consider updating now")}}</a>
|
||||
</div>
|
||||
@endif
|
||||
</section>
|
||||
<!-- END CONTENT HEADER -->
|
||||
|
||||
|
@ -171,7 +180,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
|
||||
@foreach($tickets as $ticket_id => $ticket)
|
||||
<tr>
|
||||
<td><a class="text-info" href="{{route('moderator.ticket.show', ['ticket_id' => $ticket_id])}}">#{{$ticket_id}} - {{$ticket->title}}</td>
|
||||
|
@ -180,7 +189,7 @@
|
|||
<td>{{$ticket->last_updated}}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
|
@ -323,7 +332,7 @@
|
|||
<hr style="width: 100%; height:1px; border-width:0; background-color:#6c757d; margin-top: -16px">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
|
|
Loading…
Reference in a new issue