25 lines
858 B
PHP
25 lines
858 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources\Incidents;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class IncidentAnalysisStudentResource extends JsonResource
|
|
{
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'student_id' => $this->resource['student_id'] ?? null,
|
|
'student_name' => $this->resource['student_name'] ?? null,
|
|
'grade' => $this->resource['grade'] ?? null,
|
|
'total' => (int) ($this->resource['total'] ?? 0),
|
|
'open' => (int) ($this->resource['open'] ?? 0),
|
|
'closed' => (int) ($this->resource['closed'] ?? 0),
|
|
'canceled' => (int) ($this->resource['canceled'] ?? 0),
|
|
'last_incident' => $this->resource['last_incident'] ?? null,
|
|
'logs' => $this->resource['logs'] ?? [],
|
|
];
|
|
}
|
|
}
|