Files
monica/app/Http/Middleware/CheckVersion.php
T
Régis Freyd 29197090a7 Restructure where models are stored (#1476)
The idea is to clean the repository a little bit by moving models into their respective folders.
2018-06-14 20:49:12 -04:00

35 lines
822 B
PHP

<?php
namespace App\Http\Middleware;
use Closure;
use App\Models\Instance\Instance;
class CheckVersion
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$instance = Instance::first();
if ($instance->latest_version == config('monica.app_version')) {
// The instance has been updated to the latest version. We reset
// the ping data.
$instance->current_version = $instance->latest_version;
$instance->latest_release_notes = null;
$instance->number_of_versions_since_current_version = null;
$instance->save();
}
return $next($request);
}
}