| Conditions | 2 |
| Paths | 2 |
| Total Lines | 22 |
| 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 | 'creator' => [ |
||
| 33 | 'id' => $this->discussable_id, |
||
| 34 | 'name' => $this->discussable->name, |
||
| 35 | 'is_admin' => $is_admin, |
||
| 36 | 'avatar' => $avatar, |
||
| 37 | ], |
||
| 38 | 'date' => Helper::getDates($this->created_at), |
||
| 39 | ]; |
||
| 40 | } |
||
| 41 | } |
||
| 42 |