Store.php 844 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace App\Http\Requests\FriendshipLink;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. class Store extends FormRequest
  5. {
  6. /**
  7. * Determine if the user is authorized to make this request.
  8. *
  9. * @return bool
  10. */
  11. public function authorize()
  12. {
  13. return true;
  14. }
  15. /**
  16. * Get the validation rules that apply to the request.
  17. *
  18. * @return array
  19. */
  20. public function rules()
  21. {
  22. return [
  23. 'name'=>'required|unique:friendship_links,name,'.$this->route()->id,
  24. 'url'=>'required|unique:friendship_links,url,'.$this->route()->id,
  25. ];
  26. }
  27. /**
  28. * 定义字段名中文
  29. *
  30. * @return array
  31. */
  32. public function attributes()
  33. {
  34. return [
  35. 'name'=>'名称',
  36. 'url'=>'链接',
  37. ];
  38. }
  39. }