1. Go to this page and download the library: Download justinmoh/backpack-helper library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use \JustinMoh\BackpackHelper\CrudHelper;
use \JustinMoh\BackpackHelper\Facades\Columns\DatetimeColumn;
use \JustinMoh\BackpackHelper\Facades\Columns\SelectColumn;
use \JustinMoh\BackpackHelper\Facades\Columns\TextColumn;
use \JustinMoh\BackpackHelper\Facades\Fields\RadioField;
use \JustinMoh\BackpackHelper\Facades\Fields\Select2FromArrayField;
use \JustinMoh\BackpackHelper\Facades\Fields\UploadMultipleField;
use \JustinMoh\BackpackHelper\Facades\Filters\Select2MultipleFilter;
use \JustinMoh\BackpackHelper\Facades\Filters\SimpleFilter;
// ...
protected function setupListOperation()
{
// a datetime column with priority `1`
DatetimeColumn::init('Date & Time Check In', 'datetime_check_in', 1)
->toColumn();
// you can also separate the method chains.
DatetimeColumn::label('Date & Time Check Out')->name('datetime_check_out')
->toColumn();
// auto guessing `name` with `label`
TextColumn::label('Name')->toColumn();
// backpack's `select` column type
SelectColumn::init('Category', 'category_id')
->entity('category')->attribute('display_name')->model(\App\Category::class)
->toColumn();
}
// ...
protected function setupCreateOperation()
{
// a field with wrapperAttribute col-md-6 (or col-lg-6 ?)
UploadMultipleField::init('Attach Documents', 'customer_documents', 6)
->toField();
// an inline yes no radio button, disabled
RadioField::init('Is Vip')->width(3)->inline()
->options(CrudHelper::YES_NO_OPTIONS)
->disabled()->toField();
// select 2
Select2FromArrayField::init('Room Type', 'room_type_id', 4)->
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.