@@ -8,6 +8,9 @@ discard block |
||
8 | 8 | |
9 | 9 | protected $append; |
10 | 10 | |
11 | + /** |
|
12 | + * @param string $string |
|
13 | + */ |
|
11 | 14 | public function prepend($string) |
12 | 15 | { |
13 | 16 | if (is_null($this->prepend)) { |
@@ -17,6 +20,9 @@ discard block |
||
17 | 20 | return $this; |
18 | 21 | } |
19 | 22 | |
23 | + /** |
|
24 | + * @param string $string |
|
25 | + */ |
|
20 | 26 | public function append($string) |
21 | 27 | { |
22 | 28 | if (is_null($this->append)) { |
@@ -33,6 +39,9 @@ discard block |
||
33 | 39 | } |
34 | 40 | } |
35 | 41 | |
42 | + /** |
|
43 | + * @param string $attribute |
|
44 | + */ |
|
36 | 45 | protected function defaultAttribute($attribute, $value) |
37 | 46 | { |
38 | 47 | if (! array_key_exists($attribute, $this->attributes)) { |
@@ -35,7 +35,7 @@ |
||
35 | 35 | |
36 | 36 | protected function defaultAttribute($attribute, $value) |
37 | 37 | { |
38 | - if (! array_key_exists($attribute, $this->attributes)) { |
|
38 | + if (!array_key_exists($attribute, $this->attributes)) { |
|
39 | 39 | $this->attribute($attribute, $value); |
40 | 40 | } |
41 | 41 |
@@ -40,20 +40,20 @@ discard block |
||
40 | 40 | */ |
41 | 41 | protected function resolveForm(Request $request) |
42 | 42 | { |
43 | - if (! $request->has('_form_')) { |
|
43 | + if (!$request->has('_form_')) { |
|
44 | 44 | throw new Exception('Invalid form request.'); |
45 | 45 | } |
46 | 46 | |
47 | 47 | $formClass = $request->get('_form_'); |
48 | 48 | |
49 | - if (! class_exists($formClass)) { |
|
49 | + if (!class_exists($formClass)) { |
|
50 | 50 | throw new Exception("Form [{$formClass}] does not exist."); |
51 | 51 | } |
52 | 52 | |
53 | 53 | /** @var Form $form */ |
54 | 54 | $form = app($formClass); |
55 | 55 | |
56 | - if (! method_exists($form, 'handle')) { |
|
56 | + if (!method_exists($form, 'handle')) { |
|
57 | 57 | throw new Exception("Form method {$formClass}::handle() does not exist."); |
58 | 58 | } |
59 | 59 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $arguments[] = $model; |
78 | 78 | } |
79 | 79 | |
80 | - if (! $action->passesAuthorization($model)) { |
|
80 | + if (!$action->passesAuthorization($model)) { |
|
81 | 81 | return $action->failedAuthorization(); |
82 | 82 | } |
83 | 83 | |
@@ -107,20 +107,20 @@ discard block |
||
107 | 107 | */ |
108 | 108 | protected function resolveActionInstance(Request $request) |
109 | 109 | { |
110 | - if (! $request->has('_action')) { |
|
110 | + if (!$request->has('_action')) { |
|
111 | 111 | throw new Exception('Invalid action request.'); |
112 | 112 | } |
113 | 113 | |
114 | 114 | $actionClass = str_replace('_', '\\', $request->get('_action')); |
115 | 115 | |
116 | - if (! class_exists($actionClass)) { |
|
116 | + if (!class_exists($actionClass)) { |
|
117 | 117 | throw new Exception("Form [{$actionClass}] does not exist."); |
118 | 118 | } |
119 | 119 | |
120 | 120 | /** @var GridAction $form */ |
121 | 121 | $action = app($actionClass); |
122 | 122 | |
123 | - if (! method_exists($action, 'handle')) { |
|
123 | + if (!method_exists($action, 'handle')) { |
|
124 | 124 | throw new Exception("Action method {$actionClass}::handle() does not exist."); |
125 | 125 | } |
126 | 126 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | { |
138 | 138 | $args = [$request]; |
139 | 139 | |
140 | - if (! empty($model)) { |
|
140 | + if (!empty($model)) { |
|
141 | 141 | array_unshift($args, $model); |
142 | 142 | } |
143 | 143 |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | public function __construct($content = '') |
27 | 27 | { |
28 | - if (! empty($content)) { |
|
28 | + if (!empty($content)) { |
|
29 | 29 | $this->column(12, $content); |
30 | 30 | } |
31 | 31 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function row($content) |
71 | 71 | { |
72 | - if (! $content instanceof \Closure) { |
|
72 | + if (!$content instanceof \Closure) { |
|
73 | 73 | $row = new Row($content); |
74 | 74 | } else { |
75 | 75 | $row = new Row(); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | protected function startColumn() |
113 | 113 | { |
114 | 114 | // get class name using width array |
115 | - $classnName = collect($this->width)->map(function ($value, $key) { |
|
115 | + $classnName = collect($this->width)->map(function($value, $key) { |
|
116 | 116 | return "col-$key-$value"; |
117 | 117 | })->implode(' '); |
118 | 118 |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | protected function validateBreadcrumb(array $breadcrumb) |
119 | 119 | { |
120 | 120 | foreach ($breadcrumb as $item) { |
121 | - if (! is_array($item) || ! Arr::has($item, 'text')) { |
|
121 | + if (!is_array($item) || !Arr::has($item, 'text')) { |
|
122 | 122 | throw new \Exception('Breadcrumb format error!'); |
123 | 123 | } |
124 | 124 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | */ |
279 | 279 | protected function getUserData() |
280 | 280 | { |
281 | - if (! $user = Admin::user()) { |
|
281 | + if (!$user = Admin::user()) { |
|
282 | 282 | return []; |
283 | 283 | } |
284 | 284 |
@@ -31,13 +31,13 @@ |
||
31 | 31 | { |
32 | 32 | $extension = $this->argument('extension'); |
33 | 33 | |
34 | - if (empty($extension) || ! Arr::has(Admin::$extensions, $extension)) { |
|
34 | + if (empty($extension) || !Arr::has(Admin::$extensions, $extension)) { |
|
35 | 35 | $extension = $this->choice('Please choose a extension to import', array_keys(Admin::$extensions)); |
36 | 36 | } |
37 | 37 | |
38 | 38 | $className = Arr::get(Admin::$extensions, $extension); |
39 | 39 | |
40 | - if (! class_exists($className) || ! method_exists($className, 'import')) { |
|
40 | + if (!class_exists($className) || !method_exists($className, 'import')) { |
|
41 | 41 | $this->error("Invalid Extension [$className]"); |
42 | 42 | |
43 | 43 | return; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function handle() |
44 | 44 | { |
45 | - if (! class_exists(Minify\Minify::class)) { |
|
45 | + if (!class_exists(Minify\Minify::class)) { |
|
46 | 46 | $this->error('To use `admin:minify` command, please install [matthiasmullie/minify] first.'); |
47 | 47 | |
48 | 48 | return; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | protected function minifyCSS() |
95 | 95 | { |
96 | 96 | $css = collect(array_merge(Admin::$css, Admin::baseCss())) |
97 | - ->unique()->map(function ($css) { |
|
97 | + ->unique()->map(function($css) { |
|
98 | 98 | if (url()->isValidUrl($css)) { |
99 | 99 | $this->assets['css'][] = $css; |
100 | 100 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | protected function minifyJS() |
125 | 125 | { |
126 | 126 | $js = collect(array_merge(Admin::$js, Admin::baseJs())) |
127 | - ->unique()->map(function ($js) { |
|
127 | + ->unique()->map(function($js) { |
|
128 | 128 | if (url()->isValidUrl($js)) { |
129 | 129 | $this->assets['js'][] = $js; |
130 | 130 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | protected function generateManifest() |
155 | 155 | { |
156 | - $min = collect(Admin::$min)->mapWithKeys(function ($path, $type) { |
|
156 | + $min = collect(Admin::$min)->mapWithKeys(function($path, $type) { |
|
157 | 157 | return [$type => sprintf('%s?id=%s', $path, md5(uniqid()))]; |
158 | 158 | }); |
159 | 159 |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | $this->extensionDir = $this->ask('Please input a directory to store your extension:'); |
81 | 81 | } |
82 | 82 | |
83 | - if (! file_exists($this->extensionDir)) { |
|
83 | + if (!file_exists($this->extensionDir)) { |
|
84 | 84 | $this->makeDir(); |
85 | 85 | } |
86 | 86 | |
87 | 87 | $this->package = $this->argument('extension'); |
88 | 88 | |
89 | 89 | InputExtensionName: |
90 | - if (! $this->validateExtensionName($this->package)) { |
|
90 | + if (!$this->validateExtensionName($this->package)) { |
|
91 | 91 | $this->package = $this->ask("[$this->package] is not a valid package name, please input a name like (<vendor>/<name>)"); |
92 | 92 | goto InputExtensionName; |
93 | 93 | } |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | */ |
195 | 195 | protected function getRootNameSpace() |
196 | 196 | { |
197 | - if (! $namespace = $this->option('namespace')) { |
|
197 | + if (!$namespace = $this->option('namespace')) { |
|
198 | 198 | [$vendor, $name] = explode('/', $this->package); |
199 | 199 | |
200 | 200 | $default = str_replace(['-', '-'], '', Str::title($vendor).'\\'.Str::title($name)); |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | return; |
285 | 285 | } |
286 | 286 | |
287 | - if (! file_exists($from)) { |
|
287 | + if (!file_exists($from)) { |
|
288 | 288 | return; |
289 | 289 | } |
290 | 290 |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | return $model; |
67 | 67 | } |
68 | 68 | |
69 | - if (! class_exists($model) || ! is_string($model) || ! is_subclass_of($model, Model::class)) { |
|
69 | + if (!class_exists($model) || !is_string($model) || !is_subclass_of($model, Model::class)) { |
|
70 | 70 | throw new \InvalidArgumentException("Invalid model [$model] !"); |
71 | 71 | } |
72 | 72 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | */ |
214 | 214 | protected function getTableColumns() |
215 | 215 | { |
216 | - if (! $this->model->getConnection()->isDoctrineAvailable()) { |
|
216 | + if (!$this->model->getConnection()->isDoctrineAvailable()) { |
|
217 | 217 | throw new \Exception( |
218 | 218 | 'You need to require doctrine/dbal: ~2.3 in your own composer.json to get database columns. ' |
219 | 219 | ); |