What seems to be the problem:
hi, i’m doing a simple search. but I can’t make it happen, please help
It seems that it does not reach the component, to make the query and return the values. I already tried everything that I miss
Steps to Reproduce:
public $buscar_usuario;
public function render()
{
$data = Ticket::orWhere('prioridad', 'LIKE', "%{$this->search}%")
->orWhere('estado', 'LIKE', "%{$this->search}%")
->orWhere('descripcion', 'LIKE', "%{$this->search}%")
// ->orderByRaw("FIELD(estado, 'Abierto') DESC")
->orderBy('id', 'DESC')
->paginate(20);
$proyectos = Proyecto::all();
$users = User::all();
$buscar_usuario = '%' . $this->buscar_usuario . '%';
$b_users = User::where('name', 'like', $buscar_usuario)->paginate(10);
return view('tickets.ticket-component', compact('data', 'proyectos','users', 'b_users'));
}
in blade:
@if($b_users != NULL)
<div class="flex flex-col">
@foreach($b_users as $usuario)
<div class="py-2 pl-2 cursor-pointer hover:bg-green-300" @click="ackif='{{$usuario->id}}', secim='{{ $usuario->name }}', acik=false, $wire.usuario_atender_id=ackif">
{{ $usuario->name }}
</div>
@endforeach
</div>
{{ $b_users->links()}}
@else
<div class="bg-white px-4 py-3 text-gray-500 border-t border-gray-200 sm:px-6">
No hay resultados para la busqueda
</div>
@endif
Are you using the latest version of Livewire:
Do you have any screenshots or code examples: