I am using session to build my codebase and using the following way to open my form:
<div class="row">
<div class="col-12">
{!! Form::open(['name' => 'name_val', 'id' =>'id_val', 'method' => 'post', 'files' => true]) !!}
<-My form code here->
{!! Form::close() !!}
and I am getting an error saying:
Class "Form" not found
What possibly could be going wrong? I have also tried to use:
Form::Model
But the issue still persists. I am new to Laravel. Any help is appreciated.
2
Answers
The above code runs with normal HTML form tags
<form> your code here </form>
with all relevant parameters.
I believe the recommended way for Laravel to use form since Laravel 5/6 and later is to use the blade directives with HTML syntax to create forms.
The
Form::model
method that you’re trying to use is from the LaravelCollective which hasn’t been updated for awhile. Most likely it wouldn’t be part of your package in Laravel 7.1. Not sure if you’re referencing it from some older guides while learning.You can see some examples of the blade directives with HTML syntax here: https://laravel.com/docs/7.x/blade#forms