akubiczek /
applicake-backend
| 1 | <?php |
||
| 2 | |||
| 3 | namespace App\Http\Resources; |
||
| 4 | |||
| 5 | use App\Utils\PhoneFormatter; |
||
| 6 | use Illuminate\Http\Resources\Json\JsonResource; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * Class TruncatedCandidateResource |
||
| 10 | * This is a lite version of CandidateResource using when returning collection (to speed things up). |
||
| 11 | */ |
||
| 12 | class TruncatedCandidateResource extends JsonResource |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * Transform the resource into an array. |
||
| 16 | * |
||
| 17 | * @param \Illuminate\Http\Request $request |
||
| 18 | * |
||
| 19 | * @return array |
||
| 20 | */ |
||
| 21 | public function toArray($request) |
||
| 22 | { |
||
| 23 | $array = [ |
||
| 24 | 'id' => $this->id, |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 25 | 'created_at' => $this->created_at, |
||
|
0 ignored issues
–
show
The property
created_at does not exist on App\Http\Resources\TruncatedCandidateResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||
| 26 | 'name' => $this->name, |
||
|
0 ignored issues
–
show
The property
name does not exist on App\Http\Resources\TruncatedCandidateResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||
| 27 | 'email' => $this->email, |
||
|
0 ignored issues
–
show
The property
email does not exist on App\Http\Resources\TruncatedCandidateResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||
| 28 | 'phone_number' => PhoneFormatter::format($this->phone_number), |
||
|
0 ignored issues
–
show
The property
phone_number does not exist on App\Http\Resources\TruncatedCandidateResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||
| 29 | 'photo_path' => $this->photo_path ? env('AVATARS_URL').'/'.$this->photo_path : null, |
||
|
0 ignored issues
–
show
The property
photo_path does not exist on App\Http\Resources\TruncatedCandidateResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||
| 30 | 'recruitment_id' => $this->recruitment_id, |
||
|
0 ignored issues
–
show
The property
recruitment_id does not exist on App\Http\Resources\TruncatedCandidateResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||
| 31 | 'stage_id' => $this->stage_id, |
||
|
0 ignored issues
–
show
The property
stage_id does not exist on App\Http\Resources\TruncatedCandidateResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||
| 32 | 'seen_at' => $this->seen_at, |
||
|
0 ignored issues
–
show
The property
seen_at does not exist on App\Http\Resources\TruncatedCandidateResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||
| 33 | 'rate' => $this->rate, |
||
|
0 ignored issues
–
show
The property
rate does not exist on App\Http\Resources\TruncatedCandidateResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||
| 34 | 'recruitment' => $this->recruitment, |
||
|
0 ignored issues
–
show
The property
recruitment does not exist on App\Http\Resources\TruncatedCandidateResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||
| 35 | 'stage' => $this->stage, |
||
|
0 ignored issues
–
show
The property
stage does not exist on App\Http\Resources\TruncatedCandidateResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||
| 36 | ]; |
||
| 37 | |||
| 38 | unset($array['stage']['created_at']); |
||
| 39 | unset($array['stage']['updated_at']); |
||
| 40 | unset($array['stage']['recruitment_id']); |
||
| 41 | unset($array['recruitment']['created_at']); |
||
| 42 | unset($array['recruitment']['updated_at']); |
||
| 43 | unset($array['recruitment']['deleted_at']); |
||
| 44 | unset($array['recruitment']['is_draft']); |
||
| 45 | unset($array['recruitment']['notification_email']); |
||
| 46 | |||
| 47 | return $array; |
||
| 48 | } |
||
| 49 | } |
||
| 50 |