@@ -15,11 +15,11 @@ |
||
15 | 15 | |
16 | 16 | auth()->shouldUse($defaultGuard); |
17 | 17 | |
18 | - if(auth()->guest()){ |
|
18 | + if (auth()->guest()) { |
|
19 | 19 | return redirect($redirectPath); |
20 | 20 | } |
21 | 21 | |
22 | - if(!AuthFacade::check(auth()->user()->id)){ |
|
22 | + if (!AuthFacade::check(auth()->user()->id)) { |
|
23 | 23 | return redirect($redirectPath); |
24 | 24 | } |
25 | 25 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | { |
14 | 14 | $lang = session()->has('easypanel_lang') |
15 | 15 | ? session()->get('easypanel_lang') |
16 | - : (config('easy_panel.lang') ?? 'en') .'_panel'; |
|
16 | + : (config('easy_panel.lang') ?? 'en').'_panel'; |
|
17 | 17 | |
18 | 18 | App::setLocale($lang); |
19 | 19 |
@@ -61,19 +61,19 @@ discard block |
||
61 | 61 | { |
62 | 62 | $this->validate(); |
63 | 63 | |
64 | - if (!class_exists($this->model) or ! app()->make($this->model) instanceof Model){ |
|
64 | + if (!class_exists($this->model) or !app()->make($this->model) instanceof Model) { |
|
65 | 65 | $this->addError('model', __('Namespace is invalid')); |
66 | 66 | |
67 | 67 | return; |
68 | 68 | } |
69 | 69 | |
70 | - if (!preg_match('/^([a-z]|[0-9])+/', $this->route)){ |
|
70 | + if (!preg_match('/^([a-z]|[0-9])+/', $this->route)) { |
|
71 | 71 | $this->addError('route', __('Route is invalid')); |
72 | 72 | |
73 | 73 | return; |
74 | 74 | } |
75 | 75 | |
76 | - try{ |
|
76 | + try { |
|
77 | 77 | $name = $this->getModelName($this->model); |
78 | 78 | |
79 | 79 | CRUD::create([ |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | '--force' => true |
89 | 89 | ]); |
90 | 90 | |
91 | - $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CreatedMessage', ['name' => __('CRUD') ])]); |
|
92 | - } catch(\Exception $exception){ |
|
93 | - $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('UnknownError') ]); |
|
91 | + $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CreatedMessage', ['name' => __('CRUD')])]); |
|
92 | + } catch (\Exception $exception) { |
|
93 | + $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('UnknownError')]); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | |
@@ -101,10 +101,10 @@ discard block |
||
101 | 101 | public function render() |
102 | 102 | { |
103 | 103 | return view('admin::livewire.crud.create') |
104 | - ->layout('admin::layouts.app', ['title' => __('CreateTitle', ['name' => __('CRUD') ])]); |
|
104 | + ->layout('admin::layouts.app', ['title' => __('CreateTitle', ['name' => __('CRUD')])]); |
|
105 | 105 | } |
106 | 106 | |
107 | - private function getModelName($model){ |
|
107 | + private function getModelName($model) { |
|
108 | 108 | $model = explode('\\', $model); |
109 | 109 | |
110 | 110 | return end($model); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | foreach ($files as $file) { |
122 | 122 | |
123 | - if ($this->fileCanNotBeListed($file->getFilename(), $query)){ |
|
123 | + if ($this->fileCanNotBeListed($file->getFilename(), $query)) { |
|
124 | 124 | continue; |
125 | 125 | } |
126 | 126 |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | { |
43 | 43 | $this->validate(); |
44 | 44 | try { |
45 | - $lang = strtolower($this->language) . '_panel'; |
|
45 | + $lang = strtolower($this->language).'_panel'; |
|
46 | 46 | File::copy(LangManager::getPath('en_panel'), LangManager::getPath($lang)); |
47 | 47 | |
48 | - $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CreatedMessage', ['name' => __('Translation') ])]); |
|
49 | - } catch (\Exception $exception){ |
|
48 | + $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CreatedMessage', ['name' => __('Translation')])]); |
|
49 | + } catch (\Exception $exception) { |
|
50 | 50 | $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => $exception->getMessage()]); |
51 | 51 | } |
52 | 52 | |
@@ -57,6 +57,6 @@ discard block |
||
57 | 57 | { |
58 | 58 | LangManager::updateLanguage($this->selectedLang, $this->texts); |
59 | 59 | |
60 | - $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('UpdatedMessage', ['name' => __('Translation') ])]); |
|
60 | + $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('UpdatedMessage', ['name' => __('Translation')])]); |
|
61 | 61 | } |
62 | 62 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | public function addText($text, $key = null) |
14 | 14 | { |
15 | - if (array_key_exists($key, $this->texts)){ |
|
15 | + if (array_key_exists($key, $this->texts)) { |
|
16 | 16 | return; |
17 | 17 | } |
18 | 18 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | { |
12 | 12 | $files = collect(static::getFiles()); |
13 | 13 | |
14 | - return $files->mapWithKeys(function ($file, $key){ |
|
14 | + return $files->mapWithKeys(function($file, $key) { |
|
15 | 15 | preg_match('/(\w+)_panel\.json/i', $file, $m); |
16 | 16 | $key = "$m[1]_panel"; |
17 | 17 | $value = Str::upper($m[1]); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | foreach (static::getFiles() as $file) { |
25 | 25 | $decodedFile = json_decode(File::get($file), 1); |
26 | 26 | foreach ($texts as $key => $text) { |
27 | - if (array_key_exists($key, $decodedFile)){ |
|
27 | + if (array_key_exists($key, $decodedFile)) { |
|
28 | 28 | unset($texts[$text]); |
29 | 29 | } |
30 | 30 | } |
@@ -14,13 +14,13 @@ |
||
14 | 14 | |
15 | 15 | [$class, $method] = $array; |
16 | 16 | |
17 | - if (! class_exists($class)){ |
|
17 | + if (!class_exists($class)) { |
|
18 | 18 | throw new Exception("Class {$class} doesn't exist."); |
19 | 19 | } |
20 | 20 | |
21 | 21 | $method = $method ?: 'handle'; |
22 | 22 | |
23 | - if (! method_exists($class, $method)){ |
|
23 | + if (!method_exists($class, $method)) { |
|
24 | 24 | throw new Exception("Method {$method} doesn't exist on {$class} class."); |
25 | 25 | } |
26 | 26 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | { |
16 | 16 | $user = $this->argument('user'); |
17 | 17 | |
18 | - if($this->askResult($user)){ |
|
18 | + if ($this->askResult($user)) { |
|
19 | 19 | UserProviderFacade::deleteAdmin($user); |
20 | 20 | $this->info('Admin was removed successfully'); |
21 | 21 | return; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | public function askResult($user) |
28 | 28 | { |
29 | - if($this->option('force')) { |
|
29 | + if ($this->option('force')) { |
|
30 | 30 | return true; |
31 | 31 | } |
32 | 32 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | ]); |
25 | 25 | |
26 | 26 | $this->crud->delete(); |
27 | - $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('DeletedMessage', ['name' => __('CRUD') ] )]); |
|
27 | + $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('DeletedMessage', ['name' => __('CRUD')])]); |
|
28 | 28 | $this->emit('crudUpdated'); |
29 | 29 | } |
30 | 30 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | 'built' => true |
40 | 40 | ]); |
41 | 41 | |
42 | - $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CRUD Created successfully') ] ); |
|
42 | + $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CRUD Created successfully')]); |
|
43 | 43 | $this->emit('crudUpdated'); |
44 | 44 | } |
45 | 45 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | 'active' => false |
50 | 50 | ]); |
51 | 51 | |
52 | - $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CRUD was inactivated') ] ); |
|
52 | + $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CRUD was inactivated')]); |
|
53 | 53 | $this->emit('crudUpdated'); |
54 | 54 | } |
55 | 55 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | 'active' => true |
60 | 60 | ]); |
61 | 61 | |
62 | - $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CRUD was activated') ] ); |
|
62 | + $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CRUD was activated')]); |
|
63 | 63 | $this->emit('crudUpdated'); |
64 | 64 | } |
65 | 65 |