| @@ 5-42 (lines=38) @@ | ||
| 2 | ||
| 3 | use WITR\Http\Requests\Request; |
|
| 4 | ||
| 5 | class CreateRequest extends Request { |
|
| 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 true; |
|
| 15 | } |
|
| 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 | 'band_name' => 'required', |
|
| 26 | 'album_name' => 'required', |
|
| 27 | 'review' => 'required', |
|
| 28 | 'img_name' => 'required|image' |
|
| 29 | ]; |
|
| 30 | } |
|
| 31 | ||
| 32 | public function messages() |
|
| 33 | { |
|
| 34 | return [ |
|
| 35 | 'img_name.required' => 'The album cover is required.', |
|
| 36 | 'img_name.image' => 'The album cover should be an image.', |
|
| 37 | 'band_name.required' => 'The artist field is required', |
|
| 38 | 'album_name.required' => 'The album field is required', |
|
| 39 | ]; |
|
| 40 | } |
|
| 41 | ||
| 42 | } |
|
| 43 | ||
| @@ 5-42 (lines=38) @@ | ||
| 2 | ||
| 3 | use WITR\Http\Requests\Request; |
|
| 4 | ||
| 5 | class UpdateRequest extends Request { |
|
| 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 true; |
|
| 15 | } |
|
| 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 | 'band_name' => 'required', |
|
| 26 | 'album_name' => 'required', |
|
| 27 | 'review' => 'required', |
|
| 28 | 'img_name' => 'sometimes|image' |
|
| 29 | ]; |
|
| 30 | } |
|
| 31 | ||
| 32 | public function messages() |
|
| 33 | { |
|
| 34 | return [ |
|
| 35 | 'img_name.required' => 'The album cover is required.', |
|
| 36 | 'img_name.image' => 'The album cover should be an image.', |
|
| 37 | 'band_name.required' => 'The artist field is required', |
|
| 38 | 'album_name.required' => 'The album field is required', |
|
| 39 | ]; |
|
| 40 | } |
|
| 41 | ||
| 42 | } |
|
| 43 | ||