In Laravel when saving any record via elaquent, it also return save data. How to achieve this in adonis?
Is there any solution? Thanks.
It's actually pretty simple:
* createRole () {
role = new Role();
role.name = "New Role";
yield role.save();
console.log(role);
return role;
}
Variable role after yield role.save() will contain the last inserted id and other associated properties.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
It's actually pretty simple:
Variable
roleafteryield role.save()will contain the last inserted id and other associated properties.