FEATURE: add blade template registration into templates
This commit is contained in:
+23
-11
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user