Installation Add the bundle to your Laravel project via Composer:
composer require atompulse/rad-bundle
Register the bundle in config/app.php under providers (if using Laravel 5.5+ with auto-discovery, this may not be required).
First Use Case: Rapid CRUD Generation The bundle is designed for RAD (Rapid Application Development). Start by generating a scaffold:
php artisan rad:generate:crud User
This creates a full CRUD interface for the User model (ensure the model exists first).
Key Directories
app/Rad/ by default (configurable in config/rad.php).config/rad.php (check for default values and override as needed).php artisan rad: for all available generators.php artisan rad:generate:crud Post --fields="title,body,published_at"
--fields to specify which model attributes to include. Omit to auto-detect.php artisan rad:generate:crud Comment --relationships="post:Post"
index.blade.php, edit.blade.php).php artisan vendor:publish --tag=rad-layouts
resources/views/rad/.php artisan rad:generate:api User
--api flag to auto-prefix routes with /api/v1.php artisan rad:generate:seeder User
php artisan rad:generate:test UserController
--events flag:
php artisan rad:generate:crud Product --events="created,updated"
config/rad.php for:
rad_namespace).view_paths).form_field_types).--namespace=Admin).Namespace Conflicts
App\Rad by default. If this conflicts with existing code, override the namespace in config/rad.php or via CLI:
php artisan rad:generate:crud User --namespace=Admin
config/rad.php for rad_namespace and adjust.Missing Dependencies
friendsofsymfony/jsrouting-bundle@2.0.*@dev. If missing, install it manually:
composer require friendsofsymfony/jsrouting-bundle:2.0.*@dev
JsRoutingBundle is registered in AppKernel.php (Symfony) or config/bundles.php (Laravel <5.5).Symfony Version Mismatch
php artisan route:clear
Symfony\Bridge\Laravel\HttpKernel is loaded.Overwriting Existing Files
php artisan rad:generate:crud User --force
--dry-run to preview changes:
php artisan rad:generate:crud User --dry-run
php artisan rad:generate:crud User -vvv
resources/views/layouts/rad/).resources/views/rad/.php artisan view:clear
Custom Field Types
config/rad.php under form_field_types:
'custom_field' => \App\Rad\FieldTypes\CustomFieldType::class,
Rad\FieldTypeInterface.Hooks and Events
rad.generated events to post-process generated code:
// In a service provider
event(new RadGenerated($model, $paths));
Route Customization
php artisan vendor:publish --tag=rad-routes
routes/rad.php to modify route definitions.Localization
resources/lang/rad/. Extend by adding new language files or overriding existing ones.--only to regenerate specific parts (e.g., views):
php artisan rad:generate:crud User --only=views
password) with --exclude-fields:
php artisan rad:generate:crud User --exclude-fields="password,api_token"
$this->app->bind(
\App\Rad\Controllers\UserController::class,
\App\Rad\Controllers\UserController::class
);
public function getRouteKeyName()
{
return 'slug'; // or custom key
}
--middleware:
php artisan rad:generate:crud Post --middleware="auth,verified"
How can I help you explore Laravel packages today?