• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

504
Vistas
How to refresh livewire component on difference Route or Page?

i have 2 livewire component on difference route :

route : ../find/add

class Preview extends Component
{

    public $rabId;

    public function render()
    {
        $rab = Rab::find($this->rabId);

        return view('livewire.rab.preview', [
            'rab' => $rab,
        ]);
    }


    public function sendFinanceData(int $rabId)
    {
    
        $rab = Rab::find($rabId);

        ModelRabStatus::updateOrCreate([
            'rab_id' => $rabId,
        ], [
            'status' => RabStatus::Pending,
        ]);

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

}

and route : ../fin/list

class Index extends Component
{
    protected $listeners = [
        'sendRabToFinance' => '$refresh',
    ];

    public function render()
    {

        $pending = ModelRabStatus::whereStatus(RabStatus::Pending)->orderBy('created_at', 'asc')->paginate(10);

        $approved = ModelRabStatus::whereStatus(RabStatus::Approved)->orderBy('updated_at', 'desc')->paginate(10);

        return view('livewire.finance.f-rab.index', [
            'pending' => $pending,
            'approved' => $approved,
        ]);
}

}

i want to refresh Index component when i click wire:click="sendFinanceData{{$id}}" but it doesn't work using magic $refresh. Any reference how to refresh the component on a different route or page?

almost 3 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda