Model delete method does not delete the record

0

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();
    
asked by anonymous 17.08.2014 / 16:56

2 answers

1

Use builder instead of ORM as test

DB::table('users')->where('id', 2)->delete();

I believe it will work well

    
20.08.2014 / 13:30
0

Add the primary key definition in your model:

protected $ primaryKey = 'ID';

For me it worked ...

    
30.01.2016 / 17:05