File manager - Edit - /var/www/html/portalHomolog/app/Http/Services/IndicadoresTi/GerenciarClientesService.php
Back
<?php namespace App\Http\Services\IndicadoresTi; use App\Models\IndicadoresTi\Cliente; use Illuminate\Contracts\Pagination\LengthAwarePaginator; class GerenciarClientesService { public function listar(string $busca = ''): LengthAwarePaginator { return Cliente::when($busca, function ($q) use ($busca) { $t = '%' . mb_strtolower($busca) . '%'; $q->whereRaw('LOWER(nome) LIKE ?', [$t]) ->orWhereRaw('LOWER(cpf) LIKE ?', [$t]) ->orWhereRaw('LOWER(matricula) LIKE ?', [$t]) ->orWhereRaw('LOWER(setor) LIKE ?', [$t]); }) ->orderBy('nome') ->paginate(20) ->withQueryString(); } public function criar(array $dados): Cliente { return Cliente::create($dados); } public function atualizar(Cliente $cliente, array $dados): void { $cliente->update($dados); } public function excluir(Cliente $cliente): bool { if ($cliente->chamados()->exists()) { return false; } $cliente->delete(); return true; } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings