xt/laravel-inertia-element-ui-crud

Generate CRUD files for element ui + inertia js + Vue3
110
Install
composer require xt/laravel-inertia-element-ui-crud
Latest Version:v1.0.6
PHP:^7.4|^8.0|^8.1|^8.3
License:MIT
Last Updated:Oct 9, 2024
Links: GitHub  ·  Packagist
Maintainer: hirenreshamwala

element-ui crud generator

Latest Version on Packagist Total Downloads

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.

Vue Plugin

Features

  • 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)

Installation

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 code

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;
}

Usage

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) [];
    },
]);

Command to generate CRUD

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

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email hiren.reshamwala@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Related Packages

mjoc1985/laravel-inertia-helpers

Backend and frontend utilities for common Inertia.js + Laravel patterns. Type-sa...

1,132 0
harmonic/inertia-table

Easily create Inertia JS tables from Eloquent models

169 54
outhebox/laravel-translations

Manage your Laravel translations with a beautiful UI. Add, edit, delete, import,...

104,191 815
titasgailius/laravel-moonlight

An elegant Laravel scaffolding for your next single-page application.

6,574 142