@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | /** |
10 | 10 | * @var Closure[] |
11 | 11 | */ |
12 | - protected $applies = []; |
|
12 | + protected $applies = [ ]; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * @return Closure[] |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function set($applies) |
28 | 28 | { |
29 | - if (! is_array($applies)) { |
|
29 | + if (!is_array($applies)) { |
|
30 | 30 | $applies = func_get_args(); |
31 | 31 | } |
32 | 32 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function push(Closure $apply) |
46 | 46 | { |
47 | - $this->applies[] = $apply; |
|
47 | + $this->applies[ ] = $apply; |
|
48 | 48 | |
49 | 49 | return $this; |
50 | 50 | } |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | */ |
333 | 333 | public function isCreatable() |
334 | 334 | { |
335 | - if (! is_callable($this->getCreate())) { |
|
335 | + if (!is_callable($this->getCreate())) { |
|
336 | 336 | return false; |
337 | 337 | } |
338 | 338 | |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | */ |
357 | 357 | public function isEditable(Model $model) |
358 | 358 | { |
359 | - if (! is_callable($this->getEdit())) { |
|
359 | + if (!is_callable($this->getEdit())) { |
|
360 | 360 | return false; |
361 | 361 | } |
362 | 362 | |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | */ |
467 | 467 | public function fireDisplay() |
468 | 468 | { |
469 | - if (! is_callable($this->display)) { |
|
469 | + if (!is_callable($this->display)) { |
|
470 | 470 | return; |
471 | 471 | } |
472 | 472 | |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | */ |
485 | 485 | public function fireCreate() |
486 | 486 | { |
487 | - if (! is_callable($this->create)) { |
|
487 | + if (!is_callable($this->create)) { |
|
488 | 488 | return; |
489 | 489 | } |
490 | 490 | |
@@ -507,11 +507,11 @@ discard block |
||
507 | 507 | */ |
508 | 508 | public function fireEdit($id) |
509 | 509 | { |
510 | - if (! is_callable($this->edit)) { |
|
510 | + if (!is_callable($this->edit)) { |
|
511 | 511 | return; |
512 | 512 | } |
513 | 513 | |
514 | - $edit = app()->call($this->edit, ['id' => $id]); |
|
514 | + $edit = app()->call($this->edit, [ 'id' => $id ]); |
|
515 | 515 | if ($edit instanceof DisplayInterface) { |
516 | 516 | $edit->setModelClass($this->getClass()); |
517 | 517 | $edit->initialize(); |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | public function fireDelete($id) |
546 | 546 | { |
547 | 547 | if (is_callable($this->getDelete())) { |
548 | - return app()->call($this->getDelete(), [$id]); |
|
548 | + return app()->call($this->getDelete(), [ $id ]); |
|
549 | 549 | } |
550 | 550 | } |
551 | 551 | |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | public function fireDestroy($id) |
558 | 558 | { |
559 | 559 | if (is_callable($this->getDestroy())) { |
560 | - return app()->call($this->getDestroy(), [$id]); |
|
560 | + return app()->call($this->getDestroy(), [ $id ]); |
|
561 | 561 | } |
562 | 562 | } |
563 | 563 | |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | public function fireRestore($id) |
570 | 570 | { |
571 | 571 | if (is_callable($this->getRestore())) { |
572 | - return app()->call($this->getRestore(), [$id]); |
|
572 | + return app()->call($this->getRestore(), [ $id ]); |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | return $this->getRestore(); |
@@ -68,7 +68,7 @@ |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
71 | - * @param $id |
|
71 | + * @param integer $id |
|
72 | 72 | * |
73 | 73 | * @return mixed|void |
74 | 74 | */ |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @return $this |
21 | 21 | */ |
22 | - public function addScript($handle, $script, array $dependency = []) |
|
22 | + public function addScript($handle, $script, array $dependency = [ ]) |
|
23 | 23 | { |
24 | 24 | if (is_null($handle)) { |
25 | 25 | $handle = $script; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @return $this |
39 | 39 | */ |
40 | - public function addStyle($handle, $style, array $attributes = []) |
|
40 | + public function addStyle($handle, $style, array $attributes = [ ]) |
|
41 | 41 | { |
42 | 42 | if (is_null($handle)) { |
43 | 43 | $handle = $style; |
@@ -16,26 +16,26 @@ discard block |
||
16 | 16 | * @var array |
17 | 17 | */ |
18 | 18 | protected $sqlOperators = [ |
19 | - 'equal' => ['method' => 'where', 'op' => '='], |
|
20 | - 'not_equal' => ['method' => 'where', 'op' => '!='], |
|
21 | - 'less' => ['method' => 'where', 'op' => '<'], |
|
22 | - 'less_or_equal' => ['method' => 'where', 'op' => '<='], |
|
23 | - 'greater' => ['method' => 'where', 'op' => '>'], |
|
24 | - 'greater_or_equal' => ['method' => 'where', 'op' => '>='], |
|
25 | - 'begins_with' => ['method' => 'where', 'op' => 'like', 'mod' => '?%'], |
|
26 | - 'not_begins_with' => ['method' => 'where', 'op' => 'not like', 'mod' => '?%'], |
|
27 | - 'contains' => ['method' => 'where', 'op' => 'like', 'mod' => '%?%'], |
|
28 | - 'not_contains' => ['method' => 'where', 'op' => 'not like', 'mod' => '%?%'], |
|
29 | - 'ends_with' => ['method' => 'where', 'op' => 'like', 'mod' => '%?'], |
|
30 | - 'not_ends_with' => ['method' => 'where', 'op' => 'not like', 'mod' => '%?'], |
|
31 | - 'is_empty' => ['method' => 'where', 'op' => '=', 'value' => ''], |
|
32 | - 'is_not_empty' => ['method' => 'where', 'op' => '!=', 'value' => ''], |
|
33 | - 'is_null' => ['method' => 'whereNull'], |
|
34 | - 'is_not_null' => ['method' => 'whereNotNull'], |
|
35 | - 'between' => ['method' => 'whereBetween'], |
|
36 | - 'not_between' => ['method' => 'whereNotBetween'], |
|
37 | - 'in' => ['method' => 'whereIn'], |
|
38 | - 'not_in' => ['method' => 'whereNotIn'], |
|
19 | + 'equal' => [ 'method' => 'where', 'op' => '=' ], |
|
20 | + 'not_equal' => [ 'method' => 'where', 'op' => '!=' ], |
|
21 | + 'less' => [ 'method' => 'where', 'op' => '<' ], |
|
22 | + 'less_or_equal' => [ 'method' => 'where', 'op' => '<=' ], |
|
23 | + 'greater' => [ 'method' => 'where', 'op' => '>' ], |
|
24 | + 'greater_or_equal' => [ 'method' => 'where', 'op' => '>=' ], |
|
25 | + 'begins_with' => [ 'method' => 'where', 'op' => 'like', 'mod' => '?%' ], |
|
26 | + 'not_begins_with' => [ 'method' => 'where', 'op' => 'not like', 'mod' => '?%' ], |
|
27 | + 'contains' => [ 'method' => 'where', 'op' => 'like', 'mod' => '%?%' ], |
|
28 | + 'not_contains' => [ 'method' => 'where', 'op' => 'not like', 'mod' => '%?%' ], |
|
29 | + 'ends_with' => [ 'method' => 'where', 'op' => 'like', 'mod' => '%?' ], |
|
30 | + 'not_ends_with' => [ 'method' => 'where', 'op' => 'not like', 'mod' => '%?' ], |
|
31 | + 'is_empty' => [ 'method' => 'where', 'op' => '=', 'value' => '' ], |
|
32 | + 'is_not_empty' => [ 'method' => 'where', 'op' => '!=', 'value' => '' ], |
|
33 | + 'is_null' => [ 'method' => 'whereNull' ], |
|
34 | + 'is_not_null' => [ 'method' => 'whereNotNull' ], |
|
35 | + 'between' => [ 'method' => 'whereBetween' ], |
|
36 | + 'not_between' => [ 'method' => 'whereNotBetween' ], |
|
37 | + 'in' => [ 'method' => 'whereIn' ], |
|
38 | + 'not_in' => [ 'method' => 'whereNotIn' ], |
|
39 | 39 | ]; |
40 | 40 | |
41 | 41 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function setOperator($operator) |
56 | 56 | { |
57 | - if (! array_key_exists($operator, $this->sqlOperators)) { |
|
57 | + if (!array_key_exists($operator, $this->sqlOperators)) { |
|
58 | 58 | throw new FilterOperatorException("Operator [$operator] not found"); |
59 | 59 | } |
60 | 60 | |
@@ -71,12 +71,12 @@ discard block |
||
71 | 71 | protected function buildQuery(Builder $query, $column, $value) |
72 | 72 | { |
73 | 73 | $params = $this->getOperatorParams(); |
74 | - $method = $params['method']; |
|
74 | + $method = $params[ 'method' ]; |
|
75 | 75 | |
76 | 76 | switch ($method) { |
77 | 77 | case 'where': |
78 | 78 | $value = str_replace('?', $value, array_get($params, 'mod', '?')); |
79 | - $query->where($column, $params['op'], $value); |
|
79 | + $query->where($column, $params[ 'op' ], $value); |
|
80 | 80 | break; |
81 | 81 | case 'whereNull': |
82 | 82 | case 'whereNotNull': |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | protected function getOperatorParams() |
100 | 100 | { |
101 | - return array_get($this->sqlOperators, $this->getOperator(), ['method' => 'where', 'op' => '=']); |
|
101 | + return array_get($this->sqlOperators, $this->getOperator(), [ 'method' => 'where', 'op' => '=' ]); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | protected function prepareValue($value) |
110 | 110 | { |
111 | 111 | $params = $this->getOperatorParams(); |
112 | - $method = $params['method']; |
|
112 | + $method = $params[ 'method' ]; |
|
113 | 113 | switch ($method) { |
114 | 114 | case 'where': |
115 | 115 | case 'whereNull': |
@@ -117,13 +117,13 @@ discard block |
||
117 | 117 | break; |
118 | 118 | case 'whereBetween': |
119 | 119 | case 'whereNotBetween': |
120 | - if (! is_array($value)) { |
|
120 | + if (!is_array($value)) { |
|
121 | 121 | $value = explode(',', $value, 2); |
122 | 122 | } |
123 | 123 | break; |
124 | 124 | case 'whereIn': |
125 | 125 | case 'whereNotIn': |
126 | - if (! is_array($value)) { |
|
126 | + if (!is_array($value)) { |
|
127 | 127 | $value = explode(',', $value); |
128 | 128 | } |
129 | 129 | break; |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | } else { |
31 | 31 | $method = 'set'.ucfirst($name); |
32 | 32 | if (method_exists($this, 'set'.ucfirst($name))) { |
33 | - $this->attributes[$name] = $this->{$method}($value); |
|
33 | + $this->attributes[ $name ] = $this->{$method}($value); |
|
34 | 34 | } else { |
35 | - $this->attributes[$name] = $value; |
|
35 | + $this->attributes[ $name ] = $value; |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function __isset($name) |
69 | 69 | { |
70 | - return isset($this->attributes[$name]); |
|
70 | + return isset($this->attributes[ $name ]); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -75,6 +75,6 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function __unset($name) |
77 | 77 | { |
78 | - unset($this->attributes[$name]); |
|
78 | + unset($this->attributes[ $name ]); |
|
79 | 79 | } |
80 | 80 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | ); |
33 | 33 | |
34 | 34 | foreach ($provider->sections() as $model => $section) { |
35 | - $this->callSilent('sleepingowl:section:make', ['name' => $section, 'model' => $model]); |
|
35 | + $this->callSilent('sleepingowl:section:make', [ 'name' => $section, 'model' => $model ]); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | $this->info('Sections generated successfully!'); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | { |
54 | 54 | $userClass = $this->getUserClass(); |
55 | 55 | |
56 | - $headers = ['id', 'name', 'email']; |
|
56 | + $headers = [ 'id', 'name', 'email' ]; |
|
57 | 57 | $users = $userClass::get($headers); |
58 | 58 | |
59 | 59 | $this->table($headers, $users); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | return; |
70 | 70 | } |
71 | 71 | |
72 | - if (! is_null($userClass::where('email', $email)->first())) { |
|
72 | + if (!is_null($userClass::where('email', $email)->first())) { |
|
73 | 73 | $this->error("User with same email [{$email}] exists."); |
74 | 74 | |
75 | 75 | return; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | } |
121 | 121 | |
122 | 122 | $confirm = $this->confirm("Are you sure want to delete user with id [{$id}]?", false); |
123 | - if (! $confirm) { |
|
123 | + if (!$confirm) { |
|
124 | 124 | return; |
125 | 125 | } |
126 | 126 | |
@@ -173,9 +173,9 @@ discard block |
||
173 | 173 | protected function getOptions() |
174 | 174 | { |
175 | 175 | return [ |
176 | - ['create', 'c', InputOption::VALUE_NONE, 'Create new user.'], |
|
177 | - ['delete', 'd', InputOption::VALUE_NONE, 'Delete user.'], |
|
178 | - ['password', 'p', InputOption::VALUE_NONE, 'Change user password.'], |
|
176 | + [ 'create', 'c', InputOption::VALUE_NONE, 'Create new user.' ], |
|
177 | + [ 'delete', 'd', InputOption::VALUE_NONE, 'Delete user.' ], |
|
178 | + [ 'password', 'p', InputOption::VALUE_NONE, 'Change user password.' ], |
|
179 | 179 | ]; |
180 | 180 | } |
181 | 181 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | $title = $this->option('title'); |
39 | 39 | |
40 | - $this->call('vendor:publish', ['--provider' => SleepingOwlServiceProvider::class]); |
|
40 | + $this->call('vendor:publish', [ '--provider' => SleepingOwlServiceProvider::class ]); |
|
41 | 41 | |
42 | 42 | $this->publishConfig($title); |
43 | 43 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | { |
57 | 57 | $directory = config('sleeping_owl.bootstrapDirectory'); |
58 | 58 | |
59 | - if (! is_dir($directory)) { |
|
59 | + if (!is_dir($directory)) { |
|
60 | 60 | $this->files->makeDirectory($directory, 0755, true, true); |
61 | 61 | $this->line('<info>Admin bootstrap directory was created:</info> '.str_replace(base_path(), '', $directory)); |
62 | 62 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | { |
70 | 70 | $file = config('sleeping_owl.bootstrapDirectory').'/navigation.php'; |
71 | 71 | |
72 | - if (! file_exists($file)) { |
|
72 | + if (!file_exists($file)) { |
|
73 | 73 | $contents = $this->files->get(__DIR__.'/stubs/navigation.stub'); |
74 | 74 | $this->files->put($file, $contents); |
75 | 75 | $this->line('<info>Menu file was created:</info> '.str_replace(base_path(), '', $file)); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | protected function createBootstrapFile() |
83 | 83 | { |
84 | 84 | $file = config('sleeping_owl.bootstrapDirectory').'/bootstrap.php'; |
85 | - if (! file_exists($file)) { |
|
85 | + if (!file_exists($file)) { |
|
86 | 86 | $contents = $this->files->get(__DIR__.'/stubs/bootstrap.stub'); |
87 | 87 | $this->files->put($file, $contents); |
88 | 88 | $this->line('<info>Bootstrap file was created:</info> '.str_replace(base_path(), '', $file)); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | protected function createServiceProvider() |
93 | 93 | { |
94 | 94 | $file = app_path('Providers/AdminSectionsServiceProvider.php'); |
95 | - if (! file_exists($file)) { |
|
95 | + if (!file_exists($file)) { |
|
96 | 96 | $contents = $this->files->get(__DIR__.'/stubs/AdminSectionsServiceProvider.stub'); |
97 | 97 | $this->files->put($file, $contents); |
98 | 98 | $this->line('<info>AdminSectionsServiceProvider file was created:</info> '.str_replace(base_path(), '', $file)); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | protected function createRoutesFile() |
106 | 106 | { |
107 | 107 | $file = config('sleeping_owl.bootstrapDirectory').'/routes.php'; |
108 | - if (! file_exists($file)) { |
|
108 | + if (!file_exists($file)) { |
|
109 | 109 | $contents = $this->files->get(__DIR__.'/stubs/routes.stub'); |
110 | 110 | $this->files->put($file, $contents); |
111 | 111 | $this->line('<info>Bootstrap file was created:</info> '.str_replace(base_path(), '', $file)); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | protected function createPublicDefaultStructure() |
119 | 119 | { |
120 | 120 | $uploadsDirectory = public_path('images/uploads'); |
121 | - if (! is_dir($uploadsDirectory)) { |
|
121 | + if (!is_dir($uploadsDirectory)) { |
|
122 | 122 | $this->files->makeDirectory($uploadsDirectory, 0755, true, true); |
123 | 123 | } |
124 | 124 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | { |
133 | 133 | $file = config_path('sleeping_owl.php'); |
134 | 134 | |
135 | - if (! is_null($title)) { |
|
135 | + if (!is_null($title)) { |
|
136 | 136 | $contents = $this->files->get($file); |
137 | 137 | $contents = str_replace('Sleeping Owl administrator', $title, $contents); |
138 | 138 | $this->files->put($file, $contents); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | protected function getOptions() |
147 | 147 | { |
148 | 148 | return [ |
149 | - ['title', null, InputOption::VALUE_REQUIRED, 'Title for admin module.'], |
|
149 | + [ 'title', null, InputOption::VALUE_REQUIRED, 'Title for admin module.' ], |
|
150 | 150 | ]; |
151 | 151 | } |
152 | 152 | } |
@@ -82,7 +82,7 @@ |
||
82 | 82 | protected function getArguments() |
83 | 83 | { |
84 | 84 | $arguments = parent::getArguments(); |
85 | - $arguments[] = ['model', InputArgument::REQUIRED, 'The name of the model class']; |
|
85 | + $arguments[ ] = [ 'model', InputArgument::REQUIRED, 'The name of the model class' ]; |
|
86 | 86 | |
87 | 87 | return $arguments; |
88 | 88 | } |