【问题标题】:laravel custom view directory service providerlaravel 自定义视图目录服务提供者
【发布时间】:2020-01-19 22:51:52
【问题描述】:

为什么会出现此错误:“未找到查看 [索引]。”

我使用自定义视图目录

控制器

public function index()
    {
        return view('categories::index');
    }

服务提供者

class CategoryServiceProvider extends ServiceProvider {

    public function boot()
    {
        $this->loadViewsFrom(__DIR__.'../Views', 'categories');
    }
    public function register()
    {
        $this->app->bind(CategoryRepositoryInterface::class, CategoryRepository::class);
    }
}

【问题讨论】:

    标签: laravel laravel-blade service-provider


    【解决方案1】:

    这不是吗?

    public function index()
    {
        return view('categories.index');
    }
    

    【讨论】:

      猜你喜欢
      • 2014-12-01
      • 2015-09-12
      • 2014-10-22
      • 2016-01-08
      • 2014-08-18
      • 1970-01-01
      • 1970-01-01
      • 2013-11-01
      • 1970-01-01
      相关资源
      最近更新 更多