1 | <?php |
||
10 | trait RecordsActivity |
||
11 | { |
||
12 | /** |
||
13 | * Boot the trait. |
||
14 | */ |
||
15 | protected static function bootRecordsActivity() |
||
26 | |||
27 | /** |
||
28 | * Fetch all model events that require activity recording. |
||
29 | * |
||
30 | * @return array |
||
31 | */ |
||
32 | protected static function getActivitiesToRecord() |
||
36 | |||
37 | /** |
||
38 | * Record new activity for the model. |
||
39 | * |
||
40 | * @param string $event |
||
41 | */ |
||
42 | protected function recordActivity($event) |
||
49 | |||
50 | /** |
||
51 | * Fetch the activity relationship. |
||
52 | * |
||
53 | * @return \Illuminate\Database\Eloquent\Relations\MorphMany |
||
54 | */ |
||
55 | public function activity() |
||
59 | |||
60 | /** |
||
61 | * Determine the activity type. |
||
62 | * |
||
63 | * @param string $event |
||
64 | * @return string |
||
65 | */ |
||
66 | protected function getActivityType($event) |
||
72 | } |
||
73 |
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: