'Laravel MorphPivot model deleting event doesnt supply all model attributes

I have a typical many-to-many polymorphic relationship for categories.

Category => Categorizable => Webpage
                          => Bookpage

I am listening to the "deleting" model event from the Categorizable MorphPivot model and for some reason, I am not able to access the "categorizable_type" attribute from the categorizable model. Only the category_id and the categorizable_id is available in the attributes. This is also true for the "deleted" model event. I can see the attribute for all other model events. How can I access the categorizable_type?

class Categorizable extends MorphPivot {
    protected $table = 'categorizables';
    protected $primaryKey = null;
    public $incrementing = false;

    public function categorizable()
    {
        return $this->morphTo();
    }

    public function category()
    {
        return $this->belongsTo(Category::class);
    }
}
class CategorizableObserver
{
    public function deleting(Categorizable $categorizable)
    {
        // $categorizable->categorizable_type is null???
    }
class Webpage extends Model
{
    public function categories()
    {
        return $this->morphToMany(\App\Models\Category::class, 'categorizable')
            ->using(Categorizable::class)
            ->withTimestamps();
    }

screenshot



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source