api.php 885 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. use Illuminate\Http\Request;
  3. use Illuminate\Support\Facades\Route;
  4. use App\Http\Controllers\API;
  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::middleware('auth:sanctum')->get('/user', function (Request $request) {
  16. return $request->user();
  17. });
  18. Route::post("/login", [API\AuthController::class, "login"]);
  19. Route::middleware(['auth:sanctum'])->group(function () {
  20. Route::post("/logout", [API\AuthController::class, "logout"]);
  21. Route::apiResources([
  22. 'asset-group' => API\AssetGroupController::class,
  23. ]);
  24. });