Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| RouteResource | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| toArray | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Resources; |
| 4 | |
| 5 | use Illuminate\Http\Request; |
| 6 | use Illuminate\Http\Resources\Json\JsonResource; |
| 7 | |
| 8 | class RouteResource extends JsonResource |
| 9 | { |
| 10 | /** |
| 11 | * Transform the resource into an array. |
| 12 | * |
| 13 | * @return array<string, mixed> |
| 14 | */ |
| 15 | public function toArray(Request $request): array |
| 16 | { |
| 17 | return [ |
| 18 | 'id' => $this->id, |
| 19 | 'feed_id' => $this->feed_id, |
| 20 | 'platform_channel_id' => $this->platform_channel_id, |
| 21 | 'is_active' => $this->is_active, |
| 22 | 'priority' => $this->priority, |
| 23 | 'created_at' => $this->created_at->toISOString(), |
| 24 | 'updated_at' => $this->updated_at->toISOString(), |
| 25 | 'feed' => new FeedResource($this->whenLoaded('feed')), |
| 26 | 'platform_channel' => new PlatformChannelResource($this->whenLoaded('platformChannel')), |
| 27 | ]; |
| 28 | } |
| 29 | } |