How do i call different component action?

What seems to be the problem: Problem is i have livewire table installed and now i want to click on edit to open edit form but i don’t understand how should i do it ?

Steps to Reproduce:
Install Livewire datatable and then in action buttons click on edit and delete method from different component.

Are you using the latest version of Livewire: Yes

Do you have any screenshots or code examples: Yes
Here is my table action buttons

edit and delete method are in DomainForm component


I want to have access edit and delete method from DomainForm to DomainTable component.

You will want to emit an event from your table-actions.blade.php file. Something like:

wire:click="$emit('edit', {{ $id }})"

Also define a $listeners property in any component you want to react to the edit event. The key is the event name and the value is the function to execute when the event is fired.

protected $listeners = ['edit'];

If you don’t specify a value, then Livewire assumes there will be a corresponding method in your component with the same name.

public function edit($id)
{
  // do whatever it is you need here
}

You can also scope events to only specific components, check the docs for more on events.

Can you please tell me what do i have to put in this method

public function edit($id)
{
  // do whatever it is you need here
}

To Redirect to my from domain-form ???

Alright, so i made it work like this

public function edit($id)
 {
      return redirect()->route('super_admin.domain.edit',$id);
}

This is how i defined my routes

Route::group([
        'as'         => 'domain.',
    ],function(){
        Route::get('listing',[\App\Http\Controllers\SuperAdmin\SADomainsController::class,'listing'])->name('listing');
        Route::get('create',[\App\Http\Controllers\SuperAdmin\SADomainsController::class,'showForm'])->name('create');
        Route::get('edit/{id}',[\App\Http\Controllers\SuperAdmin\SADomainsController::class,'showForm'])->name('edit');
    });

This way my listing and forms will be in separate components, i don’t want to keep my form and table listing into single blade file that’s why i had to redirect from domain listing to domain form.

Thank you for your time.

Now the issue is values in the form are not populating automatically.
In simple words i want to keep ALL CRUD in one file and Listing on another file, also blade-wise.

Is your showForm method in your SADomainsController getting your model correctly?