|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Coyote\Http\Grids\Adm; |
|
4
|
|
|
|
|
5
|
|
|
use Boduch\Grid\Decorators\DateTimeLocalized; |
|
6
|
|
|
use Boduch\Grid\Decorators\StrLimit; |
|
7
|
|
|
use Boduch\Grid\Decorators\Url; |
|
8
|
|
|
use Boduch\Grid\Filters\FilterOperator; |
|
9
|
|
|
use Boduch\Grid\Filters\Text; |
|
10
|
|
|
use Coyote\Flag; |
|
11
|
|
|
use Coyote\Services\Grid\Grid; |
|
12
|
|
|
use Boduch\Grid\Order; |
|
13
|
|
|
use Boduch\Grid\Row; |
|
14
|
|
|
|
|
15
|
|
|
class FlagsGrid extends Grid |
|
16
|
|
|
{ |
|
17
|
|
|
public function buildGrid() |
|
18
|
|
|
{ |
|
19
|
|
|
$this |
|
20
|
|
|
->setDefaultOrder(new Order('id', 'desc')) |
|
21
|
|
|
->addColumn('id', [ |
|
22
|
|
|
'title' => 'ID', |
|
23
|
|
|
'sortable' => true |
|
24
|
|
|
]) |
|
25
|
|
|
->addColumn('flag_type', [ |
|
26
|
|
|
'placeholder' => '--', |
|
27
|
|
|
'title' => 'Typ' |
|
28
|
|
|
]) |
|
29
|
|
|
->addColumn('user_name', [ |
|
30
|
|
|
'title' => 'Nazwa użytkownika', |
|
31
|
|
|
'sortable' => true, |
|
32
|
|
|
'placeholder' => '--', |
|
33
|
|
|
'clickable' => function (Flag $row) { |
|
34
|
|
|
return link_to_route('adm.users.save', $row->user_name, [$row->user_id]); |
|
|
|
|
|
|
35
|
|
|
}, |
|
36
|
|
|
'filter' => new Text(['operator' => FilterOperator::OPERATOR_ILIKE]) |
|
37
|
|
|
]) |
|
38
|
|
|
->addColumn('url', [ |
|
39
|
|
|
'title' => 'URL', |
|
40
|
|
|
'filter' => new Text(['operator' => FilterOperator::OPERATOR_ILIKE]), |
|
41
|
|
|
'decorators' => [new Url()] |
|
42
|
|
|
]) |
|
43
|
|
|
->addColumn('text', [ |
|
44
|
|
|
'title' => 'Opis', |
|
45
|
|
|
'decorators' => [new StrLimit()] |
|
46
|
|
|
]) |
|
47
|
|
|
->addColumn('created_at', [ |
|
48
|
|
|
'title' => 'Data utworzenia', |
|
49
|
|
|
'decorators' => [new DateTimeLocalized(auth()->user()->date_format)] |
|
50
|
|
|
]) |
|
51
|
|
|
->addColumn('moderator_name', [ |
|
52
|
|
|
'title' => 'Zamknięty przez', |
|
53
|
|
|
'clickable' => function (Flag $row) { |
|
54
|
|
|
return link_to_route('adm.users.save', $row->moderator_name, [$row->moderator_id]); |
|
|
|
|
|
|
55
|
|
|
}, |
|
56
|
|
|
'placeholder' => '--' |
|
57
|
|
|
]) |
|
58
|
|
|
->after(function (Row $row) { |
|
59
|
|
|
if (!empty($row->raw('deleted_at'))) { |
|
60
|
|
|
$row->class = 'strikeout'; |
|
61
|
|
|
} |
|
62
|
|
|
}); |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.