1 | <?php namespace Mascame\Artificer; |
||
7 | class Artificer |
||
8 | { |
||
9 | |||
10 | protected static $coreExtensions = [ |
||
11 | 'mascame/login' |
||
12 | ]; |
||
13 | |||
14 | public static function isCoreExtension($extension) { |
||
15 | return in_array($extension, self::$coreExtensions); |
||
16 | } |
||
17 | |||
18 | /** |
||
19 | * Returns the current user's action. |
||
20 | * |
||
21 | * @return null|string list, edit, create, show |
||
22 | */ |
||
23 | public static function getCurrentAction() |
||
24 | { |
||
25 | switch (\Route::currentRouteName()) { |
||
26 | case 'admin.model.create': |
||
27 | return 'create'; |
||
28 | case 'admin.model.edit': |
||
29 | return 'edit'; |
||
30 | case 'admin.model.show': |
||
31 | return 'show'; |
||
32 | case 'admin.model.all': |
||
33 | case 'admin.model.filter': |
||
34 | return 'list'; |
||
35 | default: |
||
36 | return null; |
||
37 | } |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @return Model |
||
42 | */ |
||
43 | public static function getModel() |
||
47 | |||
48 | /** |
||
49 | * @return \Mascame\Artificer\Plugin\Manager |
||
50 | */ |
||
51 | public static function pluginManager() |
||
55 | |||
56 | /** |
||
57 | * @return \Mascame\Artificer\Widget\Manager |
||
58 | */ |
||
59 | public static function widgetManager() |
||
63 | |||
64 | /** |
||
65 | * @return \Stolz\Assets\Manager |
||
66 | */ |
||
67 | public static function assetManager() |
||
71 | |||
72 | public static function getCurrentModelId($items) |
||
76 | |||
77 | |||
78 | public static function addMenu($options) |
||
82 | |||
83 | protected static function getMenu() |
||
87 | |||
88 | // Todo is it used anywhere? |
||
89 | // public static function store($filepath = null, $content, $overide = false) |
||
90 | // { |
||
91 | // if (!$filepath) { |
||
92 | // $pathinfo = pathinfo($filepath); |
||
93 | // $filepath = $pathinfo['dirname']; |
||
94 | // } |
||
95 | // |
||
96 | // $path = explode('/', $filepath); |
||
97 | // array_pop($path); |
||
98 | // $path = join('/', $path); |
||
99 | // |
||
100 | // if (!file_exists($path)) { |
||
101 | // \File::makeDirectory($path, 0777, true, true); |
||
102 | // } |
||
103 | // |
||
104 | // if (!file_exists($filepath) || $overide) { |
||
105 | // return \File::put($filepath, $content); |
||
106 | // } |
||
107 | // |
||
108 | // return false; |
||
109 | // } |
||
110 | } |