Completed
Pull Request — master (#2113)
by
unknown
03:06
created
src/Controllers/AuthController.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -76,11 +76,11 @@  discard block
 block discarded – undo
76 76
      */
77 77
     public function getSetting()
78 78
     {
79
-        return Admin::content(function (Content $content) {
79
+        return Admin::content(function(Content $content) {
80 80
             $content->header(trans('admin.user_setting'));
81 81
             $form = $this->settingForm();
82 82
             $form->tools(
83
-                function (Form\Tools $tools) {
83
+                function(Form\Tools $tools) {
84 84
                     $tools->disableBackButton();
85 85
                     $tools->disableListButton();
86 86
                 }
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
      */
107 107
     protected function settingForm()
108 108
     {
109
-        return Administrator::form(function (Form $form) {
109
+        return Administrator::form(function(Form $form) {
110 110
             $form->display('username', trans('admin.username'));
111 111
             $form->text('name', trans('admin.name'))->rules('required');
112 112
             $form->image('avatar', trans('admin.avatar'));
113 113
             $form->password('password', trans('admin.password'))->rules('confirmed|required');
114 114
             $form->password('password_confirmation', trans('admin.password_confirmation'))->rules('required')
115
-                ->default(function ($form) {
115
+                ->default(function($form) {
116 116
                     return $form->model()->password;
117 117
                 });
118 118
 
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
 
121 121
             $form->ignore(['password_confirmation']);
122 122
 
123
-            $form->saving(function (Form $form) {
123
+            $form->saving(function(Form $form) {
124 124
                 if ($form->password && $form->model()->password != $form->password) {
125 125
                     $form->password = bcrypt($form->password);
126 126
                 }
127 127
             });
128 128
 
129
-            $form->saved(function () {
129
+            $form->saved(function() {
130 130
                 admin_toastr(trans('admin.update_succeeded'));
131 131
 
132 132
                 return redirect(admin_base_path('auth/setting'));
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      *
35 35
      * @param Request $request
36 36
      *
37
-     * @return mixed
37
+     * @return \Illuminate\Http\RedirectResponse
38 38
      */
39 39
     public function postLogin(Request $request)
40 40
     {
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     /**
63 63
      * User logout.
64 64
      *
65
-     * @return Redirect
65
+     * @return \Illuminate\Http\RedirectResponse
66 66
      */
67 67
     public function getLogout(Request $request)
68 68
     {
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     /**
77 77
      * User setting page.
78 78
      *
79
-     * @return mixed
79
+     * @return Content
80 80
      */
81 81
     public function getSetting()
82 82
     {
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
      *
168 168
      * @param \Illuminate\Http\Request $request
169 169
      *
170
-     * @return \Illuminate\Http\Response
170
+     * @return \Illuminate\Http\RedirectResponse
171 171
      */
172 172
     protected function sendLoginResponse(Request $request)
173 173
     {
Please login to merge, or discard this patch.
src/Admin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -235,10 +235,10 @@
 block discarded – undo
235 235
             'middleware' => config('admin.route.middleware'),
236 236
         ];
237 237
 
238
-        Route::group($attributes, function ($router) {
238
+        Route::group($attributes, function($router) {
239 239
 
240 240
             /* @var \Illuminate\Routing\Router $router */
241
-            $router->group([], function ($router) {
241
+            $router->group([], function($router) {
242 242
 
243 243
                 /* @var \Illuminate\Routing\Router $router */
244 244
                 $router->resource('auth/users', 'UserController');
Please login to merge, or discard this patch.
resources/views/partials/error.blade.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 @if(Session::has('error'))
2
-    <?php $error = Session::get('error');?>
2
+    <?php $error = Session::get('error'); ?>
3 3
     <div class="alert alert-danger alert-dismissable">
4 4
         <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
5 5
         <h4><i class="icon fa fa-ban"></i>{{ array_get($error->get('title'), 0) }}</h4>
6 6
         <p>{!!  array_get($error->get('message'), 0) !!}</p>
7 7
     </div>
8 8
 @elseif (Session::has('errors'))
9
-    <?php $errors = Session::get('errors');?>
9
+    <?php $errors = Session::get('errors'); ?>
10 10
     @if ($errors->hasBag('error'))
11 11
       <div class="alert alert-danger alert-dismissable">
12 12
 
Please login to merge, or discard this patch.
src/Middleware/Permission.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
             return $next($request);
34 34
         }
35 35
 
36
-        if (!Admin::user()->allPermissions()->first(function ($permission) use ($request) {
36
+        if (!Admin::user()->allPermissions()->first(function($permission) use ($request) {
37 37
             return $permission->shouldPassThrough($request);
38 38
         })) {
39 39
             Checker::error();
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      */
53 53
     public function checkRoutePermission(Request $request)
54 54
     {
55
-        if (!$middleware = collect($request->route()->middleware())->first(function ($middleware) {
55
+        if (!$middleware = collect($request->route()->middleware())->first(function($middleware) {
56 56
             return Str::startsWith($middleware, $this->middlewarePrefix);
57 57
         })) {
58 58
             return false;
Please login to merge, or discard this patch.
src/Auth/Database/Role.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@
 block discarded – undo
86 86
     {
87 87
         parent::boot();
88 88
 
89
-        static::deleting(function ($model) {
89
+        static::deleting(function($model) {
90 90
             $model->administrators()->detach();
91 91
 
92 92
             $model->permissions()->detach();
Please login to merge, or discard this patch.
src/Auth/Database/Permission.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
         $method = $this->http_method;
68 68
 
69
-        $matches = array_map(function ($path) use ($method) {
69
+        $matches = array_map(function($path) use ($method) {
70 70
             $path = trim(config('admin.route.prefix'), '/').$path;
71 71
 
72 72
             if (Str::contains($path, ':')) {
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
             return false;
101 101
         }
102 102
 
103
-        $method = collect($match['method'])->filter()->map(function ($method) {
103
+        $method = collect($match['method'])->filter()->map(function($method) {
104 104
             return strtoupper($method);
105 105
         });
106 106
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     {
141 141
         parent::boot();
142 142
 
143
-        static::deleting(function ($model) {
143
+        static::deleting(function($model) {
144 144
             $model->roles()->detach();
145 145
         });
146 146
     }
Please login to merge, or discard this patch.
src/Auth/Database/Menu.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
     {
79 79
         static::treeBoot();
80 80
 
81
-        static::deleting(function ($model) {
81
+        static::deleting(function($model) {
82 82
             $model->roles()->detach();
83 83
         });
84 84
     }
Please login to merge, or discard this patch.
src/Form/Field.php 1 patch
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
     /**
189 189
      * Field constructor.
190 190
      *
191
-     * @param $column
191
+     * @param string $column
192 192
      * @param array $arguments
193 193
      */
194 194
     public function __construct($column, $arguments = [])
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
     /**
388 388
      * Get or set rules.
389 389
      *
390
-     * @param null  $rules
390
+     * @param string  $rules
391 391
      * @param array $messages
392 392
      *
393 393
      * @return $this
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
     /**
630 630
      * Add html attributes to elements.
631 631
      *
632
-     * @param array|string $attribute
632
+     * @param string $attribute
633 633
      * @param mixed        $value
634 634
      *
635 635
      * @return $this
Please login to merge, or discard this patch.
src/Form/Field/Select.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 	 *
38 38
 	 * @param array|callable|string $options
39 39
 	 *
40
-	 * @return $this|mixed
40
+	 * @return Select
41 41
 	 */
42 42
 	public function options($options = []) {
43 43
 		// remote options
Please login to merge, or discard this patch.
Indentation   +219 added lines, -219 removed lines patch added patch discarded remove patch
@@ -8,103 +8,103 @@  discard block
 block discarded – undo
8 8
 use Illuminate\Support\Str;
9 9
 
10 10
 class Select extends Field {
11
-	/**
12
-	 * @var array
13
-	 */
14
-	protected static $css = [
15
-		'/vendor/laravel-admin/AdminLTE/plugins/select2/select2.min.css',
16
-	];
17
-
18
-	/**
19
-	 * @var array
20
-	 */
21
-	protected static $js = [
22
-		'/vendor/laravel-admin/AdminLTE/plugins/select2/select2.full.min.js',
23
-	];
24
-
25
-	/**
26
-	 * @var array
27
-	 */
28
-	protected $groups = [];
29
-
30
-	/**
31
-	 * @var array
32
-	 */
33
-	protected $config = [];
34
-
35
-	/**
36
-	 * Set options.
37
-	 *
38
-	 * @param array|callable|string $options
39
-	 *
40
-	 * @return $this|mixed
41
-	 */
42
-	public function options($options = []) {
43
-		// remote options
44
-		if (is_string($options)) {
45
-			return $this->loadRemoteOptions(...func_get_args());
46
-		}
47
-
48
-		if ($options instanceof Arrayable) {
49
-			$options = $options->toArray();
50
-		}
51
-
52
-		if (is_callable($options)) {
53
-			$this->options = $options;
54
-		} else {
55
-			$this->options = (array) $options;
56
-		}
57
-
58
-		return $this;
59
-	}
60
-
61
-	/**
62
-	 * @param array $groups
63
-	 */
64
-
65
-	/**
66
-	 * Set option groups.
67
-	 *
68
-	 * eg: $group = [
69
-	 *        [
70
-	 *        'label' => 'xxxx',
71
-	 *        'options' => [
72
-	 *            1 => 'foo',
73
-	 *            2 => 'bar',
74
-	 *            ...
75
-	 *        ],
76
-	 *        ...
77
-	 *     ]
78
-	 *
79
-	 * @param array $groups
80
-	 *
81
-	 * @return $this
82
-	 */
83
-	public function groups(array $groups) {
84
-		$this->groups = $groups;
85
-
86
-		return $this;
87
-	}
88
-
89
-	/**
90
-	 * Load options for other select on change.
91
-	 *
92
-	 * @param string $field
93
-	 * @param string $sourceUrl
94
-	 * @param string $idField
95
-	 * @param string $textField
96
-	 *
97
-	 * @return $this
98
-	 */
99
-	public function load($field, $sourceUrl, $idField = 'id', $textField = 'text') {
100
-		if (Str::contains($field, '.')) {
101
-			$field = $this->formatName($field);
102
-			$class = str_replace(['[', ']'], '_', $field);
103
-		} else {
104
-			$class = $field;
105
-		}
106
-
107
-		$script = <<<EOT
11
+    /**
12
+     * @var array
13
+     */
14
+    protected static $css = [
15
+        '/vendor/laravel-admin/AdminLTE/plugins/select2/select2.min.css',
16
+    ];
17
+
18
+    /**
19
+     * @var array
20
+     */
21
+    protected static $js = [
22
+        '/vendor/laravel-admin/AdminLTE/plugins/select2/select2.full.min.js',
23
+    ];
24
+
25
+    /**
26
+     * @var array
27
+     */
28
+    protected $groups = [];
29
+
30
+    /**
31
+     * @var array
32
+     */
33
+    protected $config = [];
34
+
35
+    /**
36
+     * Set options.
37
+     *
38
+     * @param array|callable|string $options
39
+     *
40
+     * @return $this|mixed
41
+     */
42
+    public function options($options = []) {
43
+        // remote options
44
+        if (is_string($options)) {
45
+            return $this->loadRemoteOptions(...func_get_args());
46
+        }
47
+
48
+        if ($options instanceof Arrayable) {
49
+            $options = $options->toArray();
50
+        }
51
+
52
+        if (is_callable($options)) {
53
+            $this->options = $options;
54
+        } else {
55
+            $this->options = (array) $options;
56
+        }
57
+
58
+        return $this;
59
+    }
60
+
61
+    /**
62
+     * @param array $groups
63
+     */
64
+
65
+    /**
66
+     * Set option groups.
67
+     *
68
+     * eg: $group = [
69
+     *        [
70
+     *        'label' => 'xxxx',
71
+     *        'options' => [
72
+     *            1 => 'foo',
73
+     *            2 => 'bar',
74
+     *            ...
75
+     *        ],
76
+     *        ...
77
+     *     ]
78
+     *
79
+     * @param array $groups
80
+     *
81
+     * @return $this
82
+     */
83
+    public function groups(array $groups) {
84
+        $this->groups = $groups;
85
+
86
+        return $this;
87
+    }
88
+
89
+    /**
90
+     * Load options for other select on change.
91
+     *
92
+     * @param string $field
93
+     * @param string $sourceUrl
94
+     * @param string $idField
95
+     * @param string $textField
96
+     *
97
+     * @return $this
98
+     */
99
+    public function load($field, $sourceUrl, $idField = 'id', $textField = 'text') {
100
+        if (Str::contains($field, '.')) {
101
+            $field = $this->formatName($field);
102
+            $class = str_replace(['[', ']'], '_', $field);
103
+        } else {
104
+            $class = $field;
105
+        }
106
+
107
+        $script = <<<EOT
108 108
 $(document).off('change', "{$this->getElementClassSelector()}");
109 109
 $(document).on('change', "{$this->getElementClassSelector()}", function () {
110 110
     var target = $(this).closest('.fields-group').find(".$class");
@@ -121,25 +121,25 @@  discard block
 block discarded – undo
121 121
 });
122 122
 EOT;
123 123
 
124
-		Admin::script($script);
125
-
126
-		return $this;
127
-	}
128
-
129
-	/**
130
-	 * Load options for other selects on change.
131
-	 *
132
-	 * @param string $fields
133
-	 * @param string $sourceUrls
134
-	 * @param string $idField
135
-	 * @param string $textField
136
-	 *
137
-	 * @return $this
138
-	 */
139
-	public function loads($fields = [], $sourceUrls = [], $idField = 'id', $textField = 'text') {
140
-		$fieldsStr = implode('.', $fields);
141
-		$urlsStr = implode('^', $sourceUrls);
142
-		$script = <<<EOT
124
+        Admin::script($script);
125
+
126
+        return $this;
127
+    }
128
+
129
+    /**
130
+     * Load options for other selects on change.
131
+     *
132
+     * @param string $fields
133
+     * @param string $sourceUrls
134
+     * @param string $idField
135
+     * @param string $textField
136
+     *
137
+     * @return $this
138
+     */
139
+    public function loads($fields = [], $sourceUrls = [], $idField = 'id', $textField = 'text') {
140
+        $fieldsStr = implode('.', $fields);
141
+        $urlsStr = implode('^', $sourceUrls);
142
+        $script = <<<EOT
143 143
 var fields = '$fieldsStr'.split('.');
144 144
 var urls = '$urlsStr'.split('^');
145 145
 
@@ -172,28 +172,28 @@  discard block
 block discarded – undo
172 172
 });
173 173
 EOT;
174 174
 
175
-		Admin::script($script);
175
+        Admin::script($script);
176 176
 
177
-		return $this;
178
-	}
177
+        return $this;
178
+    }
179 179
 
180
-	/**
181
-	 * Load options from remote.
182
-	 *
183
-	 * @param string $url
184
-	 * @param array  $parameters
185
-	 * @param array  $options
186
-	 *
187
-	 * @return $this
188
-	 */
189
-	protected function loadRemoteOptions($url, $parameters = [], $options = []) {
190
-		$ajaxOptions = [
191
-			'url' => $url . '?' . http_build_query($parameters),
192
-		];
180
+    /**
181
+     * Load options from remote.
182
+     *
183
+     * @param string $url
184
+     * @param array  $parameters
185
+     * @param array  $options
186
+     *
187
+     * @return $this
188
+     */
189
+    protected function loadRemoteOptions($url, $parameters = [], $options = []) {
190
+        $ajaxOptions = [
191
+            'url' => $url . '?' . http_build_query($parameters),
192
+        ];
193 193
 
194
-		$ajaxOptions = json_encode(array_merge($ajaxOptions, $options));
194
+        $ajaxOptions = json_encode(array_merge($ajaxOptions, $options));
195 195
 
196
-		$this->script = <<<EOT
196
+        $this->script = <<<EOT
197 197
 
198 198
 $.ajax($ajaxOptions).done(function(data) {
199 199
   $("{$this->getElementClassSelector()}").select2({data: data});
@@ -201,20 +201,20 @@  discard block
 block discarded – undo
201 201
 
202 202
 EOT;
203 203
 
204
-		return $this;
205
-	}
206
-
207
-	/**
208
-	 * Load options from ajax results.
209
-	 *
210
-	 * @param string $url
211
-	 * @param $idField
212
-	 * @param $textField
213
-	 *
214
-	 * @return $this
215
-	 */
216
-	public function ajax($url, $idField = 'id', $textField = 'text') {
217
-		$this->script = <<<EOT
204
+        return $this;
205
+    }
206
+
207
+    /**
208
+     * Load options from ajax results.
209
+     *
210
+     * @param string $url
211
+     * @param $idField
212
+     * @param $textField
213
+     *
214
+     * @return $this
215
+     */
216
+    public function ajax($url, $idField = 'id', $textField = 'text') {
217
+        $this->script = <<<EOT
218 218
 
219 219
 $("{$this->getElementClassSelector()}").select2({
220 220
   ajax: {
@@ -251,75 +251,75 @@  discard block
 block discarded – undo
251 251
 
252 252
 EOT;
253 253
 
254
-		return $this;
255
-	}
256
-
257
-	/**
258
-	 * Set config for select2.
259
-	 *
260
-	 * all configurations see https://select2.org/configuration/options-api
261
-	 *
262
-	 * @param string $key
263
-	 * @param mixed  $val
264
-	 *
265
-	 * @return $this
266
-	 */
267
-	public function config($key, $val) {
268
-		$this->config[$key] = $val;
269
-
270
-		return $this;
271
-	}
272
-
273
-	/**
274
-	 * {@inheritdoc}
275
-	 */
276
-	public function render() {
277
-		$configs = array_merge([
278
-			'allowClear' => true,
279
-			'placeholder' => $this->label,
280
-		], $this->config);
281
-
282
-		$configs = json_encode($configs);
283
-
284
-		if (empty($this->script)) {
285
-			$this->script = "$(\"{$this->getElementClassSelector()}\").select2($configs);";
286
-		}
287
-
288
-		if ($this->options instanceof \Closure) {
289
-			if ($this->form) {
290
-				$this->options = $this->options->bindTo($this->form->model());
291
-			}
292
-
293
-			$this->options(call_user_func($this->options, $this->value));
294
-		}
295
-
296
-		$this->options = array_filter($this->options);
297
-
298
-		return parent::render()->with([
299
-			'options' => $this->options,
300
-			'groups' => $this->groups,
301
-		]);
302
-	}
303
-
304
-	/**
305
-	 * Select Level 2 linkage, support ajax paging.
306
-	 *
307
-	 * @param string $field    parent field name
308
-	 * @param string $sourceUrl resource route
309
-	 * @param string $idField
310
-	 * @param string $textField
311
-	 *
312
-	 * @return $this
313
-	 */
314
-	public function ajaxLoad($field, $sourceUrl, $idField = 'id', $textField = 'text') {
315
-		if (Str::contains($field, '.')) {
316
-			$field = $this->formatName($field);
317
-			$class = str_replace(['[', ']'], '_', $field);
318
-		} else {
319
-			$class = $field;
320
-		}
321
-
322
-		$this->script = <<<EOT
254
+        return $this;
255
+    }
256
+
257
+    /**
258
+     * Set config for select2.
259
+     *
260
+     * all configurations see https://select2.org/configuration/options-api
261
+     *
262
+     * @param string $key
263
+     * @param mixed  $val
264
+     *
265
+     * @return $this
266
+     */
267
+    public function config($key, $val) {
268
+        $this->config[$key] = $val;
269
+
270
+        return $this;
271
+    }
272
+
273
+    /**
274
+     * {@inheritdoc}
275
+     */
276
+    public function render() {
277
+        $configs = array_merge([
278
+            'allowClear' => true,
279
+            'placeholder' => $this->label,
280
+        ], $this->config);
281
+
282
+        $configs = json_encode($configs);
283
+
284
+        if (empty($this->script)) {
285
+            $this->script = "$(\"{$this->getElementClassSelector()}\").select2($configs);";
286
+        }
287
+
288
+        if ($this->options instanceof \Closure) {
289
+            if ($this->form) {
290
+                $this->options = $this->options->bindTo($this->form->model());
291
+            }
292
+
293
+            $this->options(call_user_func($this->options, $this->value));
294
+        }
295
+
296
+        $this->options = array_filter($this->options);
297
+
298
+        return parent::render()->with([
299
+            'options' => $this->options,
300
+            'groups' => $this->groups,
301
+        ]);
302
+    }
303
+
304
+    /**
305
+     * Select Level 2 linkage, support ajax paging.
306
+     *
307
+     * @param string $field    parent field name
308
+     * @param string $sourceUrl resource route
309
+     * @param string $idField
310
+     * @param string $textField
311
+     *
312
+     * @return $this
313
+     */
314
+    public function ajaxLoad($field, $sourceUrl, $idField = 'id', $textField = 'text') {
315
+        if (Str::contains($field, '.')) {
316
+            $field = $this->formatName($field);
317
+            $class = str_replace(['[', ']'], '_', $field);
318
+        } else {
319
+            $class = $field;
320
+        }
321
+
322
+        $this->script = <<<EOT
323 323
         var current=$("{$this->getElementClassSelector()}");
324 324
         var target = current.closest('.fields-group').find(".$class");
325 325
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
         });
366 366
 EOT;
367 367
 
368
-		return $this;
369
-	}
368
+        return $this;
369
+    }
370 370
 
371 371
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -188,7 +188,7 @@
 block discarded – undo
188 188
 	 */
189 189
 	protected function loadRemoteOptions($url, $parameters = [], $options = []) {
190 190
 		$ajaxOptions = [
191
-			'url' => $url . '?' . http_build_query($parameters),
191
+			'url' => $url.'?'.http_build_query($parameters),
192 192
 		];
193 193
 
194 194
 		$ajaxOptions = json_encode(array_merge($ajaxOptions, $options));
Please login to merge, or discard this patch.