I have added $table->softDeletes() to my migration file and have added the protected $softDelete = true; to my model, and I do have the deleted_at in my table. But whenever I call delete(), the entire row is deleted. Here is how I am calling my delete:
Schedule::whereId($id)->whereClientId($client_id)->delete();
What am I doing wrong?
In case somebody bumps into this question. You can still use SoftDeletes in Laravel 5. Just use the softdeletes trait.
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes; //<--- use the softdelete traits
class YourModel extends Model
{
use SoftDeletes; //<--- use the softdelete traits
protected $dates = ['deleted_at']; //<--- new field to be added in your table
protected $fillable = [
];
}
You can view laravel docs or This great tutorial on how to softdelete
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With