Replies: 9 comments 2 replies
-
|
The model() method is normally used to create a form linked to a model, but it looks like you are trying to use it without providing a form name. This may result in the creation of a Spatie\Html\Html object instead of a string. try this {!! html()->model($employee)->open() !!} |
Beta Was this translation helpful? Give feedback.
-
|
I'm sure there must be a better way, but so far I'm able to get away with this: |
Beta Was this translation helpful? Give feedback.
-
|
I am facing this problem too. The documentation seems confused about this. |
Beta Was this translation helpful? Give feedback.
-
|
same here. laravel 11 forcing this. specifically i need a version of the laravelcollective setModel method to add the model to an already-opened form. |
Beta Was this translation helpful? Give feedback.
-
|
The documentation seems to be wrong. @charlesbulger @imhugos @Ohene You need to do, on blade: {{ html()->form(...)->open() }}THEN @php html()->model($yourModel); @endphpThis solves. then continue with the inputs and The problem seems to occur when you use {{ }} or {!! !!}, this behind the scenes is an "echo/print" so it will try to print/echo the |
Beta Was this translation helpful? Give feedback.
-
|
The current repository has the issue tracker disabled, it took me a fair bit of searching to find this thread :( This is most definitely an issue, the example in the first page of documentation is dying with a critical Type error: I think it would make the most sense if the form would be accepting a model: @freekmurze if you agree I could attempt a PR to add the method to Form, even though it's quite a big change. I don't see another option without a BC break. |
Beta Was this translation helpful? Give feedback.
-
I asked myself the exactly same |
Beta Was this translation helpful? Give feedback.
-
|
htmlspecialchars(): Argument #1 ($string) must be of type string, array given {{Number::currency($item['unit_amount'], 'EGP') }} - {{$item['quantity']}} + {{Number::currency($item['total_amount'], 'EGP') }} <button wire:click='removeItem({{$item['product_id']}})' class="bg-slate-300 border-2 border-slate-400 rounded-lg px-3 py-1 hover:bg-red-500 hover:text-white hover:border-red-700">Remove @empty No items Available in Cart! @endforelse |
Beta Was this translation helpful? Give feedback.
-
|
For the record, this has worked fine for us for years: |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I am new to Spatie/laravel-html and I have encountered this error.
htmlspecialchars(): Argument #1 ($string) must be of type string, Spatie\Html\Html given
This happens when I call:
{{ html()->model($employee) }}
{{ html()->input('name') }}
Detail error display:
C:\xampp\htdocs\project\vendor\laravel\framework\src\Illuminate\Support\helpers.php : 124
htmlspecialchars
Can someone help know what I am doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions