| 1 | <?php |
||
| 9 | trait LogsActivity |
||
| 10 | { |
||
| 11 | use DetectsChanges; |
||
| 12 | |||
| 13 | protected static function bootLogsActivity() |
||
| 38 | |||
| 39 | public function causesActivity(): MorphTo |
||
| 43 | |||
| 44 | public function getDescriptionForEvent(string $eventName): string |
||
| 48 | |||
| 49 | /* |
||
| 50 | * Get the event names that should be recorded. |
||
| 51 | */ |
||
| 52 | protected static function eventsToBeRecorded(): array |
||
| 64 | } |
||
| 65 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idableprovides a methodequalsIdthat in turn relies on the methodgetId(). If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()as an abstract method to the trait will make sure it is available.