src/Traits/Attributable.php
public static function bootAttributable()
    {
        $models = array_merge([static::class], array_values(class_parents(static::class)));
        $attributes = DB::table(config('rinvex.attributable.tables.attribute_entity'))->whereIn('entity_type', $models)->get()->pluck('attribute_id');
        static::$entityAttributes = Attribute::whereIn('id', $attributes)->get()->keyBy('slug');

        static::addGlobalScope(new EagerLoadScope());

        static::saved(EntityWasSaved::class.'@handle');
        static::deleted(EntityWasDeleted::class.'@handle');
    }
public static function bootAttributable()
    {
        $models = array_merge([static::class], array_values(class_parents(static::class)));
        $attributes = DB::table(config('rinvex.attributable.tables.attribute_entity'))->whereIn('entity_type', $models)->get()->pluck('attribute_id');
        static::$entityAttributes = Attribute::whereIn('id', $attributes)->get()->keyBy('slug');

        static::addGlobalScope(new EagerLoadScope());

        static::saved(EntityWasSaved::class.'@handle');
        static::deleted(EntityWasDeleted::class.'@handle');
    }
public static function bootAttributable ( ) { $ models = array_merge ( [ static :: class ] , array_values ( class_parents ( static :: class ) ) ) ; $ attributes = DB :: table ( config ( 'rinvex.attributable.tables.attribute_entity' ) ) -> whereIn ( 'entity_type' , $ models ) -> get ( ) -> pluck ( 'attribute_id' ) ; static :: $ entityAttributes = Attribute :: whereIn ( 'id' , $ attributes ) -> get ( ) -> keyBy ( 'slug' ) ; static :: addGlobalScope ( new EagerLoadScope ( ) ) ; static :: saved ( EntityWasSaved :: class . '@handle' ) ; static :: deleted ( EntityWasDeleted :: class . '@handle' ) ; }
Boot the attributable trait for a model.

@return void
Boot the attributable trait for a model .