Files
sirpremiumv2/app/Http/Livewire/ShowLogGeneral.php
T
2023-11-07 22:43:10 +00:00

34 lines
688 B
PHP
Executable File

<?php
namespace App\Http\Livewire;
use App\Models\Log_general;
use Livewire\Component;
class ShowLogGeneral extends Component
{
public $entradas;
public $buscar;
public $filtro_fecha;
public function render()
{
$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
]);
}
}