Controller.php 831 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App\Http\Controllers;
  3. use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
  4. use Illuminate\Foundation\Bus\DispatchesJobs;
  5. use Illuminate\Foundation\Validation\ValidatesRequests;
  6. use Illuminate\Routing\Controller as BaseController;
  7. class Controller extends BaseController
  8. {
  9. use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
  10. public function ping()
  11. {
  12. return response()->redirectTo("/pc/");
  13. }
  14. public function upload()
  15. {
  16. $file = request()->file("file");
  17. $category = request()->input("category", "default");
  18. $path = "/storage/" . $file->store(date("Ymd") . "/" . $category, "public");
  19. return [
  20. "code" => 200,
  21. "data" => [
  22. "upload_url" => config("app.url") . $path,
  23. ],
  24. ];
  25. }
  26. }