FEATURE: add blade template registration into templates

This commit is contained in:
Michal Kváček
2016-09-20 11:50:41 +02:00
parent f087da1b43
commit d43073a011
17 changed files with 191 additions and 108 deletions
+23 -11
View File
@@ -78,6 +78,11 @@ class Module extends Model
return $module;
}
/**
* Delete module from database and uninstall its dependencies
*
* @throws \ErrorException
*/
public function uninstall() {
// check if user does not want to install module in runtime
if (!App::runningInConsole()) {
@@ -85,23 +90,30 @@ class Module extends Model
}
// delete everything in /resources/views/visitor
$directories = \File::directories(resource_path('views/visitor'));
foreach ($directories as $directory) {
$success = \File::deleteDirectory($directory);
if (!$success) {
throw new \ErrorException('Cannot delete '.$directory);
}
}
$this->deleteDirectory(resource_path('views/visitor'));
$this->deleteDirectory(public_path('assets'));
$handler = $this->handler;
if ($handler) {
if ($handler && is_callable([$handler, 'uninstall'])) {
call_user_func([$handler, 'uninstall'], $this);
}
$this->delete();
}
/**
* Delete directory when uninstalling module.
*
* @param $directory
*
* @throws \ErrorException
*/
private function deleteDirectory($directory) {
$success = \File::deleteDirectory($directory, true);
if (!$success) {
throw new \ErrorException('Cannot delete '.$directory);
}
}
}