#Refreshing a component in Livewire v3.

1 messages · Page 1 of 1 (latest)

untold herald
#

I am trying to refresh a livewire component after I added something to the database.

In Livewire v2 I used the following code:

public function addListColumn()
{
    $board_id = DB::table('boards')->where('slug',$this->board->slug)->first()->id;
    $position = DB::table('listcolumns')->where('board_id',$board_id)->get()->max('position') + 1;

    $listColumn = new Listcolumn;
    $listColumn->uuid = Str::uuid();
    $listColumn->title = $this->title;
    $listColumn->position = $position;
    $listColumn->board_id = $board_id;
    $listColumn->save();

    $this->emit('refreshComponent');
}

This code doesn't work in Livewire v3 anymore.
Does anyone have any tips for me how to refresh the component?
(If I forgot to add some information that is needed, let me know.)

Thanks in advance.

Got it working. Thanks for the help

jagged prawn