Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| AddressSearchResource | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| toArray | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Domain\Address\Resources; |
| 4 | |
| 5 | use App\Models\Transferable\Transferable; |
| 6 | use Domain\Address\Services\AddressHierarchyService; |
| 7 | use Illuminate\Http\Request; |
| 8 | use Illuminate\Http\Resources\Json\JsonResource; |
| 9 | use Illuminate\Support\Collection; |
| 10 | |
| 11 | /** |
| 12 | * @property int $id |
| 13 | * @property string $name |
| 14 | * @property int $children_count |
| 15 | * @property string $hierarquia |
| 16 | */ |
| 17 | class AddressSearchResource extends JsonResource |
| 18 | { |
| 19 | public function toArray(Request $request): array |
| 20 | { |
| 21 | return [ |
| 22 | 'id' => $this->id, |
| 23 | 'name' => trim($this->name), |
| 24 | 'children_count' => $this->children_count, |
| 25 | 'hierarchy' => $this->hierarquia, |
| 26 | ]; |
| 27 | } |
| 28 | } |