markgersaliaph/laravel-crud-generate is a Laravel package for my first ever package project.
It currently has 1 GitHub stars and 27 downloads on Packagist (latest version v1.0.11).
Install it with composer require markgersaliaph/laravel-crud-generate.
Discover more Laravel packages by markgersaliaph
or browse all Laravel packages to compare alternatives.
Last updated
This Laravel package simplifies the process of creating CRUD (Create, Read, Update, Delete) operations specifically for the Laravel Breeze React starter.
Before installing, make sure to install Laravel Breeze with React:
composer require laravel/breeze --dev
Follow the instructions to set up Laravel Breeze with React.
To install this package, use Composer:
composer require markgersaliaph/laravel-crud-generate
To use the Laravel CRUD Generate package in your Laravel project, you'll need to publish the configuration file and React components. Follow these steps:
Publish Configuration File:
Run the following Artisan command to publish the configuration file:
php artisan vendor:publish --tag=public --provider="Markgersaliaph\LaravelCrudGenerate\LaravelCrudGenerateServiceProvider"
After publishing the configuration file, you can customize the behavior of Laravel CRUD Generate by modifying
config/laravel-crud-generate.php
in your Laravel project. Adjust the values according to your requirements.
After installation, use the provided Artisan command to generate CRUD files for a specific model:
php artisan crud:generate YourModel
Replace YourModel with the name of your Eloquent model. This command will generate the necessary files, including the model,migrations, controller, react components, and routes.
To generate CRUD files for a "Product" model:
php artisan crud:generate Product
This will create the following files:
app/Models/Product.php
app/Http/Controllers/ProductController.php
database/migrations/create_products_table.php
resources/js/Pages/Form.jsx
resources/js/Pages/List.jsx
It will also generate a route in web.php:
Route::resource('products', App\Http\Controllers\ProductsController::class);
If you prefer to use built-in components, follow these steps:
Open the configuration file located at config/laravel-crud-generate.php.
Set the 'plain_components' option to false:
// config/laravel-crud-generate.php
return [
'plain_components' => false,
// Additional configuration options...
];
This configuration change will enable the use of built-in components such as Table.jsx and Pagination.jsx in your Laravel project.
Now, when generating components with Laravel CRUD Generate, the components will be included based on the updated configuration.