jatri/api-first-crud

此软件包的最新版本(dev-main)没有可用的许可证信息。

Laravel 软件包,用于生成 API 首先的 CRUD 操作

dev-main 2024-08-30 05:10 UTC

This package is auto-updated.

Last update: 2024-09-30 05:19:03 UTC


README

  • PHP: 7.4, 8.0, 8.1, 8.2, 或 8.3
  • Laravel: 8.x, 9.x, 10.x, 11.x, 12.x

安装

要安装此软件包,请运行以下命令

composer require jatri/api-first-crud:dev-main

用法

安装后,您可以使用以下 Artisan 命令生成完整的 CRUD 操作

php artisan make:crud Post

这将生成以下内容

  • app/Models/Post.php 中创建一个模型
  • app/Http/Controllers/PostController.php 中创建一个控制器
  • app/Http/Requests/PostRequest.php 中创建一个请求验证文件
  • database/migrations/xxxx_xx_xx_create_posts_table.php 中创建一个迁移文件
  • routes/api.php 中创建 API 路由

故障排除

常见问题

  • 缺少缓存表:如果您遇到与缓存表不存在相关的错误,请尝试以下命令
php artisan cache:table
php artisan migrate
  • 找不到类错误:如果您遇到相关问题,请尝试以下命令
composer dump-autoload