These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace Cortex\Pages\DataTables\Adminarea; |
||
6 | |||
7 | use Cortex\Pages\Models\Page; |
||
8 | use Cortex\Foundation\DataTables\AbstractDataTable; |
||
9 | use Cortex\Pages\Transformers\Adminarea\PageTransformer; |
||
10 | |||
11 | class PagesDataTable extends AbstractDataTable |
||
12 | { |
||
13 | /** |
||
14 | * {@inheritdoc} |
||
15 | */ |
||
16 | protected $model = Page::class; |
||
17 | |||
18 | /** |
||
19 | * {@inheritdoc} |
||
20 | */ |
||
21 | protected $transformer = PageTransformer::class; |
||
22 | |||
23 | /** |
||
24 | * Get the query object to be processed by dataTables. |
||
25 | * |
||
26 | * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder|\Illuminate\Support\Collection |
||
0 ignored issues
–
show
|
|||
27 | */ |
||
28 | public function query() |
||
29 | { |
||
30 | $locale = app()->getLocale(); |
||
31 | $query = app($this->model)->query()->orderBy('sort_order', 'ASC')->orderBy("title->\${$locale}", 'ASC'); |
||
32 | |||
33 | return $this->applyScopes($query); |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * Get columns. |
||
38 | * |
||
39 | * @return array |
||
40 | */ |
||
41 | protected function getColumns(): array |
||
42 | { |
||
43 | $link = config('cortex.foundation.route.locale_prefix') |
||
44 | ? '"<a href=\""+routes.route(\'adminarea.pages.edit\', {page: full.id, locale: \''.$this->request->segment(1).'\'})+"\">"+data+"</a>"' |
||
45 | : '"<a href=\""+routes.route(\'adminarea.pages.edit\', {page: full.id})+"\">"+data+"</a>"'; |
||
46 | |||
47 | return [ |
||
48 | 'title' => ['title' => trans('cortex/pages::common.title'), 'render' => $link.'+(full.is_active ? " <i class=\"text-success fa fa-check\"></i>" : " <i class=\"text-danger fa fa-close\"></i>")', 'responsivePriority' => 0], |
||
49 | 'uri' => ['title' => trans('cortex/pages::common.uri')], |
||
50 | 'domain' => ['title' => trans('cortex/pages::common.domain'), 'visible' => false], |
||
51 | 'route' => ['title' => trans('cortex/pages::common.route')], |
||
52 | 'view' => ['title' => trans('cortex/pages::common.view'), 'visible' => false], |
||
53 | 'middleware' => ['title' => trans('cortex/pages::common.middleware'), 'visible' => false], |
||
54 | 'sort_order' => ['title' => trans('cortex/pages::common.sort_order'), 'visible' => false], |
||
55 | 'created_at' => ['title' => trans('cortex/pages::common.created_at'), 'render' => "moment(data).format('YYYY-MM-DD, hh:mm:ss A')"], |
||
56 | 'updated_at' => ['title' => trans('cortex/pages::common.updated_at'), 'render' => "moment(data).format('YYYY-MM-DD, hh:mm:ss A')"], |
||
57 | ]; |
||
58 | } |
||
59 | } |
||
60 |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.