1234567891011121314151617181920212223242526272829 |
- <?php
-
- use App\Http\Controllers\Api\NewsController;
- use Illuminate\Http\Request;
- 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 and all of them will
- | be assigned to the "api" middleware group. Make something great!
- |
- */
-
- Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
- return $request->user();
- });
- Route::prefix('{locale}')->group(function (){
- Route::prefix('news')->group(function (){
- Route::get('/', [NewsController::class, 'getTop']);
- Route::get('/list', [NewsController::class, 'list']);
- Route::get('/detail/{id}', [NewsController::class, 'detail'])->whereIn('locale', ["tw", "en", "jp"])->where('id', '[0-9]+');
- });
- })->whereIn('locale', ["tw", "en"]);
-
|