FileStorageCore::info()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 7
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Epesi\FileStorage;
4
5
use Epesi\Core\System\Modules\ModuleCore;
0 ignored issues
show
Bug introduced by
The type Epesi\Core\System\Modules\ModuleCore 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\Route;
7
use Spatie\Permission\Models\Permission;
8
use Spatie\Permission\Models\Role;
9
10
class FileStorageCore extends ModuleCore
11
{
12
	protected static $alias = 'filestorage';
13
	
14
	protected static $view = FileStorageList::class;
15
	
16
	protected static $joints = [
17
			Integration\FileStorageSystemSettings::class,
18
			Integration\LocalFileStorageAccess::class,
19
			Integration\RemoteFileStorageAccess::class,
20
	];
21
	
22
	public static function info()
23
	{
24
		return [
25
				__('Author') => 'Georgi Hristov',
26
				__('Copyright') => 'X Systems Ltd',
27
				'',
28
				'Provides unified file storage functionality'
29
		];
30
	}
31
	
32
	public function install()
33
	{
34
	    Models\File::migrate();
35
	    Models\FileAccessLog::migrate();
36
	    Models\FileContent::migrate();
37
	    Models\FileRemoteAccess::migrate();
38
	    
39
		$downloadFiles = Permission::create(['name' => 'download files']);
40
		
41
		Role::findByName('Admin')->givePermissionTo($downloadFiles);
42
	}
43
	
44
	public function uninstall()
45
	{
46
		Permission::findByName('download files')->delete();
47
	}
48
	
49
	public static function boot()
50
	{
51
	    Route::group(['namespace' => self::namespace()], function() {
52
			Route::get('file', 'FileStorageController@get')->middleware('web', FileStorageAccess::class);
53
		});		
54
	}
55
}
56