@@ -8,7 +8,7 @@ |
||
| 8 | 8 | { |
| 9 | 9 | public $table = 'users'; |
| 10 | 10 | |
| 11 | - function init(){ |
|
| 11 | + function init() { |
|
| 12 | 12 | parent::init(); |
| 13 | 13 | |
| 14 | 14 | $this->addFields(['name']); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | protected function showEditPermissions() |
| 37 | 37 | { |
| 38 | - $permissionsData = Permission::all(['id', 'name'])->map(function($permission){ |
|
| 38 | + $permissionsData = Permission::all(['id', 'name'])->map(function($permission) { |
|
| 39 | 39 | $permission['name'] = trans(ucwords($permission['name'])); |
| 40 | 40 | |
| 41 | 41 | return $permission; |
@@ -99,19 +99,19 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | protected function columns() |
| 101 | 101 | { |
| 102 | - return $this->columns = $this->columns?: $this->add('Columns'); |
|
| 102 | + return $this->columns = $this->columns ?: $this->add('Columns'); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | protected function permissionId() |
| 106 | 106 | { |
| 107 | - return $this->app->stickyGet($this->columns()->name)?: $this->getModuleVariable('permission'); |
|
| 107 | + return $this->app->stickyGet($this->columns()->name) ?: $this->getModuleVariable('permission'); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | protected function reload($permissionExpression = null) |
| 111 | 111 | { |
| 112 | 112 | $columns = $this->columns(); |
| 113 | 113 | |
| 114 | - return $this->reload = $this->reload?: new jsReload($columns, [$columns->name => $permissionExpression?: '']); |
|
| 114 | + return $this->reload = $this->reload ?: new jsReload($columns, [$columns->name => $permissionExpression ?: '']); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | protected function getModel($array) |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | $this->setOrder('priority'); |
| 27 | 27 | |
| 28 | 28 | $this->addHook('beforeInsert', function($model, & $data) { |
| 29 | - $data['priority'] = $data['priority']?: $this->action('fx', ['max', 'priority'])->getOne() + 1; |
|
| 29 | + $data['priority'] = $data['priority'] ?: $this->action('fx', ['max', 'priority'])->getOne() + 1; |
|
| 30 | 30 | }); |
| 31 | 31 | |
| 32 | 32 | $this->getAction('edit')->enabled = function($model) { |
@@ -23,10 +23,10 @@ |
||
| 23 | 23 | { |
| 24 | 24 | // setup default home pages |
| 25 | 25 | Database\Models\HomePage::create()->import([ |
| 26 | - [ |
|
| 27 | - 'path' => 'view/dashboard', |
|
| 28 | - 'role' => 'Super Admin' |
|
| 29 | - ], |
|
| 26 | + [ |
|
| 27 | + 'path' => 'view/dashboard', |
|
| 28 | + 'role' => 'Super Admin' |
|
| 29 | + ], |
|
| 30 | 30 | [ |
| 31 | 31 | 'path' => 'view/dashboard', |
| 32 | 32 | 'role' => 'Employee' |
@@ -86,7 +86,9 @@ |
||
| 86 | 86 | */ |
| 87 | 87 | public static function getUserHomePage() |
| 88 | 88 | { |
| 89 | - if (! $user = Auth::user()) return; |
|
| 89 | + if (! $user = Auth::user()) { |
|
| 90 | + return; |
|
| 91 | + } |
|
| 90 | 92 | |
| 91 | 93 | return HomePage::create()->addCondition('role', $user->roles()->pluck('name')->toArray())->loadAny(); |
| 92 | 94 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | $this->grid->setModel(HomePage::create()); |
| 44 | 44 | |
| 45 | - $this->grid->addDragHandler()->onReorder(function ($order) { |
|
| 45 | + $this->grid->addDragHandler()->onReorder(function($order) { |
|
| 46 | 46 | $result = true; |
| 47 | 47 | foreach (HomePage::create() as $homepage) { |
| 48 | 48 | $homepage['priority'] = array_search($homepage['id'], $order); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $result &= $homepage->save(); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - return $result? $this->notify(__('Homepages reordered!')): $this->notifyError(__('Error saving order!')); |
|
| 53 | + return $result ? $this->notify(__('Homepages reordered!')) : $this->notifyError(__('Error saving order!')); |
|
| 54 | 54 | }); |
| 55 | 55 | } |
| 56 | 56 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | static $cache; |
| 65 | 65 | |
| 66 | - if (! isset($cache)) { |
|
| 66 | + if (!isset($cache)) { |
|
| 67 | 67 | $cache = []; |
| 68 | 68 | foreach (HomePageJoint::collect() as $joint) { |
| 69 | 69 | $cache[$joint->link()] = $joint->caption(); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public static function getUserHomePage() |
| 82 | 82 | { |
| 83 | - if (! $user = Auth::user()) return; |
|
| 83 | + if (!$user = Auth::user()) return; |
|
| 84 | 84 | |
| 85 | 85 | return HomePage::create()->addCondition('role', $user->roles()->pluck('name')->toArray())->loadAny(); |
| 86 | 86 | } |
@@ -92,6 +92,6 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public static function getUserHomePagePath() |
| 94 | 94 | { |
| 95 | - return self::getUserHomePage()['path']?: self::$defaultPath; |
|
| 95 | + return self::getUserHomePage()['path'] ?: self::$defaultPath; |
|
| 96 | 96 | } |
| 97 | 97 | } |