In this part, we will create a Blade component for Select2 and will use it for selecting questions for a quiz.

So, first let's create the component and add scripts...
In this part, we will create a Blade component for Select2 and will use it for selecting questions for a quiz.

So, first let's create the component and add scripts...
If you are working with Livewire 3 must replace the event livewire:load by livewire:init
Hello I am having an erro "trim(): Argument #1 ($string) must be of type string, array given"
select-list-blade file
quiz-form.blade file
what can i do to fix this error?
select-list-blade file - https://prnt.sc/oSt058CovRWc
quiz-form.blade file - https://prnt.sc/GcAHvqV9pN19
@PedroSMaia it's a very wierd error that only some people get. How does your
app/View/Components/SelectList.phplook? But adding props options to the component should fix error.@Nerijus my app/View/Components/SelectList.php print is on the link bellow https://prnt.sc/t9u0HSGJP8-4
Sorry wrong file, I meant
app/Http/View/Components/SelectList.php. But have you tried adding props for options to the blade file?Hi again, my file app/Http/View/Components/SelectList.php is in the printscreen bellow https://prnt.sc/FGPNaXeOQyJt
i don't understand what do you say about props
Your
SelectList.phpis different from the in this tutorial.@PedroSMaia, you are missing parameters inside construct method of Selectlist.php
i have the same error as @PedroSMaia, i added this inside my SelectList.php:
public function __construct(public mixed $options)
and now a different error occurs:
"Unresolvable dependency resolving Parameter #0 mixed $options in class App\View\Components\SelectList"
help anyone?
i just solved my problem. i ran the following command:
php artisan optimize:clear
seems like its a caching issue