mardi 30 avril 2019

INSERT new row or DELETE old row IF it already exists using laravel

I am assigning multiple skills to an employee using checkboxes. when a user checks the checkbox a new record is inserted into pivot table. if a user unchecks the checkbox a record is deleted.

Now i am wondering if there is any function for insert or delete like there exists for new insert or update which is updateOrCreate to update an existing record or create a new record if none exists.

I can do it the hard way. but just want to know if there is any function for this like updateOrCreate.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire