Passed
Pull Request — master (#4)
by
unknown
05:06
created
resources/lang/zh-CN/roles.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 return [
4
-    'name'       => '角色',
5
-    'guard_name' => '守卫',
6
-    'created_at' => '创建时间',
7
-    'updated_at' => '更新时间',
4
+	'name'       => '角色',
5
+	'guard_name' => '守卫',
6
+	'created_at' => '创建时间',
7
+	'updated_at' => '更新时间',
8 8
 ];
9 9
\ No newline at end of file
Please login to merge, or discard this patch.
resources/lang/zh-CN/resources.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 return [
4
-    'Roles'       => '角色',
5
-    'Role'        => '角色',
6
-    'Permissions' => '权限',
7
-    'Permission'  => '权限',
4
+	'Roles'       => '角色',
5
+	'Role'        => '角色',
6
+	'Permissions' => '权限',
7
+	'Permission'  => '权限',
8 8
 ];
9 9
\ No newline at end of file
Please login to merge, or discard this patch.
resources/lang/zh-CN/permissions.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 return [
4
-    'name'         => '权限',
5
-    'guard_name'   => '守卫',
6
-    'created_at'   => '创建时间',
7
-    'updated_at'   => '更新时间',
8
-    'display_name' => '显示名称',
9
-    'display_names' => [
10
-        'test' => '测试'
11
-    ],
4
+	'name'         => '权限',
5
+	'guard_name'   => '守卫',
6
+	'created_at'   => '创建时间',
7
+	'updated_at'   => '更新时间',
8
+	'display_name' => '显示名称',
9
+	'display_names' => [
10
+		'test' => '测试'
11
+	],
12 12
 ];
13 13
\ No newline at end of file
Please login to merge, or discard this patch.
resources/lang/zh-CN/navigation.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 return [
4
-    'sidebar-label' => '角色 & 权限',
4
+	'sidebar-label' => '角色 & 权限',
5 5
 ];
6 6
\ No newline at end of file
Please login to merge, or discard this patch.
resources/lang/en/roles.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 return [
4
-    'name'       => 'Name',
5
-    'guard_name' => 'Guard Name',
6
-    'created_at' => 'Created at',
7
-    'updated_at' => 'Updated at',
4
+	'name'       => 'Name',
5
+	'guard_name' => 'Guard Name',
6
+	'created_at' => 'Created at',
7
+	'updated_at' => 'Updated at',
8 8
 ];
9 9
\ No newline at end of file
Please login to merge, or discard this patch.
resources/lang/en/resources.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 return [
4
-    'Roles'       => 'Roles',
5
-    'Role'        => 'Role',
6
-    'Permissions' => 'Permissions',
7
-    'Permission'  => 'Permission',
4
+	'Roles'       => 'Roles',
5
+	'Role'        => 'Role',
6
+	'Permissions' => 'Permissions',
7
+	'Permission'  => 'Permission',
8 8
 ];
9 9
\ No newline at end of file
Please login to merge, or discard this patch.
resources/lang/en/permissions.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 return [
4
-    'name'         => 'Name',
5
-    'display_name' => 'Display Name',
6
-    'guard_name'   => 'Guard Name',
7
-    'created_at'   => 'Created at',
8
-    'updated_at'   => 'Updated at',
4
+	'name'         => 'Name',
5
+	'display_name' => 'Display Name',
6
+	'guard_name'   => 'Guard Name',
7
+	'created_at'   => 'Created at',
8
+	'updated_at'   => 'Updated at',
9 9
 ];
10 10
\ No newline at end of file
Please login to merge, or discard this patch.
resources/lang/en/navigation.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 return [
4
-    'sidebar-label' => 'Roles & Permissions',
4
+	'sidebar-label' => 'Roles & Permissions',
5 5
 ];
6 6
\ No newline at end of file
Please login to merge, or discard this patch.
src/TranslationHandelTrait.php 2 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -13,35 +13,35 @@
 block discarded – undo
13 13
 
14 14
 trait TranslationHandelTrait {
15 15
 
16
-    /**
17
-     * Override the applyFilters method to add the guard_name condition when filtering
18
-     *
19
-     * @param  \Laravel\Nova\Http\Requests\NovaRequest  $request
20
-     * @param  \Illuminate\Database\Eloquent\Builder  $query
21
-     * @param  array  $filters
22
-     * @return \Illuminate\Database\Eloquent\Builder
23
-     */
24
-    protected static function applyFilters(NovaRequest $request, $query, array $filters)
25
-    {
26
-        $query = parent::applyFilters($request, $query, $filters);
27
-        if($model = head($request->__memoized)){
28
-            $guard_name = $model->guard_name ?? self::getGuardForModel(get_class($model));
29
-            $query->where('guard_name', $guard_name);
30
-        }
31
-
32
-        return $query;
33
-    }
34
-
35
-    /**
36
-     * @param string model
37
-     *
38
-     * @return string|null
39
-     */
40
-    public static function getGuardForModel(string $model) {
41
-
42
-        return collect(config('auth.guards'))
43
-            ->map(function ($guard) {
44
-                return config("auth.providers.{$guard['provider']}.model");
45
-            })->search($model);
46
-    }
16
+	/**
17
+	 * Override the applyFilters method to add the guard_name condition when filtering
18
+	 *
19
+	 * @param  \Laravel\Nova\Http\Requests\NovaRequest  $request
20
+	 * @param  \Illuminate\Database\Eloquent\Builder  $query
21
+	 * @param  array  $filters
22
+	 * @return \Illuminate\Database\Eloquent\Builder
23
+	 */
24
+	protected static function applyFilters(NovaRequest $request, $query, array $filters)
25
+	{
26
+		$query = parent::applyFilters($request, $query, $filters);
27
+		if($model = head($request->__memoized)){
28
+			$guard_name = $model->guard_name ?? self::getGuardForModel(get_class($model));
29
+			$query->where('guard_name', $guard_name);
30
+		}
31
+
32
+		return $query;
33
+	}
34
+
35
+	/**
36
+	 * @param string model
37
+	 *
38
+	 * @return string|null
39
+	 */
40
+	public static function getGuardForModel(string $model) {
41
+
42
+		return collect(config('auth.guards'))
43
+			->map(function ($guard) {
44
+				return config("auth.providers.{$guard['provider']}.model");
45
+			})->search($model);
46
+	}
47 47
 }
48 48
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     protected static function applyFilters(NovaRequest $request, $query, array $filters)
25 25
     {
26 26
         $query = parent::applyFilters($request, $query, $filters);
27
-        if($model = head($request->__memoized)){
27
+        if ($model = head($request->__memoized)) {
28 28
             $guard_name = $model->guard_name ?? self::getGuardForModel(get_class($model));
29 29
             $query->where('guard_name', $guard_name);
30 30
         }
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     public static function getGuardForModel(string $model) {
41 41
 
42 42
         return collect(config('auth.guards'))
43
-            ->map(function ($guard) {
43
+            ->map(function($guard) {
44 44
                 return config("auth.providers.{$guard['provider']}.model");
45 45
             })->search($model);
46 46
     }
Please login to merge, or discard this patch.