0

我正在开发一个博客作为 Laravel 5.3 的自定义包。

到目前为止,我已经完成了路由、控制器、模型和迁移工作。

我现在正在研究 CRUD。对于我认为可以使用的表格: https ://laravelcollective.com/docs/5.3/html


更新

我已经用作曲家安装了这个包。依赖项在 composer.json 文件中。这些文件位于我的包的供应商文件夹中。我也试过跑

作曲家转储自动加载-o

来自我的 composer.json

"require": {
    "laravelcollective/html": "5.3.*"
 }

我到处寻找,人们建议执行以下操作:

/**
 * Register bindings in the container.
 *
 * @return void
 */
public function register()
{
    // Bind the app.
    $this->app->bind('blog', function ($app) {
        return new Blog;
    });

    // Register LaravelCollective Form Builder.
    $this->app->register('Collective\Html\HtmlServiceProvider');
    $this->app->alias('Form', 'Collective\Html\FormFacade');
    $this->app->alias('Html', 'Collective\Html\HtmlFacade');
}

我目前到处都收到以下错误:

Application.php 第 610 行中的 FatalThrowableError:找不到类“Collective\Html\HtmlServiceProvider”

真的不知道我哪里出错了。


更新

我试过绑定而不是注册:

$this->app->bind('Collective\Html\HtmlServiceProvider');

但是这次我收到以下错误:

找不到类“Collective\Html\FormFacade”


4

2 回答 2

0

确保您composer.json包含依赖laravelcollective/html项,如果没有,请将其添加到您的composer.json或通过以下命令包含它composer require laravelcollective/html

于 2016-10-11T19:20:29.177 回答
0

确保您已将依赖项添加到提供程序和别名中config/app.php

'providers'=>[
     Collective\Html\HtmlServiceProvider::class,
 ],

'aliases'=>[
      'Form' => Collective\Html\FormFacade::class,
      'Html' => Collective\Html\HtmlFacade::class,
 ],
于 2016-10-11T20:22:00.413 回答