@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (! function_exists('resources_url')) { |
|
| 3 | +if (!function_exists('resources_url')) { |
|
| 4 | 4 | function resources_url($path) |
| 5 | 5 | { |
| 6 | 6 | return '/packages/sleepingowl/default/'.$path; |
@@ -14,11 +14,11 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | 16 | WysiwygManager::register('ckeditor') |
| 17 | - ->js(null, '//cdn.ckeditor.com/4.5.7/standard/ckeditor.js', ['jquery']); |
|
| 17 | + ->js(null, '//cdn.ckeditor.com/4.5.7/standard/ckeditor.js', [ 'jquery' ]); |
|
| 18 | 18 | |
| 19 | 19 | WysiwygManager::register('tinymce') |
| 20 | - ->js(null, '//cdn.tinymce.com/4/tinymce.min.js', ['jquery']); |
|
| 20 | + ->js(null, '//cdn.tinymce.com/4/tinymce.min.js', [ 'jquery' ]); |
|
| 21 | 21 | |
| 22 | 22 | WysiwygManager::register('simplemde', new \SleepingOwl\Admin\Wysiwyg\MarkdownFilter()) |
| 23 | - ->js(null, '//cdn.jsdelivr.net/simplemde/latest/simplemde.min.js', ['jquery']) |
|
| 23 | + ->js(null, '//cdn.jsdelivr.net/simplemde/latest/simplemde.min.js', [ 'jquery' ]) |
|
| 24 | 24 | ->css(null, '//cdn.jsdelivr.net/simplemde/latest/simplemde.min.css'); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | | |
| 46 | 46 | */ |
| 47 | 47 | |
| 48 | - 'middleware' => ['web'], |
|
| 48 | + 'middleware' => [ 'web' ], |
|
| 49 | 49 | |
| 50 | 50 | /* |
| 51 | 51 | |-------------------------------------------------------------------------- |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | * See https://github.com/NextStepWebs/simplemde-markdown-editor |
| 134 | 134 | */ |
| 135 | 135 | 'simplemde' => [ |
| 136 | - 'hideIcons' => ['side-by-side', 'fullscreen'], |
|
| 136 | + 'hideIcons' => [ 'side-by-side', 'fullscreen' ], |
|
| 137 | 137 | ], |
| 138 | 138 | ], |
| 139 | 139 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | | Select default settings for datatable |
| 146 | 146 | | |
| 147 | 147 | */ |
| 148 | - 'datatables' => [], |
|
| 148 | + 'datatables' => [ ], |
|
| 149 | 149 | |
| 150 | 150 | /* |
| 151 | 151 | |-------------------------------------------------------------------------- |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | { |
| 10 | 10 | public function __construct() |
| 11 | 11 | { |
| 12 | - Meta::addJs('admin-default', resources_url('js/admin-app.js'), ['admin-scripts']) |
|
| 12 | + Meta::addJs('admin-default', resources_url('js/admin-app.js'), [ 'admin-scripts' ]) |
|
| 13 | 13 | ->addJs('admin-scripts', route('admin.scripts')) |
| 14 | 14 | ->addCss('admin-default', resources_url('css/admin-app.css')); |
| 15 | 15 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * |
| 55 | 55 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
| 56 | 56 | */ |
| 57 | - public function view($view, $data = [], $mergeData = []) |
|
| 57 | + public function view($view, $data = [ ], $mergeData = [ ]) |
|
| 58 | 58 | { |
| 59 | 59 | if ($view instanceof \Illuminate\View\View) { |
| 60 | 60 | return $view->with($data); |
@@ -26,16 +26,16 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | $routeName = 'admin.form.element.'.static::$route; |
| 28 | 28 | |
| 29 | - if (! $router->has($routeName)) { |
|
| 30 | - $router->post('{adminModel}/'.static::$route.'/{field}/{id?}', ['as' => $routeName, function ( |
|
| 29 | + if (!$router->has($routeName)) { |
|
| 30 | + $router->post('{adminModel}/'.static::$route.'/{field}/{id?}', [ 'as' => $routeName, function( |
|
| 31 | 31 | Request $request, |
| 32 | 32 | ModelConfigurationInterface $model, |
| 33 | 33 | $field, |
| 34 | 34 | $id = null |
| 35 | 35 | ) { |
| 36 | - if (! is_null($id)) { |
|
| 36 | + if (!is_null($id)) { |
|
| 37 | 37 | $item = $model->getRepository()->find($id); |
| 38 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
| 38 | + if (is_null($item) || !$model->isEditable($item)) { |
|
| 39 | 39 | return new JsonResponse([ |
| 40 | 40 | 'message' => trans('lang.message.access_denied'), |
| 41 | 41 | ], 403); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $form = $model->fireEdit($id); |
| 45 | 45 | } else { |
| 46 | - if (! $model->isCreatable()) { |
|
| 46 | + if (!$model->isCreatable()) { |
|
| 47 | 47 | return new JsonResponse([ |
| 48 | 48 | 'message' => trans('lang.message.access_denied'), |
| 49 | 49 | ], 403); |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | $form = $model->fireCreate(); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - $messages = []; |
|
| 56 | - $labels = []; |
|
| 55 | + $messages = [ ]; |
|
| 56 | + $labels = [ ]; |
|
| 57 | 57 | $rules = static::defaultUploadValidationRules(); |
| 58 | 58 | |
| 59 | - if (! is_null($element = $form->getElement($field))) { |
|
| 59 | + if (!is_null($element = $form->getElement($field))) { |
|
| 60 | 60 | $rules = $element->getUploadValidationRules(); |
| 61 | 61 | $messages = $element->getUploadValidationMessages(); |
| 62 | 62 | $labels = $element->getUploadValidationLabels(); |
@@ -76,14 +76,14 @@ discard block |
||
| 76 | 76 | $file = $request->file('file'); |
| 77 | 77 | |
| 78 | 78 | /** @var File $element */ |
| 79 | - if (! is_null($element = $form->getElement($field))) { |
|
| 79 | + if (!is_null($element = $form->getElement($field))) { |
|
| 80 | 80 | $filename = $element->getUploadFileName($file); |
| 81 | 81 | $path = $element->getUploadPath($file); |
| 82 | 82 | $settings = $element->getUploadSettings(); |
| 83 | 83 | } else { |
| 84 | 84 | $filename = static::defaultUploadFilename($file); |
| 85 | 85 | $path = static::defaultUploadPath($file); |
| 86 | - $settings = []; |
|
| 86 | + $settings = [ ]; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | static::saveFile($file, public_path($path), $filename, $settings); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | 'url' => asset($value), |
| 95 | 95 | 'value' => $value, |
| 96 | 96 | ]); |
| 97 | - }]); |
|
| 97 | + } ]); |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | protected static function defaultUploadValidationRules() |
| 143 | 143 | { |
| 144 | 144 | return [ |
| 145 | - 'file' => ['required', 'file'], |
|
| 145 | + 'file' => [ 'required', 'file' ], |
|
| 146 | 146 | ]; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -159,21 +159,21 @@ discard block |
||
| 159 | 159 | /** |
| 160 | 160 | * @var array |
| 161 | 161 | */ |
| 162 | - protected $uploadSettings = []; |
|
| 162 | + protected $uploadSettings = [ ]; |
|
| 163 | 163 | |
| 164 | 164 | /** |
| 165 | 165 | * @var array |
| 166 | 166 | */ |
| 167 | - protected $uploadValidationRules = ['required', 'file']; |
|
| 167 | + protected $uploadValidationRules = [ 'required', 'file' ]; |
|
| 168 | 168 | |
| 169 | 169 | /** |
| 170 | 170 | * @return array |
| 171 | 171 | */ |
| 172 | 172 | public function getUploadValidationMessages() |
| 173 | 173 | { |
| 174 | - $messages = []; |
|
| 174 | + $messages = [ ]; |
|
| 175 | 175 | foreach ($this->validationMessages as $rule => $message) { |
| 176 | - $messages["file.{$rule}"] = $message; |
|
| 176 | + $messages[ "file.{$rule}" ] = $message; |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | return $messages; |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | public function getUploadValidationLabels() |
| 186 | 186 | { |
| 187 | - return ['file' => $this->getLabel()]; |
|
| 187 | + return [ 'file' => $this->getLabel() ]; |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | /** |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | public function getUploadValidationRules() |
| 194 | 194 | { |
| 195 | - return ['file' => array_unique($this->uploadValidationRules)]; |
|
| 195 | + return [ 'file' => array_unique($this->uploadValidationRules) ]; |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | /** |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | public function getUploadPath(UploadedFile $file) |
| 204 | 204 | { |
| 205 | - if (! is_callable($this->uploadPath)) { |
|
| 205 | + if (!is_callable($this->uploadPath)) { |
|
| 206 | 206 | return static::defaultUploadPath($file); |
| 207 | 207 | } |
| 208 | 208 | |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | public function getUploadFileName(UploadedFile $file) |
| 230 | 230 | { |
| 231 | - if (! is_callable($this->uploadFileName)) { |
|
| 231 | + if (!is_callable($this->uploadFileName)) { |
|
| 232 | 232 | return static::defaultUploadFilename($file); |
| 233 | 233 | } |
| 234 | 234 | |
@@ -279,11 +279,11 @@ discard block |
||
| 279 | 279 | */ |
| 280 | 280 | public function addValidationRule($rule, $message = null) |
| 281 | 281 | { |
| 282 | - $uploadRules = ['file', 'image', 'mime', 'size', 'dimensions', 'max', 'min', 'between']; |
|
| 282 | + $uploadRules = [ 'file', 'image', 'mime', 'size', 'dimensions', 'max', 'min', 'between' ]; |
|
| 283 | 283 | |
| 284 | 284 | foreach ($uploadRules as $uploadRule) { |
| 285 | 285 | if (strpos($rule, $uploadRule) !== false) { |
| 286 | - $this->uploadValidationRules[] = $rule; |
|
| 286 | + $this->uploadValidationRules[ ] = $rule; |
|
| 287 | 287 | |
| 288 | 288 | if (is_null($message)) { |
| 289 | 289 | return $this; |