class User extends Eloquent
{
public function photos()
{
return $this->has_many('Photo');
}
// this is a recommended way to declare event handlers
public static function boot() {
parent::boot();
static::deleting(function($user) { // before delete() method call this
$user->photos()->delete();
// do the rest of the cleanup...
});
}
}
I already fixed it. In my model history I add withtrashed.
public function history()
{
return $this->hasMany(History::class)->withTrashed();
}
$transferOrder->dates()->delete();