| Conditions | 2 | 
| Paths | 2 | 
| Total Lines | 25 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php | ||
| 19 | public function toArray($request) | ||
| 20 |     { | ||
| 21 |         if ($is_admin = Str::of($this->discussable_type)->contains('Ministry')) { | ||
| 22 | $avatar = | ||
| 23 |                 ImageHelper::getImage('profile', $this->discussable->image, config('faithgen-sdk.ministries-server')); | ||
| 24 |         } else { | ||
| 25 |             $avatar = ImageHelper::getImage('users', $this->discussable->image, config('faithgen-sdk.users-server')); | ||
| 26 | } | ||
| 27 | |||
| 28 | return [ | ||
| 29 | 'id' => $this->id, | ||
| 30 | 'title' => $this->title, | ||
| 31 | 'approved' => (bool) $this->approved, | ||
| 32 | 'comments' => [ | ||
| 33 | 'count' => $this->comments_count, | ||
| 34 | ], | ||
| 35 | 'creator' => [ | ||
| 36 | 'id' => $this->discussable_id, | ||
| 37 | 'name' => $this->discussable->name, | ||
| 38 | 'is_admin' => $is_admin, | ||
| 39 | 'avatar' => $avatar, | ||
| 40 | ], | ||
| 41 | 'date' => Helper::getDates($this->created_at), | ||
| 42 | ]; | ||
| 43 | } | ||
| 44 | } | ||
| 45 |