filtros por detalle y fecha

This commit is contained in:
Felipe
2023-10-09 08:40:58 -05:00
parent bbe3bae7e9
commit cf362aa75f
3 changed files with 37 additions and 3 deletions
+14 -1
View File
@@ -8,10 +8,23 @@ use Livewire\Component;
class ShowLogGeneral extends Component
{
public $entradas;
public $buscar;
public $filtro_fecha;
public function render()
{
$logs = Log_general::orderby('id', 'desc')->paginate($this->entradas);
$query = Log_general::query();
if ($this->buscar) {
$query->where('detalle', 'like', '%' . $this->buscar . '%');
}
if ($this->filtro_fecha) {
$query->whereDate('created_at', $this->filtro_fecha);
}
$logs = $query->orderBy('id', 'desc')->paginate($this->entradas);
return view('livewire.show-log-general', [
'logs' => $logs