0👍
The Request does not have a validate
function.
One way to validate your request is:
<?php
...
use Validator;
class Controller extends BaseController
{
...
public function update(Request $request){
$array = $request->all();
$rules = array(
'name' => 'required|string',
'address' => 'required|strgin',
'photo' => 'image'
);
$validator = Validator::make($array, $ules);
if ($validator->fails()) {
return $this->setStatusCode(400)->respond([
'error' => [
'message' => $validator->messages(),
'status_code' => $this->getStatusCode()
]
]);
}
...
// store your data...
}
}
Also check the available validation rules
- [Vuejs]-How to specify priority for custom rules in vee-validate?
- [Vuejs]-How to use Cleave js/Vue-Cleave as a directive to input element in Vuejs?
Source:stackexchange.com