UserManagerStoreRequest.php 667 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace App\Api\v1\Requests;
  3. use App\Http\Requests\UserStoreRequest;
  4. use Illuminate\Support\Facades\Auth;
  5. class UserManagerStoreRequest extends UserStoreRequest
  6. {
  7. /**
  8. * Determine if the user is authorized to make this request.
  9. *
  10. * @return bool
  11. */
  12. public function authorize()
  13. {
  14. return Auth::user()->isAdministrator();
  15. }
  16. /**
  17. * Get the validation rules that apply to the request.
  18. *
  19. * @return array
  20. */
  21. public function rules()
  22. {
  23. return array_merge(
  24. parent::rules(),
  25. [
  26. 'is_admin' => 'required|boolean',
  27. ],
  28. );
  29. }
  30. }