One thing we could do to speed up development is NOT going to the documentation website every time we need the syntax for a certain field type.
A SublimeText plugin/collection of snippets will solve that problem for me. Here's the syntax I have in mind:
crud.addField.select_multiple
=>
$this->crud->addField([ // SelectMultiple = n-n relationship (with pivot table)
'label' => "Tags",
'type' => 'select_multiple',
'name' => 'tags', // the method that defines the relationship in your Model
'entity' => 'tags', // the method that defines the relationship in your Model
'attribute' => 'name', // foreign key attribute that is shown to user
'model' => "App\Models\Tag", // foreign key model
'pivot' => true, // on create&update, do you need to add/delete pivot table entries?
]);
I'm thinking an alternative shorter syntax will also be available:
crud.af.select_multiple
What I want from the syntax is for it to still read the same as the code you want to write, so it will be easy to remember:
Using the crud prefix would allow us to also do things like:
// addColumn
crud.ac.column_type => [column definition]
// removeColumn
crud.rc => $this->crud->removeColumn('column_name');
// removeField
crud.rf => $this->crud->removeField('name', 'update/create/both);
// allowAccess
crud.aa => $this->crud->allowAccess(['list', 'create', 'update', 'reorder', 'delete']);
// denyAccess
crud.da => $this->crud->denyAccess(['list', 'create', 'update', 'reorder', 'delete']);
// enableDetailsRow
crud.edr =>
$this->crud->enableDetailsRow();
$this->crud->allowAccess('details_row');
// NOTE: you also need to do overwrite the showDetailsRow($id) method in your EntityCrudController to show whatever you'd like in the details row OR overwrite the views/backpack/crud/details_row.blade.php
// addClause
crud.addClause => $this->crud->addClause('where', 'name', '==', 'car');
Any thoughts / improvements?
Other SublimeText possible commands:
1) When on a model, run "Use CrudTrait";
2) When in routes file, run "Add CRUD route product"
Two years is long enough for me to assume that the help wanted is not going to appear - this should be put on the backlog - please re-open if needed.
Most helpful comment
Two years is long enough for me to assume that the help wanted is not going to appear - this should be put on the backlog - please re-open if needed.