Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

onurzdgn's avatar

Livewire Usage

Hello everyone, I am using Laravel 12 and livewire 3. I have an question. I use Livewire to create both creation and update components in my projects. My biggest concern is whether there's a need for two separate components. Would a single component be enough? Below are my supplier add and update components. Create livewire:

create component blade:

edit livewire:

edit blade:

0 likes
3 replies
Snapey's avatar

with Livewire, I only use one component for both create and edit. This is preferable to duplication of everything.

Start with editing an existing record, then work out what needs to be different to handle a new record.

1 like
bvfi-dev's avatar

@Snapey I would be grateful If you explained more or maybe provided a sample code If you have any links. Do you create separate public properties for creating and editing, do you use Livewire FormObjects or do you have one property exactly named as the DB name for each field? What if my Livewire Component would need to be really big and have a lot of separate functions for edit or create work, would you still use one component? Because, for example, what if you want to have a create form and an edit form at the same time? How would they be filled in simultaneously?

Jsanwo64's avatar

@bvfi-dev The same way you'd put them in a controller, you can put them in a component. Assign them to their individual function in the component.

Please or to participate in this conversation.