|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Yajra\CMS\Repositories\FileAsset; |
|
4
|
|
|
|
|
5
|
|
|
use Illuminate\Contracts\Cache\Repository as Cache; |
|
6
|
|
|
|
|
7
|
|
|
class FileAssetCacheRepository implements FileAssetRepository |
|
8
|
|
|
{ |
|
9
|
|
|
/** |
|
10
|
|
|
* @var \Yajra\CMS\Repositories\FileAsset\FileAssetRepository |
|
11
|
|
|
*/ |
|
12
|
|
|
private $repository; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* @var \Illuminate\Contracts\Cache\Repository |
|
16
|
|
|
*/ |
|
17
|
|
|
private $cache; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* FileAssetCacheRepository constructor. |
|
21
|
|
|
* |
|
22
|
|
|
* @param \Yajra\CMS\Repositories\FileAsset\FileAssetRepository $repository |
|
23
|
|
|
* @param \Illuminate\Contracts\Cache\Repository $cache |
|
24
|
|
|
*/ |
|
25
|
|
|
public function __construct(FileAssetRepository $repository, Cache $cache) |
|
26
|
|
|
{ |
|
27
|
|
|
$this->repository = $repository; |
|
28
|
|
|
$this->cache = $cache; |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Get all file assets. |
|
33
|
|
|
* |
|
34
|
|
|
* @return \Illuminate\Database\Eloquent\Collection|static[] |
|
35
|
|
|
*/ |
|
36
|
|
|
public function all() |
|
37
|
|
|
{ |
|
38
|
|
|
return $this->cache->rememberForever('fileAssets.all', function () { |
|
39
|
|
|
return $this->repository->all(); |
|
40
|
|
|
}); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* Register admin required assets. |
|
45
|
|
|
*/ |
|
46
|
|
|
public function registerAdminRequireAssets() |
|
47
|
|
|
{ |
|
48
|
|
|
return $this->repository->registerAdminRequireAssets(); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Get file asset by name. |
|
53
|
|
|
* |
|
54
|
|
|
* @param string $name |
|
55
|
|
|
* @return FileAsset |
|
56
|
|
|
*/ |
|
57
|
|
|
public function getByName($name) |
|
58
|
|
|
{ |
|
59
|
|
|
return $this->repository->getByName($name); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* Register css blade directive. |
|
64
|
|
|
*/ |
|
65
|
|
|
public function registerCssBlade() |
|
66
|
|
|
{ |
|
67
|
|
|
return $this->repository->registerCssBlade(); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* Register javascript blade directive. |
|
72
|
|
|
*/ |
|
73
|
|
|
public function registerJsBlade() |
|
74
|
|
|
{ |
|
75
|
|
|
return $this->repository->registerJsBlade(); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* Add site asset. |
|
80
|
|
|
* |
|
81
|
|
|
* @param string $type |
|
82
|
|
|
* @return \Roumen\Asset\Asset; |
|
|
|
|
|
|
83
|
|
|
*/ |
|
84
|
|
|
public function addAsset($type) |
|
85
|
|
|
{ |
|
86
|
|
|
return $this->repository->addAsset($type); |
|
87
|
|
|
} |
|
88
|
|
|
} |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.