Checks if used functions are declared or listed as dependencies.
1 | <?php namespace Arcanesoft\Foundation\ViewComposers\System; |
||
2 | |||
3 | use Illuminate\View\View; |
||
4 | |||
5 | /** |
||
6 | * Class FoldersPermissionsComposer |
||
7 | * |
||
8 | * @package Arcanesoft\Foundation\ViewComposers\System |
||
9 | * @author ARCANEDEV <[email protected]> |
||
10 | */ |
||
11 | class FoldersPermissionsComposer |
||
12 | { |
||
13 | /* ----------------------------------------------------------------- |
||
14 | | Constants |
||
15 | | ----------------------------------------------------------------- |
||
16 | */ |
||
17 | |||
18 | const VIEW = 'foundation::admin.system.information._includes.folders-permissions'; |
||
19 | |||
20 | /* ----------------------------------------------------------------- |
||
21 | | Main Methods |
||
22 | | ----------------------------------------------------------------- |
||
23 | */ |
||
24 | |||
25 | /** |
||
26 | * Compose the view. |
||
27 | * |
||
28 | * @param \Illuminate\View\View $view |
||
29 | */ |
||
30 | public function compose(View $view) |
||
31 | { |
||
32 | $view->with('permissions', $this->prepare([ |
||
33 | 'storage/app/', |
||
34 | 'storage/framework/', |
||
35 | 'storage/logs/', |
||
36 | 'bootstrap/cache/', |
||
37 | ])); |
||
38 | } |
||
39 | |||
40 | /* ----------------------------------------------------------------- |
||
41 | | Other Methods |
||
42 | | ----------------------------------------------------------------- |
||
43 | */ |
||
44 | |||
45 | /** |
||
46 | * Prepare the permissions. |
||
47 | * |
||
48 | * @param array $folders |
||
49 | * |
||
50 | * @return \Illuminate\Support\Collection |
||
51 | */ |
||
52 | private function prepare(array $folders) |
||
53 | { |
||
54 | return collect($folders)->mapWithKeys(function ($folder) { |
||
55 | $path = base_path($folder); |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
56 | |||
57 | return [ |
||
58 | $folder => [ |
||
59 | 'chmod' => (int) substr(sprintf('%o', fileperms($path)), -4), |
||
60 | 'writable' => is_writable($path), |
||
61 | ], |
||
62 | ]; |
||
63 | }); |
||
64 | } |
||
65 | } |
||
66 |