add auto update feature

This commit is contained in:
jayvirsinh_gohil
2019-11-12 18:44:49 +05:30
parent 81f34b8912
commit 1b28b082d2
8 changed files with 254 additions and 2 deletions

View File

@ -0,0 +1,31 @@
<?php
namespace Laraspace\Listeners\Updates;
class Listener
{
const ALIAS = '';
const VERSION = '';
/**
* Check if should listen.
*
* @param $event
* @return boolean
*/
protected function check($event)
{
// Apply only to the specified alias
if ($event->alias != static::ALIAS) {
return false;
}
// Do not apply to the same or newer versions
if (version_compare($event->old, static::VERSION, '>=')) {
return false;
}
return true;
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace Laraspace\Listeners\Updates\V10;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Laraspace\Listeners\Updates\Listener;
use Laraspace\Events\UpdateFinished;
class Version101 extends Listener
{
const ALIAS = 'core';
const VERSION = '1.0.1';
/**
* Handle the event.
*
* @param object $event
* @return void
*/
public function handle(UpdateFinished $event)
{
if (!$this->check($event)) {
return;
}
}
}