Forms 拉威尔5.4级';表格';找不到
我面临的问题是“类”表单“未找到”我目前正在使用laravel 5.4。我已经尽了最大的努力来解决这个问题 谢谢 错误是:哎呀,看起来好像出了什么问题 1/1 d0b19e04e5a1f8a5507d8ca427362b23807103ca.php第23行中的FatalErrorException: 找不到类“Form” 在d0b19e04e5a1f8a5507d8ca427362b23807103ca.php第23行中 这是我的公司Forms 拉威尔5.4级';表格';找不到,forms,laravel,Forms,Laravel,我面临的问题是“类”表单“未找到”我目前正在使用laravel 5.4。我已经尽了最大的努力来解决这个问题 谢谢 错误是:哎呀,看起来好像出了什么问题 1/1 d0b19e04e5a1f8a5507d8ca427362b23807103ca.php第23行中的FatalErrorException: 找不到类“Form” 在d0b19e04e5a1f8a5507d8ca427362b23807103ca.php第23行中 这是我的公司 { "require": { "php
{
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.4.*",
"laravel/tinker": "~1.0",
"laravelcollective/html": "^5.4"
},
}
我运行composer update命令
这是我的app.php
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
'Collective\Html\HtmlServiceProvider',
/*
* Package Service Providers...
*/
Laravel\Tinker\TinkerServiceProvider::class,
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => [
'App' => Illuminate\Support\Facades\App::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
'Bus' => Illuminate\Support\Facades\Bus::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
'Notification' => Illuminate\Support\Facades\Notification::class,
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
'Redis' => Illuminate\Support\Facades\Redis::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
'Schema' => Illuminate\Support\Facades\Schema::class,
'Session' => Illuminate\Support\Facades\Session::class,
'Storage' => Illuminate\Support\Facades\Storage::class,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'FORM' => 'Collective\Html\FormFacade',
'HTML' => 'Collective\Html\HtmlFacade',
],
];
在formupload.blade.php中使用表单
@if(isset($success))
<div class="alert alert-success"> {{$success}} </div>
@endif
{!! Form::open(['action'=>'ImageController@store', 'files'=>true]) !!}
<div class="form-group">
{!! Form::label('title', 'Title:') !!}
{!! Form::text('title', null, ['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('description', 'Description:') !!}
{!! Form::textarea('description', null, ['class'=>'form-control', 'rows'=>5] ) !!}
</div>
<div class="form-group">
{!! Form::label('image', 'Choose an image') !!}
{!! Form::file('image') !!}
</div>
<div class="form-group">
{!! Form::submit('Save', array( 'class'=>'btn btn-danger form-control' )) !!}
</div>
{!! Form::close() !!}
<div class="alert-warning">
@foreach( $errors->all() as $error )
<br> {{ $error }}
@endforeach
</div>
</div>
@if(isset($success))
{{$success}
@恩迪夫
{!!Form::open(['action'=>'ImageController@store“,”文件“=>true])!!}
{!!Form::label('title','title:')
{!!Form::text('title',null,['class'=>'Form-control'])
{!!Form::label('description','description:')
{!!Form::textarea('description',null,['class'=>'Form-control','rows'=>5])
{!!Form::label('图像','选择图像')
{!!Form::file('image')!!}
{!!表单::提交('Save',数组('class'=>'btn-btn-danger-Form-control'))
{!!Form::close()!!}
@foreach($errors->all()作为$error)
{{$error}}
@endforeach
看起来您在app.php中将表单类的别名设置为“Form”:
'FORM'=>'Collective\Html\FormFacade',
尝试将其更改为表单
,如下所示:
'Form'=>'Collective\Html\FormFacade',
那么它应该可以工作了把它放在composer.json中
"require": {
"laravelcollective/html": "^5.4"
},
跑
composer update
事后指挥
或
然后将其添加到config/app.php的providers部分数组中
Collective\Html\HtmlServiceProvider::class,
然后在别名数组中的config/app.php中添加两个类别名
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
运行命令
composer require laravelcollective/html
当编写器更新时,需要html laravel集合
然后将这两行添加到config/app.php的“别名”=>[],
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
然后将该行添加到config/app.php“提供者”=>[],并保存文件
Collective\Html\HtmlServiceProvider::class,
运行命令
composer require laravelcollective/html
将这两行添加到config/app.php的
“别名”=>[],
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
将该行添加到config/app.php中
'providers'=>[]
,然后保存文件
Collective\Html\HtmlServiceProvider::class,
这也适用于
config/app.php
'Form' => 'Collective\Html\FormFacade',
这对我有用请展示这些“最大努力”的可能副本,首先展示一些代码和预期结果看看这个Hello R.Manzarei先生这个链接只适用于5.3版本我目前使用的是laravelHi@Shogunivar的5.4.17版本我添加了“require”:{“laravelcollective/html”:“^5.4”},对于composer.json,在app.php中添加“providers”=>[“Collective\Html\HtmlServiceProvider”,]&添加别名“FORM”=>“Collective\Html\FormFacade”,“Html”=>“Collective\Html\HtmlFacade”,并在cmdHi@Shogunivar中运行composer update命令,感谢您给了我正确的答案。是的,很好用。这是正确的答案。再次感谢你的帮助。
'Form' => 'Collective\Html\FormFacade',