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.

39 lines
1.7 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. Route::put('{collection_name}/{uuid}.{extention}',[FileController::class,'update'])->name('files.update');
  32. Route::delete('{collection_name}/{uuid}.{extention}',[FileController::class,'destroy'])->withTrashed()->name('files.destroy');
  33. });