Skip to content

Commit edb2174

Browse files
z-songStyleCIBot
authored andcommitted
Apply fixes from StyleCI
1 parent 71369fc commit edb2174

File tree

3 files changed

+14
-18
lines changed

3 files changed

+14
-18
lines changed

src/Controllers/RouteController.php

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,22 @@ class RouteController extends Controller
1616
public function index()
1717
{
1818
return Admin::content(function (Content $content) {
19-
2019
$model = $this->getModel()->setRoutes($this->getRoutes());
2120

2221
$content->body(Admin::grid($model, function (Grid $grid) {
23-
2422
$colors = [
2523
'GET' => 'green',
2624
'HEAD' => 'gray',
2725
'POST' => 'blue',
2826
'PUT' => 'yellow',
2927
'DELETE' => 'red',
3028
'PATCH' => 'aqua',
31-
'OPTIONS'=> 'light-blue'
29+
'OPTIONS'=> 'light-blue',
3230
];
3331

3432
$grid->method()->map(function ($method) use ($colors) {
3533
return "<span class=\"label bg-{$colors[$method]}\">$method</span>";
36-
})->implode("&nbsp;");
34+
})->implode('&nbsp;');
3735

3836
$grid->uri()->display(function ($uri) {
3937
return preg_replace('/\{.+?\}/', '<code>$0</span>', $uri);
@@ -63,8 +61,7 @@ public function index()
6361

6462
protected function getModel()
6563
{
66-
return new class extends Model {
67-
64+
return new class() extends Model {
6865
protected $routes;
6966

7067
protected $where = [];
@@ -91,15 +88,13 @@ public function orderBy()
9188
public function get()
9289
{
9390
$this->routes = collect($this->routes)->filter(function ($route) {
94-
9591
foreach ($this->where as $column => $condition) {
9692
if (!Str::contains($route[$column], $condition)) {
9793
return false;
9894
}
9995
}
10096

10197
return true;
102-
10398
})->all();
10499

105100
$instance = $this->newModelInstance();
@@ -129,7 +124,8 @@ public function getRoutes()
129124
/**
130125
* Get the route information for a given route.
131126
*
132-
* @param \Illuminate\Routing\Route $route
127+
* @param \Illuminate\Routing\Route $route
128+
*
133129
* @return array
134130
*/
135131
protected function getRouteInformation(Route $route)
@@ -147,8 +143,9 @@ protected function getRouteInformation(Route $route)
147143
/**
148144
* Sort the routes by a given element.
149145
*
150-
* @param string $sort
151-
* @param array $routes
146+
* @param string $sort
147+
* @param array $routes
148+
*
152149
* @return array
153150
*/
154151
protected function sortRoutes($sort, $routes)
@@ -161,7 +158,8 @@ protected function sortRoutes($sort, $routes)
161158
/**
162159
* Get before filters.
163160
*
164-
* @param \Illuminate\Routing\Route $route
161+
* @param \Illuminate\Routing\Route $route
162+
*
165163
* @return string
166164
*/
167165
protected function getRouteMiddleware($route)
@@ -170,4 +168,4 @@ protected function getRouteMiddleware($route)
170168
return $middleware instanceof \Closure ? 'Closure' : $middleware;
171169
});
172170
}
173-
}
171+
}

src/Helpers.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use Encore\Admin\Admin;
66
use Encore\Admin\Auth\Database\Menu;
77
use Encore\Admin\Extension;
8-
use Illuminate\Support\Facades\Route;
98

109
class Helpers extends Extension
1110
{
@@ -74,11 +73,10 @@ public static function import()
7473
'title' => 'Routes',
7574
'icon' => 'fa-list-alt',
7675
'uri' => 'helpers/routes',
77-
]
76+
],
7877
];
7978

8079
foreach ($menus as $menu) {
81-
8280
$menu['parent_id'] = $root->id;
8381
$menu['order'] = $lastOrder++;
8482

@@ -87,4 +85,4 @@ public static function import()
8785

8886
parent::createPermission('Admin helpers', 'ext.helpers', 'helpers/*');
8987
}
90-
}
88+
}

src/HelpersServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ public function boot()
1515

1616
Helpers::boot();
1717
}
18-
}
18+
}

0 commit comments

Comments
 (0)