Laravel or Lumen ApiCreate
Installation
快速安裝
In command or terminal, cd to your website root then enter this require:
使用命令提示元件,cd 到你的網站跟目錄後輸入以下:
composer require savemydream/apicreate
If in Laravel, go to config/app.php, add this code to providers array:
在 Laravel, 打開檔案 config/app.php, 加入下列程式碼至 providers 陣列裡:
Savemydream\ApiCreate\ApiCreateServiceProvider::class,
If in Lumen, go to bootstrap/app.php, add this code to providers array:
在 Lumen, 打開檔案 bootstrap/app.php, 加入下列程式碼:
$app->register(Savemydream\ApiCreate\ApiCreateServiceProvider::class);
In Lumen, Don't forget to enable Eloquent, remove the comment of this code in bootstrap/app.php:
在 Lumen, 別忘了開啟模組功能, 請移除下列程式碼的註解(一樣在 bootstrap/app.php 裡面):
How to use
使用說明
Use artisan:
使用 artisan 命令:
php artisan api:create
Option(選項)
Create Repository
(創造 Repository)
--rep
and then follow the steps...
之後請您照著命令步驟執行即可
Auto Create
自動產生
- NameController.php
- app\Name.php
- database\migrations\xxxx_xx_xx_xxxxxx_names.php
- Repo\NameRepo\NameBaseRepo.php
- auto append route in web.php
Coded By Jiang (姜姜)