rinvex / laravel-attributes

⚠️ [ABANDONED] Rinvex Attributable is a robust, intelligent, and integrated Entity-Attribute-Value model (EAV) implementation for Laravel Eloquent, with powerful underlying for managing entity attributes implicitly as relations with ease. It utilizes the power of Laravel Eloquent, with smooth and seamless integration.
MIT License
433 stars 104 forks source link

Where's the best place to register attributes? #133

Closed jakubmikita closed 3 years ago

jakubmikita commented 3 years ago

I couldn't find this info anywhere.

Doing app('rinvex.attributes.attribute')->create() in the Service Provider boot method results in creating another entry in the database.

Would the Seeder be an appropriate place to do it?

Omranic commented 3 years ago

@Kubitomakita than you for your question, think of this as any normal model, which you need to create instances of pinky intentionally when required.

Short answer is: Seeder, or controller, whichever better for you, but absolutely not service provider.

Seeders & controllers are executed on your demand, but service provider is being executed in every single request to your app.