在laravel框架中,使用view方法加载模版页面,会默认到resources/views目录中寻找,如果想加载别的文件夹中的模版页面,可以使用如下方式进行修改默认的加载路径
use View;
use App;
public function __construct()
{
$template = \HDModule::config('admin.config.template');
// 方法一(该方法框架默认的分页模版会找不到)
$path = [public_path('/templates/' . $template)];
View::setFinder(new FileViewFinder(App::make('files'), $path));
// 方法二(可以使用框架默认的分页模版)
$view = app('view')->getFinder();
$view->prependLocation(public_path('templates/' . $default));
}