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/ */
namespace App\Controllers;
use Inertia\Inertia;
use App\Models\Alert;
use App\Http\Controllers\Controller;
use Mariojgt\Builder\Enums\FieldTypes;
use Mariojgt\Builder\Helpers\FormHelper;
class AlertController extends Controller
{
public function index()
{
$form = new FormHelper();
$formConfig = $form
->addIdField()
->addField('Title', 'title', type: FieldTypes::TEXT->value)
->addField('Status', 'status', type: FieldTypes::TEXT->value)
->withConditionalStyling([
'active' => 'bg-green-500 text-white',
'inactive' => 'bg-red-500 text-white'
])
->addField('Created At', 'created_at', type: FieldTypes::TIMESTAMP->value)
->setEndpoints(
listEndpoint: route('admin.api.generic.table'),
deleteEndpoint: route('admin.api.generic.table.delete'),
createEndpoint: route('admin.api.generic.table.create'),
editEndpoint: route('admin.api.generic.table.update')
)
->setModel(Alert::class)
->build();
return Inertia::render('Admin/Generic/Index', [
'title' => 'Alerts',
'table_name' => 'alerts',
...$formConfig
]);
}
}
// Simple link
->addField('Component Name', 'reportedData.comp_name', type: FieldTypes::TEXT->value)
->withLink('https://nvd.nist.gov/search?q={value}', true) // true = new tab
// Link from another field
->addField('Component Name', 'reportedData.comp_name', type: FieldTypes::TEXT->value)
->withLinkFromField('reportedData.comp_link', true)
// Edit link
->addField('Actions', 'id', type: FieldTypes::TEXT->value)
->withEditLink('/admin/edit')
// Try first field, fall back to second if empty
->addField('Version', 'reportedTempData.affected_in|reportedData.vuln_version', type: FieldTypes::TEXT->value)
// Multiple fallbacks
->addField('Contact', 'user.email|user.profile.email|contact.email', type: FieldTypes::TEXT->value)
namespace App\Controllers;
use Inertia\Inertia;
use App\Models\Vulnerability;
use App\Http\Controllers\Controller;
use Mariojgt\Builder\Enums\FieldTypes;
use Mariojgt\Builder\Helpers\FormHelper;
class VulnerabilityController extends Controller
{
public function index()
{
$form = new FormHelper();
$formConfig = $form
->addIdField()
->tab('Vulnerability Details')
// Component with custom button link
->addField('Component Name', 'reportedData.comp_name', type: FieldTypes::TEXT->value)
->withPrimaryButtonLinkFromField('reportedData.comp_link', true, 'shadow-lg')
// Status with conditional styling and badge link
->addField('Status', 'status', type: FieldTypes::TEXT->value, filterable: true)
->withConditionalStyling([
'duplicate' => 'bg-red-500 text-white border-red-600',
'finished' => 'bg-green-500 text-white border-green-600',
'pending' => 'bg-yellow-500 text-black border-yellow-600'
])
->withBadgeLink('/status/{id}')
// CVSS Score with advanced styling and external link
->addField('CVSS Score', 'cvss_score', type: FieldTypes::NUMBER->value)
->withCVSSStyling()
->withButtonLink('https://nvd.nist.gov/calculator?score={value}', true, 'btn-sm btn-outline-primary')
// Vulnerability type with custom styling
->addField('Type', 'vuln_type', type: FieldTypes::TEXT->value)
->withAdvancedStyling([
['operator' => 'contains', 'value' => 'sql injection', 'classes' => 'bg-red-600 text-white font-bold'],
['operator' => 'contains', 'value' => 'xss', 'classes' => 'bg-red-500 text-white'],
['operator' => 'contains', 'value' => 'csrf', 'classes' => 'bg-orange-500 text-white']
])
// Created date with filtering
->addField('Created At', 'created_at', type: FieldTypes::TIMESTAMP->value, filterable: true)
// Row-level styling for critical items
->withAdvancedRowStyling([
[
'field' => 'cvss_score',
'operator' => 'greater_than_equal',
'value' => 9.0,
'classes' => 'bg-red-50 border-red-300 border-l-4 shadow-md'
],
[
'field' => 'status',
'operator' => 'equals',
'value' => 'duplicate',
'classes' => 'bg-gray-100 border-gray-300 opacity-60'
]
], 'bg-white hover:bg-gray-50')
->setEndpoints(
listEndpoint: route('admin.api.generic.table'),
deleteEndpoint: route('admin.api.generic.table.delete'),
createEndpoint: route('admin.api.generic.table.create'),
editEndpoint: route('admin.api.generic.table.update')
)
->setModel(Vulnerability::class)
->build();
return Inertia::render('Admin/Vulnerabilities/Index', [
'title' => 'Vulnerabilities',
'table_name' => 'vulnerabilities',
...$formConfig
]);
}
}
bash
composer install::builder
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.