Support the ongoing development of Laravel.io →
Database Eloquent Queues
Last updated 1 month ago.
0

That table got an 'id' column right?

Just use:

Restaurant::where('id', $v['id'])->delete();
0

I'm curious by the way, why would you delete records while you fetch it and return it to view?

0

Are you sure your code is running fine, as i haven't see where $restaurants variable is setting,

anyways you must got the model object inside this loop , you can simply do

$data->delete();
0

Sign in to participate in this thread!

LaraJobs

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.