TrOnNe
TrOnNe

Reputation: 1772

Laravel Form::open issue with url()

I'm trying to make this work:

{!! Form::open(['action' => 'url('/user')', 'class' => 'class2', 'method' => 'GET']) !!} 

But I'm having errors, I get that the code was expecting a proper close ")"

Then I tried 'url("/user")' but it says:

Action App\Http\Controllers\url("/user") not defined

Of course if I do dd(url('/user')) works correctly

Any idea?

Thanks

Upvotes: 1

Views: 1407

Answers (1)

Alexey Mezenin
Alexey Mezenin

Reputation: 163898

Use url instead of action:

{!! Form::open(['url' => url('/user'), 'class' => 'class2', 'method' => 'GET']) !!}

You should use action only for actions, like:

{!! Form::open(['action' => 'HomeController@index', 'class' => 'class2', 'method' => 'GET']) !!}

https://laravelcollective.com/docs/5.4/html#opening-a-form

Upvotes: 1

Related Questions