add all controllers logic
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Security;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class IpBanResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
$blockedUntil = $this->resource->blocked_until ?? null;
|
||||
$isActive = $blockedUntil !== null && $blockedUntil > now('UTC');
|
||||
|
||||
return [
|
||||
'id' => $this->resource->id ?? null,
|
||||
'ip_address' => $this->resource->ip_address ?? null,
|
||||
'attempts' => $this->resource->attempts ?? 0,
|
||||
'last_attempt_at' => $this->resource->last_attempt_at ?? null,
|
||||
'blocked_until' => $blockedUntil,
|
||||
'is_active' => $isActive,
|
||||
'created_at' => $this->resource->created_at ?? null,
|
||||
'updated_at' => $this->resource->updated_at ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user