File manager - Edit - /var/www/html/portalHomolog/app/Http/Resources/Cultura/ArteSacra/LogResource.php
Back
<?php namespace App\Http\Resources\Cultura\ArteSacra; use App\Models\User; class LogResource { public static function parseLinha(string $line): ?array { preg_match('/\[(.*?)\] (\w+)\.(\w+): (.*?) ({.*})/', $line, $matches); if (!$matches) { return null; } $contexto = json_decode($matches[5], true) ?? []; return [ 'data' => $matches[1], 'canal' => $matches[2], 'nivel' => $matches[3], 'mensagem' => $matches[4], 'contexto' => $contexto, 'modulo' => $contexto['modulo'] ?? 'ARTE-SACRA', 'user_id' => $contexto['user_id'] ?? null, ]; } public static function pertenceAoModulo(array $log, string $modulo): bool { return ($log['modulo'] ?? null) === $modulo; } public static function atendeBusca(array $log, ?string $busca, ?User $usuario): bool { if (!$busca) { return true; } $haystack = strtolower( $log['data'] . ' ' . $log['mensagem'] . ' ' . ($usuario->firstName ?? '') . ' ' . ($usuario->lastName ?? '') . ' ' . ($usuario->email ?? '') . ' ' . ($log['contexto']['codigo'] ?? '') . ' ' . $log['modulo'] ); return collect(explode(' ', strtolower($busca))) ->every(fn($p) => str_contains($haystack, $p)); } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings