1public function store()
2{
3 $this->validate(request(), [
4 'song' => [function ($attribute, $value, $fail) {
5 if ($value <= 10) {
6 $fail(':attribute needs more cowbell!');
7 }
8 }]
9 ]);
10}
11
1$validator = Validator::make($request->all(), [
2 'name' => 'required|min:2|max:255'
3]);
4
5if ($validator->fails()) {
6 return view('view_name');
7} else {
8 return view('view_name');
9}
10