Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save rajucs/e9691f8e98aefa4a3cc5d78e50905be5 to your computer and use it in GitHub Desktop.

Select an option

Save rajucs/e9691f8e98aefa4a3cc5d78e50905be5 to your computer and use it in GitHub Desktop.
laravel
Model::destroy($id);
model2::where('model_id/foreign_key',$id)->delete();
model3::where('model_id/foreign_key',$id)->delete();
Here Model lis related with Model 2 and Model 3.The relationship build with one to many.
If model id delete than others two relational data will be delete;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment