Downloads
Stars
Version
composer require crocodicstudio/crudbooster=dev-master
Then don't forget to run the crudbooster installation command :
php artisan crudbooster:install
/developer/login
Little different? yep. For the first time, you need to make your some modules, menus, and users for your new backend.
Developer Area :
default path : /developer/login
default user : developer
default pass : You will get once the installation is finished
WARNING PLEASE DON'T FORGET TO CHANGE THE DEFAULT DEVELOPER CREDENTIAL AT
/config/crudbooster.php
Now you can log out, and try the admin panel by visiting /admin/login
You can always change the admin login at /config/crudbooster.php
function cbInit() {
$this->setTable("books");
$this->setPageTitle("Book Data");
$this->addText("Title");
}
As you can see we add column title it will show at index table, detail, add and edit form.
Example
$this->addText("Foo Bar");
$this->addText("Foo bar","foo_bar","field_foobar");
Parameters available :
Name | Description |
---|---|
$label | The input label (Required) |
$name | The input name (Optional) |
$field_to_save | The field name if not same with the name (Optional) |
Additional Options available :
Method | Description |
---|---|
->maxLength(100); |
Set max length limit |
->minLength(5); |
Set min length limit |
->strLimit(100); |
Set character limit |
Additional options example :
$this->addText("Foo Bar")->maxLength(100)->minLength(5);
Example
$this->addCheckbox("Foo Bar");
$this->addCheckbox("Foo Bar","foo_bar","foo_bar_field");
Parameters available :
Name | Description |
---|---|
$label | The input label (Required) |
$name | The input name (Optional) |
$field_to_save | The field name if not same with the name (Optional) |
Additional options available :
Method | Description |
---|---|
->options($array); |
The options of check box |
->optionsFromTable($table, $key_field, $display_field, $SQLCondition = null); |
The options of check box with table source |
Additional options example :
$this->addCheckbox("Foo bar")->options(["a"=>"Banana","b"=>"Melon"]);
$this->addCheckbox("Foo bar")->optionsFromTable("fruits","id","name");
Example
$this->addPassword("Foo Bar");
$this->addPassword("Foo bar","foo_bar","field_foobar");
Parameters available :
Name | Description |
---|---|
$label | The input label (Required) |
$name | The input name (Optional) |
$field_to_save | The field name if not same with the name (Optional) |
Example
$this->addImage("Foo Bar");
$this->addImage("Foo bar","foo_bar","field_foobar");
Parameters available :
Name | Description |
---|---|
$label | The input label (Required) |
$name | The input name (Optional) |
$field_to_save | The field name if not same with the name (Optional) |
Additional options :
Name | Description |
---|---|
->encrypt(true); |
To encrypt the file name set false or true |
->resize(150, 150); |
To resize the image param 1 for width, param 2 for height |
Example
$this->addTextArea("Foo Bar");
$this->addTextArea("Foo bar","foo_bar","field_foobar");
Parameters available :
Name | Description |
---|---|
$label | The input label (Required) |
$name | The input name (Optional) |
$field_to_save | The field name if not same with the name (Optional) |
Additional options :
Name | Description |
---|---|
->strLimit($length); |
Set column limit characters |
Example
$this->addSelect("Foo Bar");
$this->addSelect("Foo Bar","foo_bar","foo_bar_field");
Parameters available :
Name | Description |
---|---|
$label | The input label (Required) |
$name | The input name (Optional) |
$field_to_save | The field name if not same with the name (Optional) |
Additional options available :
Method | Description |
---|---|
->options($array); |
The options of select |
->optionsFromTable($table, $key_field, $display_field, $SQLCondition = null); |
The options of select with table source |
->foreignKey($parent_select_name); |
To enable sub select. The case example is for select a province, city and district |
->optionsFromQuery($query); |
To set the source options by your own DB Query. Should be 2 response field "key" and "label" |
Additional options example :
$this->addSelect("Foo bar")->options(["a"=>"Banana","b"=>"Melon"]);
$this->addSelect("Foo bar")->optionsFromTable("fruits","id","name");
$this->addSelect("Foo Bar")->optionsFromQuery(function() {
return DB::table("foo")->select("id as key","name as label")->get();
});
Example
$this->addCustom("Foo Bar");
$this->addCustom("Foo bar","foo_bar","field_foobar");
Parameters available :
Name | Description |
---|---|
$label | The input label (Required) |
$name | The input name (Optional) |
$field_to_save | The field name if not same with the name (Optional) |
Example
$this->addDate("Foo Bar");
$this->addDate("Foo bar","foo_bar","field_foobar");
Parameters available :
Name | Description |
---|---|
$label | The input label (Required) |
$name | The input name (Optional) |
$field_to_save | The field name if not same with the name (Optional) |
Additional options available :
Name | Description |
---|---|
->format("Y-m-d"); |
The date php format |
Additional options example :
$this->addDate("foo bar")->format("Y-m-d");
Example
$this->addDateTime("Foo Bar");
$this->addDateTime("Foo bar","foo_bar","field_foobar");
Parameters available :
Name | Description |
---|---|
$label | The input label (Required) |
$name | The input name (Optional) |
$field_to_save | The field name if not same with the name (Optional) |
Additional options available :
Name | Description |
---|---|
->format("Y-m-d H:i:s"); |
The date time php format |
Additional options example :
$this->addDateTime("Foo bar")->format("Y-m-d H:i:s");
Example
$this->addEmail("Foo Bar");
$this->addEmail("Foo bar","foo_bar","field_foobar");
Parameters available :
Name | Description |
---|---|
$label | The input label (Required) |
$name | The input name (Optional) |
$field_to_save | The field name if not same with the name (Optional) |
Example
$this->addMoney("Foo Bar");
$this->addMoney("Foo bar","foo_bar","field_foobar");
Parameters available :
Name | Description |
---|---|
$label | The input label (Required) |
$name | The input name (Optional) |
$field_to_save | The field name if not same with the name (Optional) |
Additional options :
Name | Description |
---|---|
->prefix("Rp."); |
The prefix of money display |
->precision(2); |
The precision of money input |
->decimalSeparator("."); |
The decimal separator of money input |
->thousandSeparator(","); |
The thousand separator of money input |
Additional option example :
$this->addMoney("Price")->prefix("Rp.")->precision(2);
Example
$this->addFile("Foo Bar");
$this->addFile("Foo bar","foo_bar","field_foobar");
Parameters available :
Name | Description |
---|---|
$label | The input label (Required) |
$name | The input name (Optional) |
$field_to_save | The field name if not same with the name (Optional) |
Example
$this->addHidden("Foo Bar");
$this->addHidden("Foo bar","foo_bar","field_foobar");
Parameters available :
Name | Description |
---|---|
$label | The input label (Required) |
$name | The input name (Optional) |
$field_to_save | The field name if not same with the name (Optional) |
Example
$this->addNumber("Foo Bar");
$this->addNumber("Foo bar","foo_bar","field_foobar");
Parameters available :
Name | Description |
---|---|
$label | The input label (Required) |
$name | The input name (Optional) |
$field_to_save | The field name if not same with the name (Optional) |
Example
$this->addRadio("Foo Bar");
$this->addRadio("Foo bar","foo_bar","field_foobar");
Parameters available :
Name | Description |
---|---|
$label | The input label (Required) |
$name | The input name (Optional) |
$field_to_save | The field name if not same with the name (Optional) |
Additional options available :
Method | Description |
---|---|
->options($array); |
The options of radio |
->optionsFromTable($table, $key_field, $display_field, $SQLCondition = null); |
The options of radio with table source |
->optionsFromQuery($query); |
To set the source options by your own DB Query. Should be 2 response field "key" and "label" |
Additional options example :
$this->addSelect("Foo bar")->options(["a"=>"Banana","b"=>"Melon"]);
$this->addSelect("Foo bar")->optionsFromTable("fruits","id","name");
$this->addSelect("Foo Bar")->optionsFromQuery(function() {
return DB::table("foo")->select("id as key","name as label")->get();
});
Example
$this->addWysiwyg("Foo Bar");
$this->addWysiwyg("Foo bar","foo_bar","field_foobar");
Parameters available :
Name | Description |
---|---|
$label | The input label (Required) |
$name | The input name (Optional) |
$field_to_save | The field name if not same with the name (Optional) |
Additional options :
Name | Description |
---|---|
->strLimit($length); |
Set column limit characters |
Name | Description |
---|---|
->visible($boolean); |
To set input visible false or true |
->defaultValue($value); |
To set the default value |
->inputWidth(12); |
To set width of input |
->columnWidth(100); |
To set width of table column |
->required(true); |
To set the mandatory of input |
->help("Help text"); |
To set help text in the bellow of input |
->placeholder("Enter the text"); |
To set the input placeholder |
->validation("string"); |
To set the input validation (laravel validation) |
Example
$this->addText("Foo Bar")
->inputWidth(6)
->columnWidth(150)
->help("Enter the foo bar")
->validation("required|string");
You can prevent input or column to show only at index table.
$this->addText("Foo Bar")->showIndex(true)->showEdit(false)->showAdd(false)->showDetail(false);
In this section you can disable / hide buttons in crudbooster
Name | Description |
---|---|
$this->setSearchForm(true); |
To show/hide search form |
$this->setButtonLimitPage(true); |
To show/hide limit button |
$this->setButtonSave(true); |
To show/hide save button |
$this->setButtonAdd(true); |
To show/hide add button |
$this->setButtonEdit(true); |
To show/hide edit button |
$this->setButtonDetail(true); |
To show/hide detail button |
$this->setButtonDelete(true); |
To show/hide delete button |
$this->setButtonCancel(true); |
To show/hide cancel button at form |
$this->setButtonAddMore(true); |
To show/hide add more button at form |
In this section you can add additional view or html on before or after CRUDBooster element
Name | Description |
---|---|
$this->setBeforeIndexTable(" |
To set additional html before index table data |
$this->setAfterIndexTable(" |
To set additional html after index table data |
$this->setBeforeDetailForm(function($row) { return " |
To set additional html before detail form. You can use $row to get current data |
$this->setAfterDetailForm(function($row) { return " |
To set additional html after detail form. You can use $row to get current data |
In this section you can add more buttons on the above of index table
$this->addIndexActionButton($label, $actionURL, $fontawesomeClass, $color, $attributes);
Name | Description |
---|---|
$label |
The button label |
$actionURL |
The button action url |
$fontaweseomClass |
The button icon use font awesome class |
$color |
The button color use ButtonColor::GREEN, ButtonColor::RED, ButtonColor::YELLOW, ButtonColor::LIGHT_BLUE, ButtonColor::DARK_BLUE |
Example :
$this->addIndexActionButton("Export Data", module()->url('export-data'), 'fa fa-download', ButtonColor::GREEN);
In this section you can add more buttons on the table grid data
$this->addActionButton($label, $actionURL, $condition, $fontAwesome, $color, $confirmation);
Name | Description |
---|---|
$label |
The button label |
$actionURL |
The button action url. You can set as callable with $row parameter |
$condition |
The button show condition, this type is callable with $row parameter |
$fontawesome |
The button icon, you can use font awesome class |
$color |
The button color, you can use ButtonColor::RED(YELLOW,LIGHT_BLUE,GREEN) |
$this->addActionButton("Download Invoice", function($row) {
return module()->url("download-invoice/".$row->primary_key);
},function($row) {
if($row->status == "PAID") return true;
else return false;
}, "fa fa-download");
In the example above you can use magic properties ->primary_key
to get the ID of record
Some case you want to hide the detail button, edit button with specific condition.
$this->hideButtonDetailWhen(function($row) {
//Write if condition here
});
The output of this function should be a boolean. True to hide the button, False to show the button.
Example
$this->hideButtonDeleteWhen(function($row) {
if($row->status == "PAID") return true;
else return false;
});
Method available :
Name | Description |
---|---|
hideButtonDeleteWhen($callback) | To hide delete button |
hideButtonEditWhen($callback) | To hide edit button |
hideButtonDetailWhen($callback) | To hide detail button |
Name | Description |
---|---|
crudbooster:make --module={tableName} | To create a module by table name. Replace {tableName} with the table name |
crudbooster:install | To install the crudbooster for the first time |
crudbooster:seed {--generate} | To backup the cb_* tables data and additional table see at the config/crudbooster.php. This useful if you doing collaboration that need sync the data also. Set option --generate to generating the seeder, or without it to seeder the exisiting seeder file. |
Name | Description |
---|---|
module()->getData("key_name") | To get the properties variable at the module controller. Replace key name with the properties var name. |
module()->getPageTitle() | To get the module page title |
module()->getTable() | To get the table name of module |
module()->getPageIcon() | To get the page icon of module |
module()->canBrowse() | To check the current user is can browse to the module ? |
module()->canCreate() | To check the current user is can create to the module ? |
module()->canRead() | To check the current user is can read to the module ? |
module()->canUpdate() | To check the current user is can update to the module ? |
module()->canDelete() | To check the current user is can delete to the module ? |
module()->addUrl() | To get the add page url |
module()->editUrl() | To get the edit page url |
module()->detailUrl() | To get the detail page url |
module()->deleteUrl() | To get the delete page url |
module()->url("path/here") | To get the root module url. You can pass the parameter with additional path |
To use this feature you have to set the Google FCM Key at config/crudbooster.php
use crocodicstudio\crudbooster\helpers\FCM;
$fcm = new FCM();
$title = "Foo Bar Title";
$message = "The content notification message";
$data = [];
$data['foo_data'] = "Hello";
$data['bar_data'] = "New";
$fcm->sendToAndroid($reg_id_array, $title, $message, $data);
// Or you can send to ios with this bellow
$fcm->sendToIos($reg_id_array, $title, $message,$data);