Reputation: 10611
I can't manage to successfully delete an item with Asset::destroy($id)
when soft delete is enabled (with protected $softDelete = true;
in the model). The item doesn't get deleted, and deleted_at
is not updated. However if I remove the soft delete line from the model, then the item gets removed from the database. I haven't been able to get soft delete to work, or even to find out the cause of this issue.
This is my Asset model code,
<?php
class Asset extends Eloquent {
protected $guarded = array();
protected $softDelete = true;
public static $rules = array(
'message' => 'required'
);
public static function validate($data)
{
return Validator::make($data, static::$rules);
}
}
Upvotes: 1
Views: 2355
Reputation: 1478
Do you have the $table->softDeletes();
statement in your migration for this table, particularly?
This is the one you need to make the laravel knows it have to create the delete_at
field, which indicates you soft deleted it or not! =D
Upvotes: 2