Hi,
I currently creating this somewhat complicated abstraction layer. is it possible to cancel or rollback save of model if for ex. i have 2 models
class User extends Eloquent {
//column name, address, bday
public function hobbies()
{
return $this->has_many('Hobbies');
}
}
Class Hobbies extends Eloquent
{
//column name, level, type
}
Usually to save this, you will save the User then, save the Hobbies
when user is save and on save of hobbies an error occured then how can I rollback the transaction for the user
the main thing is I may have a master model and many detail model what is the best approach of saving this onebyone or by batch and roll it back if DB error or any validation occur occured.
Is thier a way I can save the User Model and the has_many Models in one go, and rollback or dont save on any error?
Please help
Thanks
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community