Total Complexity | 10 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | class Plugin |
||
14 | { |
||
15 | |||
16 | public static function has($key) |
||
17 | { |
||
18 | if(file_exists(app_path("CBPlugins/".$key))) return true; |
||
19 | else return false; |
||
20 | } |
||
21 | |||
22 | public static function isNeedUpgrade($pluginKey, $versionToCompare) |
||
23 | { |
||
24 | $pluginJson = json_decode(file_get_contents(app_path("CBPlugins/".$pluginKey."/plugin.json")), true); |
||
25 | if($pluginJson) { |
||
26 | return version_compare($pluginJson['version'], $versionToCompare,"!="); |
||
27 | }else{ |
||
28 | return false; |
||
29 | } |
||
30 | } |
||
31 | |||
32 | public static function registerDefaultRoute($dir) |
||
33 | { |
||
34 | Route::group(['middleware' => ['web',\crocodicstudio\crudbooster\middlewares\CBDeveloper::class], |
||
35 | 'prefix'=>"developer/".getSetting('developer_path'), |
||
36 | 'namespace' => 'App\CBPlugins\\'.basename(dirname("./../".$dir)).'\Controllers'], function () use ($dir) { |
||
37 | cb()->routeController("plugins/".basename(dirname("./../".$dir)),"\App\CBPlugins\\".basename(dirname("./../".$dir))."\Controllers\\".basename(dirname("./../".$dir))."Controller"); |
||
38 | }); |
||
39 | } |
||
40 | |||
41 | public function getAll() |
||
64 | } |
||
65 | } |