XF_Index/routes/api.php

50 lines
1.6 KiB
PHP
Raw Normal View History

2023-06-10 14:21:40 +08:00
<?php
/*
* Copyright © 2016 - 2023 筱锋xiao_lfeng. All Rights Reserved.
* 开发开源遵循 MIT 许可,若需商用请联系开发者
* https://www.x-lf.com/
*/
2023-06-11 14:20:56 +08:00
use App\Http\Controllers\Authme;
2023-06-22 23:03:27 +08:00
use App\Http\Controllers\Function\Link;
2023-06-10 14:21:40 +08:00
use Illuminate\Http\Request;
2023-06-11 14:20:56 +08:00
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Response;
2023-06-10 14:21:40 +08:00
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| 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!
|
*/
2023-06-11 14:20:56 +08:00
Route::middleware('auth')->get('/user', function (Request $request) {
2023-06-10 14:21:40 +08:00
return $request->user();
});
2023-06-11 14:20:56 +08:00
2023-06-22 23:03:27 +08:00
// 登陆类
Route::prefix('auth')->group(function () {
Route::post('login',[Authme::class,'Login'])->name('api.auth.login');
Route::post('register',[Authme::class,'Register'])->name('api.auth.register');
Route::match(['get','post'],'logout',function () {
Auth::logout();
return Response::redirectTo('');
})->name('logout');
});
// 友链类
Route::prefix('link')->group(function () {
Route::prefix('console')->group(function () {
});
Route::prefix('custom')->group(function () {
2023-06-24 20:59:12 +08:00
Route::post('add',[Link::class,'apiCustomAdd'])->name('api.link.custom.add');
2023-06-24 22:51:19 +08:00
Route::get('search',[Link::class, 'apiCustomSearch'])->name('api.link.custom.search');
2023-06-11 14:20:56 +08:00
});
});