Answer the question
In order to leave comments, you need to log in
What is the best practice for converting incoming JSON when creating/updating a model via an API, where is the custom to do so?
Essence of the question:
When creating a model, we get on / api / create JSON in which there are 100500 variables, which then need to be somehow tied to the model, supplemented with other data, and saved.
It turns out such a sheet
$user->name = $input['name'];
$user->address = $input['address'];
...
$user->babushka = $input['babushka'];
$user->save();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question