You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.5 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <?php
  2. use App\Http\Controllers\CollectionController;
  3. use App\Http\Controllers\FileController;
  4. use App\Models\File;
  5. use Illuminate\Http\UploadedFile;
  6. use Illuminate\Support\Facades\Route;
  7. use Illuminate\Support\Facades\Storage;
  8. /*
  9. |--------------------------------------------------------------------------
  10. | API Routes
  11. |--------------------------------------------------------------------------
  12. |
  13. | Here is where you can register API routes for your application. These
  14. | routes are loaded by the RouteServiceProvider within a group which
  15. | is assigned the "api" middleware group. Enjoy building your API!
  16. |
  17. */
  18. // Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
  19. // return $request->user();
  20. // });
  21. Route::get('newTmp/{uuid}', function ($uuid) {
  22. $file = File::find($uuid);
  23. return Storage::disk('local')->temporaryUrl($file->server_path . $file->uuid . '.webp', now()->addMinutes(5),['collection_name'=>'Paris Renner II']);
  24. })->name('newTmp');
  25. Route::group(['as' => 'api.'], function () {
  26. Route::apiResource('collections', CollectionController::class);
  27. Route::delete('collections/{collection}', [CollectionController::class, "destroy"])->withTrashed();
  28. // Route::get('{collection_name}/{uuid}.{extention}', [FileController::class, 'show'])->name('files.show');
  29. Route::get('{collection_name}/{path}', [FileController::class, 'private'])->name('files.private');
  30. Route::post('{collection_name}/{model_id?}', [FileController::class, 'store'])->name('files.store');
  31. });