Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
12 / 12 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| AdministratorResource | |
100.00% |
12 / 12 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| toArray | |
100.00% |
12 / 12 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Resources; |
| 4 | |
| 5 | use Illuminate\Http\Request; |
| 6 | use Illuminate\Http\Resources\Json\JsonResource; |
| 7 | |
| 8 | class AdministratorResource extends JsonResource |
| 9 | { |
| 10 | public function toArray(Request $request): array |
| 11 | { |
| 12 | return [ |
| 13 | 'id' => $this->id, |
| 14 | 'name' => $this->name, |
| 15 | 'address' => $this->address, |
| 16 | 'postal_code' => $this->postal_code, |
| 17 | 'city' => $this->city, |
| 18 | 'province' => $this->province, |
| 19 | 'email' => $this->email, |
| 20 | 'phone' => $this->phone, |
| 21 | 'assigned_commercial_id' => $this->assigned_commercial_id, |
| 22 | 'assigned_commercial' => $this->whenLoaded('assignedCommercial'), |
| 23 | ]; |
| 24 | } |
| 25 | } |