I have the code below on the route, but it does not work! What am I doing wrong? It is returning users correctly, but it does not delete.
$Usuario = User::find(2);
$Usuario->delete();
return User::orderBy('username', 'asc')->take(4)->get();
I have the code below on the route, but it does not work! What am I doing wrong? It is returning users correctly, but it does not delete.
$Usuario = User::find(2);
$Usuario->delete();
return User::orderBy('username', 'asc')->take(4)->get();
Use builder instead of ORM as test
DB::table('users')->where('id', 2)->delete();
I believe it will work well
Add the primary key definition in your model:
protected $ primaryKey = 'ID';
For me it worked ...