I search for all the web and don't find a solution other than a custom function that we must make. I develops in Node.js and Laravel backend applications.
And in Node.js we send a object exacly equal to the database collumns and we just use Sequelize insert function like this:
async store(model) {
try {
await this.model.city.create(model);
} catch (error) {
throw error;
}
}
We simply use the same object that sending from the app we store like this store(object); and works fine.
In Laravel I always must reference the columns even so the objects have the same from they like this:
$categoryObj = new Category;
$categoryObj->name = $category['name'];
$categoryObj->save();
return $categoryObj;
I want to just make something like this:
$categoryObj = new Category;
$categoryObj = $category;
$categoryObj->save();
return $categoryObj;
It is possible?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Skiq1g
via IFTTT
Aucun commentaire:
Enregistrer un commentaire