@xtremer360 I can’t say I’ve created a “pseudo” property like this in a request. But I set which columns are fillable and then use $request->validated() when creating/updating a model.
In your case you could either use $request->input() instead to get all request data and only set values for columns that are fillable (including your height column). If you’re absolutely adamant on using validated() for whatever reason, then you could fill your model with the validated request data, and then explicitly set the height value before saving:
$patient = new Patient($request->validated());
$patient->height = $request->input('height');
$patient->save();
Or, you could add your height value to the validated values:
$patient = Patient::create(array_merge($request->validated(), [
'height' => $request->input('height'),
]));
Or, the simplest method, override the validated() method in your StorePatientRequest class if you’re sure you want the height value in there:
class StorePatientRequest extends FormRequest
{
// Other form request methods like rules(), etc.
public function validated()
{
return array_merge(parent::validated(), [
'height' => $this->input('height'),
]);
}
}
You can then use validated() as intended:
$patient = Patient::create($request->validated());