FEATURE: make artisan command for installing work with submodules

This commit is contained in:
Michal Kváček
2016-08-15 20:47:34 +02:00
parent fa21c407b4
commit 53d532da82
2 changed files with 60 additions and 18 deletions
+4 -4
View File
@@ -2,10 +2,8 @@
namespace App\Models;
use App\Handlers\Contracts\AppHandler;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\App;
use Modules\Blog\Article\Handlers\Article;
/**
* Class Module
@@ -44,7 +42,7 @@ class Module extends Model
throw new \ErrorException('Modules can be installed only via Artisan!');
}
$managesContent = in_array('App\Handlers\Contracts\AppHandler', class_implements($handler));
$managesContent = $handler ? in_array('App\Handlers\Contracts\AppHandler', class_implements($handler)) : false;
$supportCategories = $managesContent ? call_user_func([$handler, 'supportCategories']) : false;
// insert module into database
@@ -60,7 +58,9 @@ class Module extends Model
]);
// install something module-specific
call_user_func([$handler, 'install']);
if ($handler) {
call_user_func([$handler, 'install']);
}
return $module;
}