| Conditions | 1 |
| Paths | 1 |
| Total Lines | 15 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 19 | public function toArray($request): array |
||
| 20 | { |
||
| 21 | /** @var User $this */ |
||
| 22 | $posts = $this->posts() |
||
| 23 | ->orderBy($request->get('order_by', 'created_at'), $request->get('order', 'DESC')) |
||
| 24 | ->paginate($request->get('per_page', 10)); |
||
| 25 | |||
| 26 | return [ |
||
| 27 | 'id' => $this->id, |
||
| 28 | 'email' => $this->email, |
||
| 29 | 'first_name' => $this->first_name, |
||
| 30 | 'last_name' => $this->last_name, |
||
| 31 | 'username' => $this->username, |
||
| 32 | 'image' => $this->avatar_url, |
||
| 33 | 'posts' => ListPostResourceCollection::make($posts), |
||
| 34 | ]; |
||
| 37 |