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