1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Epesi\FileStorage; |
4
|
|
|
|
5
|
|
|
use Epesi\Core\System\Integration\Modules\ModuleView; |
6
|
|
|
use Illuminate\Support\Facades\Auth; |
7
|
|
|
use Epesi\Core\Data\Persistence\SQL; |
|
|
|
|
8
|
|
|
use Epesi\FileStorage\Seeds\FileModal; |
9
|
|
|
use Epesi\Core\System\User\Database\Models\User; |
10
|
|
|
|
11
|
|
|
class FileStorageList extends ModuleView |
12
|
|
|
{ |
13
|
|
|
protected $label = 'File Storage'; |
14
|
|
|
|
15
|
|
|
public static function access() |
16
|
|
|
{ |
17
|
|
|
return Auth::user()->can('modify system settings'); |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
public function body() |
21
|
|
|
{ |
22
|
|
|
$this->grid = $this->add([ |
|
|
|
|
23
|
|
|
'CRUD', |
24
|
|
|
'canCreate' => false, |
25
|
|
|
'canUpdate' => false, |
26
|
|
|
'canDelete' => false, |
27
|
|
|
'quickSearch' => [ |
28
|
|
|
'name' |
29
|
|
|
] |
30
|
|
|
]); |
31
|
|
|
|
32
|
|
|
$this->grid->menu->addItem([__('Back'), 'icon'=>'arrow left'])->link(url('view/system')); |
33
|
|
|
|
34
|
|
|
$this->grid->setModel($this->getModel()); |
35
|
|
|
|
36
|
|
|
$this->grid->addDecorator('name', ['Multiformat', function($row, $column) { |
|
|
|
|
37
|
|
|
return [['Template', '<a href="#" class="file-modal" data-id="' . $row['id'] . '">' . $row[$column] . '</a>']]; |
38
|
|
|
}]); |
39
|
|
|
|
40
|
|
|
$this->grid->addDecorator('created_by', ['Multiformat', function($row, $column) { |
41
|
|
|
if (! $user = User::find($row[$column])) return ''; |
42
|
|
|
|
43
|
|
|
return [['Template', $user->name]]; |
44
|
|
|
}]); |
45
|
|
|
|
46
|
|
|
$modal = $this->add(new FileModal()); |
47
|
|
|
|
48
|
|
|
$this->grid->on('click', '.file-modal', $modal->show()); |
49
|
|
|
|
50
|
|
|
return $this; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function getModel() |
54
|
|
|
{ |
55
|
|
|
$atkDb = app()->make(SQL::class); |
56
|
|
|
|
57
|
|
|
$model = new \atk4\data\Model($atkDb, 'filestorage_files'); |
58
|
|
|
|
59
|
|
|
$model->addFields(['created_at', 'created_by', 'name', 'link']); |
60
|
|
|
|
61
|
|
|
return $model; |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths