Skip to content

Commit

Permalink
missing update permission added.
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Oct 5, 2020
1 parent b1d3f0b commit a1f7eb4
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
54 changes: 54 additions & 0 deletions app/Listeners/Update/V20/Version2024.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

namespace App\Listeners\Update\V20;

use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Traits\Permissions;
use Illuminate\Support\Facades\Artisan;

class Version2024 extends Listener
{
use Permissions;

const ALIAS = 'core';

const VERSION = '2.0.24';

/**
* Handle the event.
*
* @param $event
* @return void
*/
public function handle(Event $event)
{
if ($this->skipThisUpdate($event)) {
return;
}

$this->updateDatabase();

$this->updatePermissions();
}

public function updateDatabase()
{
Artisan::call('migrate', ['--force' => true]);
}

public function updatePermissions()
{
$this->attachPermissionsByRoleNames([
'admin' => [
'banking-transactions' => 'c,r,u,d',
'common-notifications' => 'c,r,u,d',
'common-uploads' => 'r,d',
],
'manager' => [
'banking-transactions' => 'c,r,u,d',
'common-notifications' => 'c,r,u,d',
],
]);
}
}
1 change: 1 addition & 0 deletions app/Providers/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Event extends Provider
'App\Listeners\Update\V20\Version2017',
'App\Listeners\Update\V20\Version2020',
'App\Listeners\Update\V20\Version2023',
'App\Listeners\Update\V20\Version2024',
],
'Illuminate\Auth\Events\Login' => [
'App\Listeners\Auth\Login',
Expand Down

0 comments on commit a1f7eb4

Please sign in to comment.