1234567891011121314151617181920212223242526 |
- <?php
- namespace Knuckles\Scribe\Tests\Fixtures;
- use Illuminate\Http\Resources\Json\JsonResource;
- class TestTagApiResource extends JsonResource
- {
- /**
- * Transform the resource into an array.
- *
- * @param \Illuminate\Http\Request $request
- *
- * @return array
- */
- public function toArray($request)
- {
- return [
- 'id' => $this->id,
- 'name' => $this->name ,
- 'priority' => $this->whenPivotLoaded('taggables', function () {
- return $this->pivot->priority;
- }),
- ];
- }
- }
|