新增layout
This commit is contained in:
parent
2c349e0832
commit
46a41c86ea
@ -8,6 +8,10 @@ abstract class CatchController
|
|||||||
{
|
{
|
||||||
protected $data = [];
|
protected $data = [];
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->loadConfig();
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @time 2019年11月28日
|
* @time 2019年11月28日
|
||||||
@ -21,15 +25,16 @@ abstract class CatchController
|
|||||||
$stack = \debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2);
|
$stack = \debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2);
|
||||||
|
|
||||||
$end = end($stack);
|
$end = end($stack);
|
||||||
|
|
||||||
View::config([
|
View::config([
|
||||||
'view_path' => CatchAdmin::getViews()[$this->getModule($end['class'])]
|
'view_path' => CatchAdmin::getViews()[$this->getModule($end['class'])],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (!empty($this->data)) {
|
if (!empty($this->data)) {
|
||||||
$data = array_merge($this->data, $data);
|
$data = array_merge($this->data, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$data['layout'] = root_path('view') . 'layout.html';
|
||||||
|
|
||||||
return View::fetch($template ? : $this->getTemp($end['class'], $end['function']), $data);
|
return View::fetch($template ? : $this->getTemp($end['class'], $end['function']), $data);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -67,6 +72,23 @@ abstract class CatchController
|
|||||||
return explode('\\', $class)[1];
|
return explode('\\', $class)[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @time 2019年12月15日
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function loadConfig()
|
||||||
|
{
|
||||||
|
$module = explode('\\', get_class($this))[1];
|
||||||
|
|
||||||
|
$moduleConfig = CatchAdmin::moduleDirectory($module) . 'config.php';
|
||||||
|
|
||||||
|
if (file_exists(CatchAdmin::moduleDirectory($module) . 'config.php')) {
|
||||||
|
app()->config->load($moduleConfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @time 2019年12月13日
|
* @time 2019年12月13日
|
||||||
|
Loading…
x
Reference in New Issue
Block a user