Generate CRUD for Element-UI (Vue 3) and Inertia Js.
This package will generate files to perform CRUD, based on the database table schema. It will generate all the fields in list, create and update form pages.
- Generate list, create and update view pages
- Generate controller which perform insert, update and delete
- Generate form for all the fillable fields defined in model file
- Server side validation (required and maximum length)
You can install the package via composer:
composer require xt/laravel-inertia-element-ui-crud
Install npm package:
npm install laravel-inertia-element-ui-crud-vue3 --save
add following function to the app/Http/Controllers/Controller.php
function filterOrderParameters(){
$sort_order = \request('order', 'd');
if ($sort_order == ''){
$sort_order = 'd';
}
if ($sort_order == 'a'){
$sort_order = 'asc';
} else {
$sort_order = 'desc';
}
return $sort_order;
}
Add following code to the boot method of the app/Providers/AppServiceProvider.php
Inertia::share('flash', function () {
return [
'message' => Session::get('message'),
];
});
Inertia::share([
'success' => function () {
return Session::get('success')
? Session::get('success')
: '';
},
]);
Inertia::share([
'error' => function () {
return Session::get('error')
? Session::get('error')
: '';
},
]);
Inertia::share([
'errors' => function () {
return Session::get('errors')
? Session::get('errors')->getBag('default')->getMessages()
: (object) [];
},
]);
php artisan crud:generator <ControllerName> <ModelName>
Prepare model before generate crud
make sure controller name without including controller for example User
which generates UserController
Example:
#This will generator view file for Jetstream
php artisan crud:generator User User
or
#This will generator view file for breeze
php artisan crud:generator User User --template=breeze
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email hiren.reshamwala@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.