Laravel-Backpack / Settings

Application settings interface for Backpack (for Laravel 6).
http://backpackforlaravel.com
Other
246 stars 79 forks source link

Model Class Overwrite #134

Closed hafijul233 closed 5 months ago

hafijul233 commented 6 months ago

WHY

I wanted to have more control over how settings are handled, not just the table name.

BEFORE - What was wrong? What was happening before this PR?

The Setting model that comes with package is called by setting crud controller and that was hardcoded.

AFTER - What is happening after this PR?

Now user will have more flexible options to change the model class that is called and modify or extend functionality as per project need.

HOW

How did you achieve that, in technical terms?

  1. Added a new configuration field named model.
  2. Changed value to controller setModel() method to configuration.
  3. On the SettingServiceprovider register method change alias value.

Is it a breaking change or non-breaking change?

Non-Breaking Change

How can we test the before & after?

Change the model field value on configuration file and output config values will be given model instances.

welcome[bot] commented 6 months ago

BOOM! Your first PR with us, thank you so much! Someone will take a look at it shortly.

Please keep in mind that:

Thank you!

-- Justin Case The Backpack Robot

jcastroa87 commented 6 months ago

Hi @hafijul233

Thanks a lot for this great feature, I test it, and it is working ok. I will ask @pxpm to make a final check.

Thanks again.

Cheers.

hafijul233 commented 6 months ago

@jcastroa87 I noticed that the setting model class alias it's also pointing to The Backpack Setting class. I will try testing that the Laravel alias loader can be configurable.

hafijul233 commented 5 months ago

I finalize my tweaks on the model class configurable option.

welcome[bot] commented 5 months ago

WHOOP-WHOOP! Congrats, your first PR on this repo has officialy been merged.

party

If you want to help out the community in other ways, you can:

Again. Thank you for the PR. You are a wonderful person. Keep 'em coming :-) Cheers!

-- Justin Case The Backpack Robot

P.S. Help in the Backpack community is rewarded with free Backpack commercial licenses. It's the least we can do. If you feel you've helped the community with PRs, help & other stuff, please shoot Tabacitu an email and ask him if you qualify for free licenses. You scratch my back, I scratch your back. Thank you!

pxpm commented 5 months ago

Thank you very much @hafijul233

Very clean and direct to the point, a maintainer dream of PR 🙏

Will be available on next version with a composer update.

Cheers