mrcookie/simple-api-crud-generator
最新稳定版本:0.0.1
Composer 安装命令:
composer require mrcookie/simple-api-crud-generator
包简介
This is my package simple-api-crud-generator
README 文档
README
The Laravel CRUD Generator is a command-line tool designed to streamline the process of creating CRUD (Create, Read, Update, Delete) operations for your Laravel-based RESTful API. It automates the generation of actions, routes, and resources, allowing you to quickly set up endpoints for managing your application's data models.
Installation
You can install the package via composer:
composer require mrcookie/simple-api-crud-generator
Usage
php artisan api-crud:generate [App/Models/User or User or user]
and then you will get this routes with the related actions so you can customize everything to your needs:
Route::name('users.')->prefix('users')->group(function () { Route::get('', App\Api\Actions\Users\GetUsersAction::class); Route::get('{id}', App\Api\Actions\Users\ShowUserAction::class); Route::put('{id}', App\Api\Actions\Users\UpdateUserAction::class); Route::delete('{id}', App\Api\Actions\Users\DeleteUserAction::class); });
Im using "spatie/laravel-query-builder": "^5.3" to handle query and filtering. u can see "spatie/laravel-query-builder": "^5.3" https://spatie.be/docs/laravel-query-builder/v5/introduction
You can specified allowedFilters and allowedFields in your model
Example
class User extends Model { public static array $allowedFilters = [ 'name' ]; public static array $allowedFields = [ 'name' ]; }
Notes
-
this Package Uses Laravel Actions for the crud operations
-
this Package Uses Scramble To Generate API Documentation
Scramble Docs
visit [http://localhost:8000/docs/api] to see the generated docs api routes
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-09-16