first&last
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ActivityLogResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'user' => $this->user?->name,
|
||||
'action' => $this->action,
|
||||
'entity' => class_basename($this->model_type),
|
||||
'model_id' => $this->model_id,
|
||||
'description' => $this->description,
|
||||
'ip_address' => $this->ip_address,
|
||||
'created_at' => $this->created_at?->toDateTimeString(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ServiceRequestResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'ticket_number' => $this->ticket_number,
|
||||
'title' => $this->title,
|
||||
'description' => $this->description,
|
||||
'type' => $this->type?->name,
|
||||
'priority' => $this->priority?->name,
|
||||
'priority_color' => $this->priority?->color_hex,
|
||||
'status' => $this->status?->name,
|
||||
'status_slug' => $this->status?->slug,
|
||||
'status_color' => $this->status?->color_hex,
|
||||
'client' => $this->client?->name,
|
||||
'assignee' => $this->assignee?->name,
|
||||
'deadline_at' => $this->deadline_at?->toDateTimeString(),
|
||||
'created_at' => $this->created_at?->toDateTimeString(),
|
||||
'updated_at' => $this->updated_at?->toDateTimeString(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class UserResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'email' => $this->email,
|
||||
'role' => $this->role?->value,
|
||||
'role_label' => $this->role?->label(),
|
||||
'phone' => $this->phone,
|
||||
'department' => $this->department?->name,
|
||||
'is_active' => $this->is_active,
|
||||
'last_login_at' => $this->last_login_at?->toDateTimeString(),
|
||||
'created_at' => $this->created_at?->toDateTimeString(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user