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.

63 lines
1.2 KiB

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