laravel / pennant

A simple, lightweight library for managing feature flags.
https://laravel.com/docs/pennant
MIT License
478 stars 49 forks source link

Is there a way to use a custom model or an event that allows me to add extra data to the table? #100

Closed nelson6e65 closed 6 months ago

nelson6e65 commented 6 months ago

For example, I use UUID for my migrations to sync some tables to Firebase but stored ID is empty, obviously.

Schema::create('global_features', function (Blueprint $table) {
    $table->uuid('id')->primary();
    $table->string('name');
    $table->string('scope');
    $table->text('value');
    $table->timestamps();

    $table->unique(['name', 'scope']);
});

I need to add the id in the model on database creating event.

Or should I create a custom Driver? 🤔

driesvints commented 6 months ago

Hi there, right now there's no way to overwrite the this in the database driver of pennant. You should indeed ship your own driver if you wish to achieve this. This can possible easily be done by overwriting Pennant's database driver and then only overwriting the methods that you need to adjust.