| Install | |
|---|---|
composer require xslainadmin/livewire-crud |
|
| Latest Version: | 6.0.4 |
| PHP: | ^8.2|^8.3|^8.4 |
A comprehensive Laravel Livewire CRUD generator package with enterprise-level features including interactive charts, calendar management, advanced export/import capabilities, notification systems, and modern Bootstrap 5 UI. Perfect for rapid application development with production-ready components.
composer require nwidart/laravel-modules
composer require xslainadmin/livewire-crud
php artisan crud:install
This command will:
Add to your .env file:
# Chart Configuration
CHARTS_ENABLED=true
CHARTS_DEFAULT_TYPE=line
CHARTS_CACHE_DURATION=3600
# Calendar Configuration
CALENDAR_ENABLED=true
CALENDAR_DEFAULT_VIEW=dayGridMonth
CALENDAR_TIME_ZONE=UTC
# Export Configuration
EXPORT_ENABLED=true
EXPORT_MAX_RECORDS=10000
EXPORT_QUEUE_ENABLED=true
# Notification Configuration
NOTIFICATIONS_ENABLED=true
NOTIFICATIONS_CHANNELS=database,mail
NOTIFICATIONS_QUEUE=default
If you want to use the built-in notification system:
php artisan migrate
Generate a complete CRUD interface for any model:
php artisan crud:generate {table_name} {theme?} {module?}
Example:
php artisan crud:generate users modern
php artisan crud:generate products default admin
Each CRUD generation creates:
{Model}Component.php - Main CRUD component{Model}Chart.php - Analytics component{Model}Calendar.php - Calendar component{Model}Export.php - Export component{Model}Import.php - Import componentindex.blade.php - Data listing with advanced featurescreate.blade.php - Creation form with validationedit.blade.php - Edit form with live updatesshow.blade.php - Detailed view with related datamodals/ - Modal components for quick actions{Model}.php - Eloquent model with relationships{Model}Factory.php - Database factory for testing{Model}Created.php - Creation notification{Model}Updated.php - Update notification{Model}Deleted.php - Deletion notification// In your Livewire component
public function loadChartData()
{
return [
'series' => [
[
'name' => 'Sales',
'data' => $this->getSalesData()
]
],
'options' => [
'chart' => ['type' => 'line'],
'xaxis' => ['categories' => $this->getMonths()]
]
];
}
// Define calendar events
public function getCalendarEvents()
{
return $this->model::query()
->select('id', 'title', 'start_date as start', 'end_date as end')
->get()
->map(function ($event) {
return [
'id' => $event->id,
'title' => $event->title,
'start' => $event->start,
'end' => $event->end,
'backgroundColor' => $this->getEventColor($event)
];
});
}
// Create custom PDF export
public function exportToPdf()
{
$data = $this->getFilteredData();
return $this->export()
->template('custom.pdf-template')
->data($data)
->filename('report-' . now()->format('Y-m-d'))
->download();
}
// Send real-time notification
public function notifyUsers($message, $type = 'info')
{
$this->dispatch('notification', [
'message' => $message,
'type' => $type,
'timeout' => 5000
]);
}
php artisan vendor:publish --provider="LivewireCrud\LivewireCrudServiceProvider" --tag=config
config/livewire-crud.php)return [
'export' => [
'enabled' => true,
'formats' => ['pdf', 'excel', 'csv'],
'templates' => [
'pdf' => 'exports.pdf.default',
'excel' => 'exports.excel.default',
],
'security' => [
'password_protect' => false,
'watermark' => false,
],
],
'charts' => [
'enabled' => true,
'default_type' => 'line',
'color_scheme' => 'default',
'animations' => true,
'toolbar' => true,
],
'calendar' => [
'enabled' => true,
'default_view' => 'dayGridMonth',
'time_format' => 'H:mm',
'date_format' => 'YYYY-MM-DD',
],
'notifications' => [
'enabled' => true,
'channels' => ['database', 'mail'],
'templates' => [
'mail' => 'notifications.mail.default',
],
],
];
Create your own theme by extending the base theme:
php artisan crud:theme MyCustomTheme
Override default templates:
php artisan vendor:publish --provider="LivewireCrud\LivewireCrudServiceProvider" --tag=views
The package uses CSS custom properties for easy theming:
:root {
--primary-color: #your-color;
--secondary-color: #your-color;
--success-color: #your-color;
/* ... */
}
Run the test suite:
composer test
Generate test coverage:
composer test-coverage
| Method | Description | Parameters |
|---|---|---|
loadData() |
Load paginated data | $page, $perPage |
search($query) |
Search records | $query string |
sort($field) |
Sort by field | $field, $direction |
export($format) |
Export data | $format (pdf|excel|csv) |
bulkDelete($ids) |
Delete multiple records | $ids array |
// Chart management
App.charts.create("#chart", options);
App.charts.updateData("#chart", newData);
// Calendar management
App.calendar.init("#calendar", options);
App.calendar.addEvent(eventData);
// Notifications
App.notifications.show(message, type, options);
php artisan crud:install and ensure Node.js dependencies are installedEnable debug mode in configuration:
'debug' => env('CRUD_DEBUG', false),
We welcome contributions! Please see CONTRIBUTING.md for details.
composer install && npm installcomposer testIf you discover any security-related issues, please email info@xslain.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email info@xslain.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.