akubiczek /
applicake-backend
| 1 | <?php |
||
| 2 | |||
| 3 | namespace App\Http\Resources; |
||
| 4 | |||
| 5 | use App\Models\Stage; |
||
| 6 | use Illuminate\Http\Resources\Json\JsonResource; |
||
| 7 | |||
| 8 | class ActivityResource extends JsonResource |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Transform the resource into an array. |
||
| 12 | * |
||
| 13 | * @param \Illuminate\Http\Request $request |
||
| 14 | * |
||
| 15 | * @return array |
||
| 16 | */ |
||
| 17 | public function toArray($request) |
||
| 18 | { |
||
| 19 | $valueText = $this->new_value; |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 20 | if ($this->type === Stage::class) { |
||
|
0 ignored issues
–
show
The property
type does not exist on App\Http\Resources\ActivityResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||
| 21 | $valueText = Stage::find($this->new_value)->name; |
||
| 22 | } |
||
| 23 | |||
| 24 | return [ |
||
| 25 | 'created_at' => $this->created_at, |
||
|
0 ignored issues
–
show
The property
created_at does not exist on App\Http\Resources\ActivityResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||
| 26 | 'type' => $this->type, |
||
| 27 | 'prev_value' => $this->prev_value, |
||
|
0 ignored issues
–
show
The property
prev_value does not exist on App\Http\Resources\ActivityResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||
| 28 | 'new_value' => $this->new_value, |
||
| 29 | 'new_value_text' => $valueText, |
||
| 30 | 'user' => [ |
||
| 31 | 'name' => $this->user->name, |
||
|
0 ignored issues
–
show
The property
user does not exist on App\Http\Resources\ActivityResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||
| 32 | ], |
||
| 33 | ]; |
||
| 34 | } |
||
| 35 | } |
||
| 36 |