Skip to content

Commit

Permalink
fix: change role name for author data
Browse files Browse the repository at this point in the history
  • Loading branch information
tanhongit committed Dec 7, 2024
1 parent 5bba203 commit 53a5918
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Http/Resources/AuthorResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@ class AuthorResource extends JsonResource
public function toArray($request): array

Check failure on line 15 in src/Http/Resources/AuthorResource.php

View workflow job for this annotation

GitHub Actions / PHPStan - P8.2

Method CSlant\Blog\Api\Http\Resources\AuthorResource::toArray() return type has no value type specified in iterable type array.

Check failure on line 15 in src/Http/Resources/AuthorResource.php

View workflow job for this annotation

GitHub Actions / PHPStan - P8.3

Method CSlant\Blog\Api\Http\Resources\AuthorResource::toArray() return type has no value type specified in iterable type array.
{
/** @var User $this */

$role = $this->roles->first()->name ?? null;

Check failure on line 19 in src/Http/Resources/AuthorResource.php

View workflow job for this annotation

GitHub Actions / PHPStan - P8.2

Access to an undefined property CSlant\Blog\Core\Models\User::$roles.

Check failure on line 19 in src/Http/Resources/AuthorResource.php

View workflow job for this annotation

GitHub Actions / PHPStan - P8.3

Access to an undefined property CSlant\Blog\Core\Models\User::$roles.

return [
'id' => $this->id,

Check failure on line 22 in src/Http/Resources/AuthorResource.php

View workflow job for this annotation

GitHub Actions / PHPStan - P8.2

Access to an undefined property CSlant\Blog\Core\Models\User::$id.

Check failure on line 22 in src/Http/Resources/AuthorResource.php

View workflow job for this annotation

GitHub Actions / PHPStan - P8.3

Access to an undefined property CSlant\Blog\Core\Models\User::$id.
'first_name' => $this->first_name,

Check failure on line 23 in src/Http/Resources/AuthorResource.php

View workflow job for this annotation

GitHub Actions / PHPStan - P8.2

Access to an undefined property CSlant\Blog\Core\Models\User::$first_name.

Check failure on line 23 in src/Http/Resources/AuthorResource.php

View workflow job for this annotation

GitHub Actions / PHPStan - P8.3

Access to an undefined property CSlant\Blog\Core\Models\User::$first_name.
'last_name' => $this->last_name,
'image' => $this->avatar_url,
'roles' => $this->roles,
'role' => $role,
];
}
}

0 comments on commit 53a5918

Please sign in to comment.