@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | $form->addControl('language', [\atk4\ui\Form\Control\Dropdown::class, 'values' => $values, 'caption' => __('Select Language'), 'iconLeft' => 'globe'], ['required'=>true])->set($wizard->recall('language', 'en')); |
82 | 82 | |
83 | - $form->onSubmit(function ($form) use ($wizard) { |
|
83 | + $form->onSubmit(function($form) use ($wizard) { |
|
84 | 84 | $wizard->memorize('language', $form->model->get('language')); |
85 | 85 | |
86 | 86 | App::setLocale($form->model->get('language')); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $form->addControl('support', [\atk4\ui\Form\Control\Checkbox::class, 'caption' => __('I will not remove "Support -> About" credit page from the application menu.')], ['required'=>true]); |
113 | 113 | $form->addControl('store', [\atk4\ui\Form\Control\Checkbox::class, 'caption' => __('I will not remove or rename ":epesi Store" links from the application.', ['epesi' => config('epesi.ui.title')])], ['required'=>true]); |
114 | 114 | |
115 | - $form->onSubmit(function ($form) use ($wizard) { |
|
115 | + $form->onSubmit(function($form) use ($wizard) { |
|
116 | 116 | return $wizard->jsNext(); |
117 | 117 | }); |
118 | 118 | |
@@ -140,12 +140,12 @@ discard block |
||
140 | 140 | $form->addControl('create', [\atk4\ui\Form\Control\Checkbox::class, 'caption' => __('Create New Database')])->on('change', new \atk4\ui\JsExpression('if ($(event.target).is(":checked")) alert([])', [__('WARNING: Make sure you have CREATE access level to do this!')])); |
141 | 141 | |
142 | 142 | foreach ($wizard->recall('connection', []) as $name => $value) { |
143 | - if (! $field = $form->fields[$name]?? null) continue; |
|
143 | + if (!$field = $form->fields[$name] ?? null) continue; |
|
144 | 144 | |
145 | 145 | $field->set($value); |
146 | 146 | } |
147 | 147 | |
148 | - $form->onSubmit(function ($form) use ($wizard) { |
|
148 | + $form->onSubmit(function($form) use ($wizard) { |
|
149 | 149 | $connection = $form->model->get(); |
150 | 150 | |
151 | 151 | $wizard->memorize('connection', $connection); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | |
194 | 194 | $form->model->setMulti($wizard->recall('user', [])); |
195 | 195 | |
196 | - $form->validate(function ($form) use ($wizard) { |
|
196 | + $form->validate(function($form) use ($wizard) { |
|
197 | 197 | $wizard->memorize('user', $form->model->get()); |
198 | 198 | |
199 | 199 | return $wizard->jsNext(); |
@@ -140,7 +140,9 @@ |
||
140 | 140 | $form->addControl('create', [\atk4\ui\Form\Control\Checkbox::class, 'caption' => __('Create New Database')])->on('change', new \atk4\ui\JsExpression('if ($(event.target).is(":checked")) alert([])', [__('WARNING: Make sure you have CREATE access level to do this!')])); |
141 | 141 | |
142 | 142 | foreach ($wizard->recall('connection', []) as $name => $value) { |
143 | - if (! $field = $form->fields[$name]?? null) continue; |
|
143 | + if (! $field = $form->fields[$name]?? null) { |
|
144 | + continue; |
|
145 | + } |
|
144 | 146 | |
145 | 147 | $field->set($value); |
146 | 148 | } |
@@ -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?: Columns::addTo($this); |
|
102 | + return $this->columns = $this->columns ?: Columns::addTo($this); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | protected function permissionId() |
106 | 106 | { |
107 | - return $this->getApp()->stickyGet($this->columns()->name)?: $this->getModuleVariable('permission'); |
|
107 | + return $this->getApp()->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 \atk4\ui\JsReload($columns, [$columns->name => $permissionExpression?: '']); |
|
114 | + return $this->reload = $this->reload ?: new \atk4\ui\JsReload($columns, [$columns->name => $permissionExpression ?: '']); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | protected function getModel($array) |
@@ -21,14 +21,14 @@ |
||
21 | 21 | |
22 | 22 | public function install() |
23 | 23 | { |
24 | - Model\HomePage::migrate(); |
|
24 | + Model\HomePage::migrate(); |
|
25 | 25 | |
26 | 26 | // setup default home pages |
27 | 27 | Model\HomePage::create()->import([ |
28 | - [ |
|
29 | - 'path' => 'view/dashboard', |
|
30 | - 'role' => 'Super Admin' |
|
31 | - ], |
|
28 | + [ |
|
29 | + 'path' => 'view/dashboard', |
|
30 | + 'role' => 'Super Admin' |
|
31 | + ], |
|
32 | 32 | [ |
33 | 33 | 'path' => 'view/dashboard', |
34 | 34 | 'role' => 'Employee' |
@@ -23,7 +23,7 @@ |
||
23 | 23 | |
24 | 24 | $grid = $this->add([ |
25 | 25 | Crud::class, |
26 | - 'menu' => ActionBar::instance(), |
|
26 | + 'menu' => ActionBar::instance(), |
|
27 | 27 | // 'model' => HomePage::create(), |
28 | 28 | 'displayFields' => ['path', 'role'], |
29 | 29 | 'editFields' => ['path', 'role'], |
@@ -50,7 +50,7 @@ |
||
50 | 50 | |
51 | 51 | // $plugin->extendList('path'); |
52 | 52 | |
53 | - $grid->addDragHandler()->onReorder(function ($order) { |
|
53 | + $grid->addDragHandler()->onReorder(function($order) { |
|
54 | 54 | foreach (Model\HomePage::create() as $homepage) { |
55 | 55 | $homepage->save(['priority' => array_search($homepage['id'], $order)]); |
56 | 56 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | class HomePage extends Model |
13 | 13 | { |
14 | - use HasEpesiConnection; |
|
14 | + use HasEpesiConnection; |
|
15 | 15 | |
16 | 16 | public $table = 'home_pages'; |
17 | 17 | |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | parent::init(); |
32 | 32 | |
33 | 33 | $this->addFields([ |
34 | - 'path' => [ |
|
34 | + 'path' => [ |
|
35 | 35 | 'caption' => __('Page'), |
36 | 36 | 'values' => self::list(), |
37 | 37 | 'ui' => [ |
@@ -41,23 +41,23 @@ discard block |
||
41 | 41 | 'filter' => true |
42 | 42 | ], |
43 | 43 | ], |
44 | - 'role' => [ |
|
44 | + 'role' => [ |
|
45 | 45 | 'caption' => __('Role'), |
46 | 46 | 'values' => Role::get()->pluck('name', 'name')->all(), |
47 | 47 | 'ui' => [ |
48 | 48 | 'filter' => true |
49 | 49 | ] |
50 | 50 | ], |
51 | - 'date' => [ |
|
51 | + 'date' => [ |
|
52 | 52 | 'type' => 'date', |
53 | 53 | 'caption' => __('Date'), |
54 | - 'never_persist' => true, |
|
54 | + 'never_persist' => true, |
|
55 | 55 | 'ui' => [ |
56 | 56 | 'filter' => true |
57 | 57 | ] |
58 | 58 | ], |
59 | 59 | 'priority' => [ |
60 | - 'default' => 0 |
|
60 | + 'default' => 0 |
|
61 | 61 | ], |
62 | 62 | ]); |
63 | 63 |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $this->setOrder('priority'); |
66 | 66 | |
67 | 67 | $this->onHook(\atk4\data\Model::HOOK_BEFORE_INSERT, function($model, & $data) { |
68 | - $data['priority'] = $data['priority']?: $this->action('fx', ['max', 'priority'])->getOne() + 1; |
|
68 | + $data['priority'] = $data['priority'] ?: $this->action('fx', ['max', 'priority'])->getOne() + 1; |
|
69 | 69 | }); |
70 | 70 | } |
71 | 71 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | { |
79 | 79 | static $cache; |
80 | 80 | |
81 | - if (! isset($cache)) { |
|
81 | + if (!isset($cache)) { |
|
82 | 82 | $cache = []; |
83 | 83 | foreach (HomePageJoint::collect() as $joint) { |
84 | 84 | $cache[$joint->link()] = $joint->caption(); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public static function ofUser() |
97 | 97 | { |
98 | - if (! $user = Auth::user()) return; |
|
98 | + if (!$user = Auth::user()) return; |
|
99 | 99 | |
100 | 100 | return self::create()->addCondition('role', $user->roles()->pluck('name')->toArray())->loadAny(); |
101 | 101 | } |
@@ -94,7 +94,9 @@ |
||
94 | 94 | */ |
95 | 95 | public static function ofUser() |
96 | 96 | { |
97 | - if (! $user = Auth::user()) return; |
|
97 | + if (! $user = Auth::user()) { |
|
98 | + return; |
|
99 | + } |
|
98 | 100 | |
99 | 101 | return self::create()->addCondition('role', $user->roles()->pluck('name')->toArray())->loadAny(); |
100 | 102 | } |
@@ -24,11 +24,11 @@ |
||
24 | 24 | |
25 | 25 | public function migrate() |
26 | 26 | { |
27 | - Model\Module::migrate(); |
|
27 | + Model\Module::migrate(); |
|
28 | 28 | |
29 | - Model\Variable::migrate(); |
|
29 | + Model\Variable::migrate(); |
|
30 | 30 | |
31 | - return parent::migrate(); |
|
31 | + return parent::migrate(); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | class Variable extends Model |
10 | 10 | { |
11 | - use HasEpesiConnection; |
|
11 | + use HasEpesiConnection; |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @var Collection |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | |
28 | 28 | protected function init(): void |
29 | 29 | { |
30 | - parent::init(); |
|
30 | + parent::init(); |
|
31 | 31 | |
32 | - $this->addFields([ |
|
33 | - 'name', |
|
34 | - 'value' => ['type' => 'text', 'serialize' => 'json'] |
|
35 | - ]); |
|
32 | + $this->addFields([ |
|
33 | + 'name', |
|
34 | + 'value' => ['type' => 'text', 'serialize' => 'json'] |
|
35 | + ]); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | public static function recall($name, $default = null) { |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | $variable = self::create()->addCondition('name', $name)->tryLoadAny(); |
58 | 58 | |
59 | 59 | if ($variable->loaded()) { |
60 | - $variable->save(compact('value')); |
|
60 | + $variable->save(compact('value')); |
|
61 | 61 | } |
62 | 62 | else { |
63 | - $variable->insert(compact('name', 'value')); |
|
63 | + $variable->insert(compact('name', 'value')); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | public $strict_types = false; |
21 | 21 | |
22 | 22 | private static function cache() { |
23 | - if(isset(self::$variables)) return; |
|
23 | + if (isset(self::$variables)) return; |
|
24 | 24 | |
25 | 25 | self::$variables = self::pluck('value', 'name'); |
26 | 26 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | - public static function forget($name, $throwError=true) { |
|
67 | + public static function forget($name, $throwError = true) { |
|
68 | 68 | self::cache(); |
69 | 69 | |
70 | 70 | if (!self::$variables->has($name) && $throwError) { |
@@ -20,7 +20,9 @@ discard block |
||
20 | 20 | public $strict_types = false; |
21 | 21 | |
22 | 22 | private static function cache() { |
23 | - if(isset(self::$variables)) return; |
|
23 | + if(isset(self::$variables)) { |
|
24 | + return; |
|
25 | + } |
|
24 | 26 | |
25 | 27 | self::$variables = self::pluck('value', 'name'); |
26 | 28 | } |
@@ -38,7 +40,9 @@ discard block |
||
38 | 40 | public static function recall($name, $default = null) { |
39 | 41 | self::cache(); |
40 | 42 | |
41 | - if (!self::$variables->has($name)) return $default; |
|
43 | + if (!self::$variables->has($name)) { |
|
44 | + return $default; |
|
45 | + } |
|
42 | 46 | |
43 | 47 | return self::$variables->get($name, $default) ?? $default; |
44 | 48 | } |
@@ -58,8 +62,7 @@ discard block |
||
58 | 62 | |
59 | 63 | if ($variable->loaded()) { |
60 | 64 | $variable->save(compact('value')); |
61 | - } |
|
62 | - else { |
|
65 | + } else { |
|
63 | 66 | $variable->insert(compact('name', 'value')); |
64 | 67 | } |
65 | 68 | } |
@@ -7,19 +7,19 @@ |
||
7 | 7 | |
8 | 8 | class Module extends Model |
9 | 9 | { |
10 | - use HasEpesiConnection; |
|
10 | + use HasEpesiConnection; |
|
11 | 11 | |
12 | - public $table = 'modules'; |
|
12 | + public $table = 'modules'; |
|
13 | 13 | |
14 | - protected function init(): void |
|
15 | - { |
|
16 | - parent::init(); |
|
14 | + protected function init(): void |
|
15 | + { |
|
16 | + parent::init(); |
|
17 | 17 | |
18 | - $this->addFields([ |
|
19 | - 'class', |
|
20 | - 'alias', |
|
21 | - 'priority' => ['default' => 0], |
|
22 | - 'state' => ['default' => 1] |
|
23 | - ]); |
|
24 | - } |
|
18 | + $this->addFields([ |
|
19 | + 'class', |
|
20 | + 'alias', |
|
21 | + 'priority' => ['default' => 0], |
|
22 | + 'state' => ['default' => 1] |
|
23 | + ]); |
|
24 | + } |
|
25 | 25 | } |
@@ -7,18 +7,18 @@ |
||
7 | 7 | |
8 | 8 | class SQL extends \atk4\data\Persistence\Sql |
9 | 9 | { |
10 | - /** |
|
11 | - * Take a laravel connection and pass it to ATK Data |
|
12 | - * |
|
13 | - * @return \atk4\data\Persistence\SQL |
|
14 | - */ |
|
15 | - public function __construct(DatabaseManager $database) |
|
16 | - { |
|
17 | - $pdo = $database->connection()->getPdo(); |
|
10 | + /** |
|
11 | + * Take a laravel connection and pass it to ATK Data |
|
12 | + * |
|
13 | + * @return \atk4\data\Persistence\SQL |
|
14 | + */ |
|
15 | + public function __construct(DatabaseManager $database) |
|
16 | + { |
|
17 | + $pdo = $database->connection()->getPdo(); |
|
18 | 18 | |
19 | - // temporary fix of atk4/data inability to handle PREPARE on 'is null' |
|
20 | - $pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, true); |
|
19 | + // temporary fix of atk4/data inability to handle PREPARE on 'is null' |
|
20 | + $pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, true); |
|
21 | 21 | |
22 | - parent::__construct(Connection::connect($pdo)); |
|
23 | - } |
|
22 | + parent::__construct(Connection::connect($pdo)); |
|
23 | + } |
|
24 | 24 | } |