123456789101112131415161718192021222324252627282930
  1. <?php
  2. use App\Http\Controllers\Api\EsgController;
  3. use App\Http\Controllers\Api\NewsController;
  4. use Illuminate\Support\Facades\Route;
  5. /*
  6. |--------------------------------------------------------------------------
  7. | API Routes
  8. |--------------------------------------------------------------------------
  9. |
  10. | Here is where you can register API routes for your application. These
  11. | routes are loaded by the RouteServiceProvider and all of them will
  12. | be assigned to the "api" middleware group. Make something great!
  13. |
  14. */
  15. Route::prefix('{locale}')->where(['locale' => 'tw|en'])->group(function () {
  16. Route::prefix('news')->group(function () {
  17. Route::get('/', [NewsController::class, 'getTop']);
  18. Route::get('/list', [NewsController::class, 'list']);
  19. Route::get('/detail/{id}', [NewsController::class, 'detail'])->where('id', '[0-9]+');
  20. });
  21. Route::prefix('esg')->group(function () {
  22. Route::get('/', [EsgController::class, 'main']);
  23. Route::get('/{key}', [EsgController::class, 'esgContent']);
  24. });
  25. });