2019-03-01 14:08:34 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| API Routes
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| Here is where you can register API routes for your application. These
|
|
|
|
| routes are loaded by the RouteServiceProvider within a group which
|
|
|
|
| is assigned the "api" middleware group. Enjoy building your API!
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
Route::namespace('Api')->prefix('v1')->middleware('cors')->group(function () {
|
|
|
|
Route::middleware('api.guard')->group(function () {
|
2019-03-13 10:07:44 +08:00
|
|
|
//用户注册
|
|
|
|
Route::post('/users', 'UserController@store')->name('users.store');
|
|
|
|
//用户登录
|
|
|
|
Route::post('/login', 'UserController@login')->name('users.login');
|
2019-03-01 14:08:34 +08:00
|
|
|
|
2019-03-13 10:07:44 +08:00
|
|
|
Route::middleware('api.refresh')->group(function () {
|
2019-03-01 14:08:34 +08:00
|
|
|
//当前用户信息
|
|
|
|
Route::get('/users/info', 'UserController@info')->name('users.info');
|
|
|
|
//用户列表
|
|
|
|
Route::get('/users', 'UserController@index')->name('users.index');
|
|
|
|
//用户信息
|
|
|
|
Route::get('/users/{user}', 'UserController@show')->name('users.show');
|
|
|
|
//用户退出
|
|
|
|
Route::get('/logout', 'UserController@logout')->name('users.logout');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
Route::middleware('admin.guard')->group(function () {
|
|
|
|
//管理员注册
|
|
|
|
Route::post('/admins', 'AdminController@store')->name('admins.store');
|
|
|
|
//管理员登录
|
|
|
|
Route::post('/admin/login', 'AdminController@login')->name('admins.login');
|
2019-03-13 10:07:44 +08:00
|
|
|
Route::middleware('api.refresh')->group(function () {
|
2019-03-01 14:08:34 +08:00
|
|
|
//当前管理员信息
|
|
|
|
Route::get('/admins/info', 'AdminController@info')->name('admins.info');
|
|
|
|
//管理员列表
|
|
|
|
Route::get('/admins', 'AdminController@index')->name('admins.index');
|
|
|
|
//管理员信息
|
|
|
|
Route::get('/admins/{user}', 'AdminController@show')->name('admins.show');
|
|
|
|
//管理员退出
|
|
|
|
Route::get('/admins/logout', 'AdminController@logout')->name('admins.logout');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|