ProductRequest.php 707 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace App\Http\Requests;
  3. use Request;
  4. use Illuminate\Foundation\Http\FormRequest;
  5. class ProductRequest extends FormRequest
  6. {
  7. protected $table = 'products';
  8. /**
  9. * Determine if the user is authorized to make this request.
  10. *
  11. * @return bool
  12. */
  13. public function authorize()
  14. {
  15. return true;
  16. }
  17. /**
  18. * Get the validation rules that apply to the request.
  19. *
  20. * @return array
  21. */
  22. public function rules()
  23. {
  24. return [
  25. 'name' => 'required|string|max:50',
  26. 'belong' => 'required|max:50',
  27. 'href' => 'nullable|max:100',
  28. 'txt' => 'required'
  29. ];
  30. }
  31. }