I am getting an error when i click the delete button which calls Controller@delete
method on a controller.
Call to undefined method Illuminate\Database\Query\Builder::destroy()
throw new BadMethodCallException("Call to undefined method {$className}::{$method}()");
destroy method
public function destroy($id)
{
User::where('role', 'admin')->destroy($id);
return redirect('/home')->with('message', 'Deleted!');
}
User::find($id)->delete();
Hope this fixed it! – Hiren Gohel$user = User::where('role', 'admin')->where('id', $id); $user->delete();
– Hiren Gohel