1. Go to this page and download the library: Download mariojgt/builder 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/ */
mariojgt / builder example snippets
// Table api controller in where you can use your middleware
Route::controller(TableBuilderApiController::class)->group(function () {
Route::post('/admin/api/generic/table', 'index')->name('admin.api.generic.table');
Route::post('/admin/api/generic/table/create', 'store')->name('admin.api.generic.table.create');
Route::post('/admin/api/generic/table/update', 'update')->name('admin.api.generic.table.update');
Route::post('/admin/api/generic/table/delete', 'delete')->name('admin.api.generic.table.delete');
});
// Table columns
$columns = [
[
'label' => 'Id', // Display name
'key' => 'id', // Table column key
'sortable' => true, // Can be use in the filter
'canCreate' => false, // Can be use in the create form
'canEdit' => false, // Can be use in the edit form
],
[
'label' => 'Name', // Display name
'key' => 'name', // Table column key
'sortable' => true, // Can be use in the filter
'canCreate' => true, // Can be use in the create form
'canEdit' => true, // Can be use in the edit form
'type' => 'text', // Type text,email,password,date,timestamp
],
[
'label' => 'Guard',
'key' => 'guard_name',
'sortable' => true,
'canCreate' => true,
'canEdit' => true,
'type' => 'text',
],
[
'label' => 'Created At',
'key' => 'created_at',
'sortable' => false,
'canCreate' => false,
'canEdit' => true,
'type' => 'date',
],
[
'label' => 'Updated At',
'key' => 'updated_at',
'sortable' => false,
'canCreate' => false,
'canEdit' => true,
'type' => 'timestamp',
],
];
return Inertia::render('BackEnd/Role/Index', [
'title' => 'Role | Roles',
// Required for the Builder Generic table api
'endpoint' => route('admin.api.generic.table'),
'endpointDelete' => route('admin.api.generic.table.delete'),
'endpointCreate' => route('admin.api.generic.table.create'),
'endpointEdit' => route('admin.api.generic.table.update'),
// You table columns
'columns' => $columns,
// The model where all those actions will take place
'model' => encrypt(Role::class),
// If you want to protect your crud form you can use this below not
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.