1 | <?php |
||
12 | class Discussion extends UuidModel |
||
13 | { |
||
14 | use BelongsToMinistryTrait; |
||
15 | use CommentableTrait; |
||
16 | use ImageableTrait; |
||
17 | use StorageTrait; |
||
18 | use TitleTrait; |
||
19 | |||
20 | protected $table = 'fg_discussions'; |
||
21 | |||
22 | /** |
||
23 | * Relates this discussion to models using it. |
||
24 | * |
||
25 | * @return \Illuminate\Database\Eloquent\Relations\MorphTo |
||
26 | */ |
||
27 | public function discussable() |
||
31 | |||
32 | /** |
||
33 | * The directory name for the folder holding images. |
||
34 | * |
||
35 | * @return string |
||
36 | */ |
||
37 | public function filesDir() |
||
41 | |||
42 | /** |
||
43 | * The name(s) of image(s). |
||
44 | * |
||
45 | * @return mixed |
||
46 | */ |
||
47 | public function getFileName() |
||
53 | |||
54 | /** |
||
55 | * The dimensions the discussion images has. |
||
56 | * |
||
57 | * @return array |
||
58 | */ |
||
59 | public function getImageDimensions() |
||
63 | |||
64 | /** |
||
65 | * Returns only approved discussions if being called from the app API. |
||
66 | * |
||
67 | * @param $query |
||
68 | * |
||
69 | * @return mixed |
||
70 | */ |
||
71 | public function scopeApproved($query) |
||
79 | } |
||
80 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: