improved updates
This commit is contained in:
31
app/Listeners/Updates/Listener.php
Normal file
31
app/Listeners/Updates/Listener.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\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 != self::ALIAS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Do not apply to the same or newer versions
|
||||
if ($event->old >= self::VERSION) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
33
app/Listeners/Updates/Version104.php
Normal file
33
app/Listeners/Updates/Version104.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\Updates;
|
||||
|
||||
//use App\Models\Auth\Permission;
|
||||
use App\Events\UpdateFinished;
|
||||
|
||||
class Version104 extends Listener
|
||||
{
|
||||
const ALIAS = 'core';
|
||||
|
||||
const VERSION = '1.0.4';
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(UpdateFinished $event)
|
||||
{
|
||||
// Check if should listen
|
||||
if (!$this->check($event)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*Permission::create([
|
||||
'name' => 'john-doe',
|
||||
'display_name' => 'John Doe',
|
||||
'description' => 'John Doe',
|
||||
]);*/
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user