| 1 | <?php |
||
| 9 | class ContactFormRequest extends FormRequest |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * Determine if the user is authorized to make this request. |
||
| 13 | * |
||
| 14 | * @return bool |
||
| 15 | */ |
||
| 16 | public function authorize() |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Prepare the data for validation. |
||
| 23 | * |
||
| 24 | * @return void |
||
| 25 | */ |
||
| 26 | protected function prepareForValidation() |
||
| 27 | { |
||
| 28 | $data = $this->all(); |
||
| 29 | |||
| 30 | $data['entity_id'] = $this->user()->id; |
||
| 31 | $data['entity_type'] = get_class($this->user()); |
||
| 32 | |||
| 33 | $this->replace($data); |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Get the validation rules that apply to the request. |
||
| 38 | * |
||
| 39 | * @return array |
||
| 40 | */ |
||
| 41 | public function rules() |
||
| 48 | } |
||
| 49 |