一、注册api
1.1 创建注册路由
注册路由我们把它归属到认证模块去,在routes/auth.php
下去写:
<?php
use App\Http\Controllers\Auth\RegisterController;
$api = app('Dingo\Api\Routing\Router');
$api->version('v1', function ($api) {
// 路由组
$api->group(['prefix' => 'auth'], function ($api) {
// 注册
$api->post('register', [RegisterController::class, 'store']);
});
});
1.2 创建注册控制器
运行命令php artisan make:controller Auth/RegisterController
,创建注册控制器。
1.3 创建表单验证类
运行命令php artisan make:request Auth/RegisterRequest
可以看