37 lines
		
	
	
		
			977 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			977 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| declare(strict_types=1);
 | |
| 
 | |
| namespace App\Http\Resources;
 | |
| 
 | |
| use Illuminate\Http\Resources\Json\JsonResource;
 | |
| 
 | |
| class CVResource extends JsonResource
 | |
| {
 | |
|     public static $wrap = null;
 | |
| 
 | |
|     public function toArray($request): array
 | |
|     {
 | |
|         return [
 | |
|             'token' => $this->token,
 | |
|             'email' => $this->email,
 | |
|             'phoneNumber' => $this->phoneNumber,
 | |
|             'formattedPhoneNumber' => $this->formattedPhoneNumber,
 | |
|             'phone' => new PhoneResource($this->resource),
 | |
|             'locations' => $this->locations,
 | |
|             'mission' => $this->when(
 | |
|                 !is_null($this->mission),
 | |
|                 fn (): array => explode(PHP_EOL, $this->mission, 5)
 | |
|             ),
 | |
|             'rodo' => $this->when(
 | |
|                 !is_null($this->rodo),
 | |
|                 $this->rodo
 | |
|             ),
 | |
|             'position' => $this->when(
 | |
|                 !is_null($this->position),
 | |
|                 $this->position
 | |
|             ),
 | |
|         ];
 | |
|     }
 | |
| }
 |