Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Http\Requests;
- use Illuminate\Foundation\Http\FormRequest;
- class StoreBlog extends FormRequest
- {
- /**
- * Determine if the user is authorized to make this request.
- *
- * @return bool
- */
- public function authorize()
- {
- return true;
- }
- /**
- * Get the validation rules that apply to the request.
- *
- * @return array
- */
- public function rules()
- {
- return [
- 'title' => 'required',
- 'photo' => 'required|image|max:800',
- 'position' => 'required|integer',
- 'category' => 'required',
- 'description' => 'required|min:300',
- ];
- }
- public function messages()
- {
- return [
- 'title.required' => 'Pole <strong>tytuł bloga</strong> jest wymagane!',
- 'photo.required' => 'Pole <strong>zdjęcie wpisu</strong> jest wymagane!',
- 'photo.image' => 'Pole <strong>zdjęcie wpisu</strong> musi być musi być obrazem w formacie (jpeg, png, bmp, gif, or svg)!!',
- 'photo.max' => 'Pole <strong>zdjęcie wpisu</strong> nie może być większe niż 800KB!',
- 'position.required' => 'Pole <strong>pozycja wyświetlania</strong> jest wymagane!',
- 'position.integer' => 'Pole <strong>pozycja wyświetlania</strong> musi być wartością liczbową!',
- 'category.required' => 'Pole <strong>kategoria</strong> jest wymagane!',
- 'description.required' => 'Pole <strong>treść bloga</strong> jest wymagane!',
- 'description.min' => 'Pole <strong>treść bloga</strong> musi mieć co najmniej 300 znaków!',
- ];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement