HasAssets::publicPath()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Epesi\Core\System\Modules\Concerns;
4
5
use Illuminate\Support\Facades\File;
6
7
trait HasAssets
8
{
9
	use HasModule;
10
	
11
	/**
12
	 * Files to publish in the system
13
	 * By default files in the Public subfolder are published as assets
14
	 * to the public path under modules/<module alias>
15
	 *
16
	 * @return string
17
	 */
18
	public static function assets()
19
	{
20
		return implode(DIRECTORY_SEPARATOR, [static::path(), 'Assets']);
21
	}
22
	
23
	/**
24
	 * Path to the module public directory.
25
	 *
26
	 * @return string path to the module directory
27
	 */
28
	public static function publicPath() {
29
		return storage_path(implode(DIRECTORY_SEPARATOR, ['app', 'public', self::alias()]));
30
	}
31
	
32
	final public static function publishAssets()
33
	{
34
		File::copyDirectory(self::assets(), self::publicPath());
35
	}
36
	
37
	final public static function unpublishAssets()
38
	{
39
		File::deleteDirectory(self::publicPath());
40
	}
41
}
42