Laravel – PHPDoc for conditional polymorphic call
For $item there's a polymorphic loggable relationship. In the database this is stored in items as loggable_type and loggable_id (for PHP 8+ in and Laravel). for($items as $item) { // ... if ($item->loggable_type === Comment::class) { $item->loggable->resetDates(); } // ...…