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.

73 lines
1.5 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  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. use App\Models\Bucket;
  8. use App\Facades\FileManager;
  9. class BucketController extends BaseController
  10. {
  11. use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
  12. /**
  13. *
  14. *
  15. * @return
  16. *
  17. */
  18. public function single($id)
  19. {
  20. // create bucket
  21. $bucket = Bucket::find($id);
  22. // getting files
  23. $files = FileManager::find($bucket->path);
  24. return view('bucket.single', [
  25. 'bucket' => $bucket,
  26. 'files' => $files
  27. ]);
  28. }
  29. /**
  30. *
  31. *
  32. * @return [type] [description]
  33. *
  34. */
  35. public function create()
  36. {
  37. return view('bucket.create');
  38. }
  39. /**
  40. *
  41. *
  42. */
  43. public function store()
  44. {
  45. $validated = request()->validate([
  46. 'name' => 'required|max:255',
  47. 'description' => 'max:255',
  48. 'path' => 'present',
  49. 'is_public' => 'boolean',
  50. ]);
  51. if ($validated) {
  52. // create bucket
  53. $bucket = Bucket::create($validated);
  54. return redirect()
  55. ->route('bucket.single', [ 'id' => $bucket->id ]);
  56. } else {
  57. return back()
  58. ->withInput();
  59. }
  60. }
  61. }