FileStorageList   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 5
Bugs 0 Features 0
Metric Value
eloc 18
c 5
b 0
f 0
dl 0
loc 34
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A access() 0 3 1
A body() 0 25 1
1
<?php
2
3
namespace Epesi\FileStorage;
4
5
use Epesi\Core\System\Modules\ModuleView;
0 ignored issues
show
Bug introduced by
The type Epesi\Core\System\Modules\ModuleView was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Illuminate\Support\Facades\Auth;
7
use Epesi\FileStorage\View\FileModal;
8
use Epesi\Core\Layout\View\ActionBar;
0 ignored issues
show
Bug introduced by
The type Epesi\Core\Layout\View\ActionBar was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Epesi\FileStorage\Models\File;
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
		ActionBar::addItemButton('back')->link(url('view/system'));
23
		
24
		$grid = $this->add([
25
				'CRUD',
26
				'displayFields' => [
27
						'name',
28
						'created_at',
29
						'created_by_user',						
30
						'link',
31
				],
32
				'quickSearch' => [
33
						'name', 'created_by_user',
34
				],
35
		        'menu' => ActionBar::instance(),
36
		]);
37
38
		$grid->setModel(File::create(['read_only' => true]));
39
		
40
		$grid->addDecorator('name', ['Multiformat', function($row, $column) {
41
			return [['Template', $this->app->getTag('a', ['href' => '#', 'class'=>'file-modal'], $row[$column])]];
42
		}]);
43
44
		$grid->on('click', '.file-modal', $this->add(new FileModal())->show());
45
	}
46
}
47