LoginSignup
0
0

More than 3 years have passed since last update.

Laravel v7で「Formクラスが無い」とエラーが出た時の対処法

Last updated at Posted at 2020-06-26

formファサードを使おうと思ったら「Formクラスが無い」とゆうエラーがでた

そういえば手動でcomposer.jsonをいじらなきゃいけないことを思い出し、下記をcomposer.jsonに追加。

"require": {
        "laravelcollective/html": " 7.17.2"
    },

追加したら$ composer updateをする。

しかし下記のエラーが出る

Your requirements could not be resolved to an installable set of packages.
  Problem 1
    - Conclusion: remove laravel/framework v7.17.2
    - Conclusion: don't install laravel/framework v7.17.2
    - Conclusion: don't install laravel/framework v7.17.1
    - Conclusion: don't install laravel/framework v7.17.0
    - Conclusion: don't install laravel/framework v7.16.1
    - Conclusion: don't install laravel/framework v7.16.0
    - Conclusion: don't install laravel/framework v7.15.0
    - Conclusion: don't install laravel/framework v7.14.1
    - Conclusion: don't install laravel/framework v7.14.0
    - Conclusion: don't install laravel/framework v7.13.0
    - Conclusion: don't install laravel/framework v7.12.0
    - Conclusion: don't install laravel/framework v7.11.0
    - Conclusion: don't install laravel/framework v7.10.3
    - Conclusion: don't install laravel/framework v7.10.2
    以下省略

どうやらこの投稿日時点では"laravelcollective/html"のversionがlaravelのv7に対応していないみたい。。

解決としてはlaravelcollective/html"の最新versionを指定してあげれば解決する。

"require": {
        "laravelcollective/html": " 6.1.2"
    },

もう一度$ composer updateをする。
これでいけるはず。

あとは他の記事にもあるように、app.phpファイルに下記を追加。

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

    'aliases' => [
        'Form' => Collective\Html\FormFacade::class,
        'Html' => Collective\Html\HtmlFacade::class,
    ],

解決です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0