Custom buttons
See original GitHub issueDevelopers should be able to add custom buttons. Proposed syntax:
$this->crud->addButton('button_name', 'model_function_name');
// by default this will place the button before edit and delete
// ex: $this->crud->addButton('send_email', 'getSendEmailButton');
// other methods:
$this->crud->removeButton('send_email');
$this->crud->setButtonsOrder(['edit', 'send_email', 'delete']);
This way, I think, we’ll leave a lot of space for customization. On your model, you could do something like:
public function getSendEmailButton() {
return "<a class='btn btn-warning' href='some_link'><i class='fa fa-envelope'> Send email</a>";
}
and you can have your checks or complex logic there. Ex:
- show the button to some users and others not.
- show the button for some entries and others not.
- show different url depending on some model attribute.
- etc.
What I don’t like about this is that it does imply you’ll be writing some HTML in the model, which is a bit ugly… What do you think? Any better solutions?
Note: I also see the need for custom bulk buttons in the future. But that’s another topic.
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Promotional Custom Buttons by: Everyone Loves Buttons®
Welcome to CustomButtons.com—your premier source for all your custom buttons, magnetic buttons and more. From 1 to 1,000,000+, you're at the right place—we ......
Read more >Order Custom Buttons - 19 Button Sizes: Round, Square ...
Order custom buttons for as low as $0.19 each! Easy to personalize and affordably priced with a minimum order of just one custom...
Read more >Custom buttons | Free shipping - Sticker Mule
Create custom buttons in full color. High quality steel with durable pin-backs. Get free proofs, free worldwide shipping, 4 day turnaround & 24/7...
Read more >Fast Filmmaking Settings For The Sony FX30 Part 2 - YouTube
Download my FX30 Settings Preset: https://get.whoismatt.com/fx30presetHere is how to setup the custom buttons, function menu, mode dial, ...
Read more >Custom Buttons - Buy Customizable Buttons Online
Design custom buttons using our online button designer, or upload print-ready graphics! We will proof, print, and press your one-of-a-kind custom buttons!
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Please see these examples how I use your crud right now (work in progress):
https://gist.github.com/axyr/4328d6dba6462d6639347e226182d218 https://gist.github.com/axyr/336934ff114cb943e26bdf9823affd97 https://gist.github.com/axyr/2bf47beaa6af77d7fd48836a694372d2
By applying namingconventions, I only have to create
MyModelController extends ModelAdminController
to get a list and form view forMyModel
.https://laravel-backpack.readme.io/docs/crud-fields This will become an array hell:
No IDE autocompletion possible, so you always have to go to the docs to see the options possible for maybe tens (>100?) of different form fields.
When using objects, you can apply sensible defaults for, name, attribute, label based on the field name, with auto translations like label(‘MyModel.field_name’, ‘default label’);
Also the model can be guessed for a FormField user_id that it should find the hasOne User();
So you can do :
And by default it will will provide a map of [‘id’, getTilte()] or something.
That will help beginners a lot, by having real usable sensible defaults by just boilerplating their models and controllers.