1 | <?php |
||||
2 | |||||
3 | namespace SleepingOwl\Admin\Display; |
||||
4 | |||||
5 | use Illuminate\Http\Request; |
||||
6 | use Illuminate\Routing\Router; |
||||
7 | use SleepingOwl\Admin\Contracts\WithRoutesInterface; |
||||
8 | |||||
9 | class DisplayDatatablesAsyncAlterPaginate extends DisplayDatatablesAsync implements WithRoutesInterface |
||||
10 | { |
||||
11 | /** |
||||
12 | * Register display routes. |
||||
13 | * |
||||
14 | * @param Router $router |
||||
15 | * |
||||
16 | * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException |
||||
17 | */ |
||||
18 | public static function registerRoutes(Router $router) |
||||
19 | { |
||||
20 | $routeName = 'admin.display.async.alter_paginate'; |
||||
21 | if (! $router->has($routeName)) { |
||||
22 | $router->get('{adminModel}/async/alter_paginate/{adminDisplayName?}', [ |
||||
23 | 'as' => $routeName, |
||||
24 | 'uses' => 'SleepingOwl\Admin\Http\Controllers\AlterPaginateDisplayController@async', |
||||
0 ignored issues
–
show
|
|||||
25 | ]); |
||||
26 | } |
||||
27 | |||||
28 | $routeName = 'admin.display.async.inlineEdit'; |
||||
29 | if (! $router->has($routeName)) { |
||||
30 | $router->post('{adminModel}/async/{adminDisplayName?}', [ |
||||
31 | 'as' => $routeName, |
||||
32 | 'uses' => 'SleepingOwl\Admin\Http\Controllers\AdminController@inlineEdit', |
||||
0 ignored issues
–
show
The controller
App\Http\Controllers\Sle...rollers\AdminController does not seem to exist.
If there is a route defined but the controller class cannot be found there are two options: 1. the controller class needs to be implemented or 2. the route is outdated and can be removed. If ?FooController? was found and ?BarController? is missing for the following example, either the controller should be implemented or the route should be removed: $app->group(['as' => 'foo', 'prefix' => 'foo', 'namespace' => 'Foo'], function($app) {
$app->group(['as' => 'foo', 'prefix' => 'foo'], function($app) {
$app->get('/all/{from}/{to}', ['as' => 'all', 'uses' => 'FooController@getFoo']);
$app->get('/all/{from}/{to}', ['as' => 'all', 'uses' => 'BarController@getBar']);
});
});
![]() |
|||||
33 | ]); |
||||
34 | } |
||||
35 | } |
||||
36 | |||||
37 | /** |
||||
38 | * Render async request. |
||||
39 | * |
||||
40 | * @param \Illuminate\Http\Request $request |
||||
41 | * |
||||
42 | * @return array |
||||
43 | */ |
||||
44 | public function renderAsync(Request $request) |
||||
45 | { |
||||
46 | $query = $this->getRepository()->getQuery(); |
||||
47 | $totalCount = 0; |
||||
48 | $filteredCount = 0; |
||||
49 | |||||
50 | if (! is_null($this->distinct)) { |
||||
51 | $filteredCount = $query->distinct()->count($this->getDistinct()); |
||||
52 | } |
||||
53 | |||||
54 | $this->modifyQuery($query); |
||||
55 | $this->applySearch($query, $request); |
||||
56 | |||||
57 | if (is_null($this->distinct)) { |
||||
58 | $countQuery = clone $query; |
||||
59 | $countQuery->getQuery()->orders = null; |
||||
60 | $filteredCount = 500; |
||||
61 | } |
||||
62 | |||||
63 | $this->applyOffset($query, $request); |
||||
0 ignored issues
–
show
$query of type Illuminate\Database\Eloquent\Builder is incompatible with the type Illuminate\Database\Query\Builder expected by parameter $query of SleepingOwl\Admin\Displa...lesAsync::applyOffset() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
64 | $collection = $query->get(); |
||||
65 | |||||
66 | return $this->prepareDatatablesStructure($request, $collection, $totalCount, $filteredCount); |
||||
67 | } |
||||
68 | } |
||||
69 |
If there is a route defined but the controller class cannot be found there are two options: 1. the controller class needs to be implemented or 2. the route is outdated and can be removed.
If ?FooController? was found and ?BarController? is missing for the following example, either the controller should be implemented or the route should be removed: