codewiser/soft-deletes 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

codewiser/soft-deletes

最新稳定版本:v1.0.3

Composer 安装命令:

composer require codewiser/soft-deletes

包简介

Laravel Soft Deleting (Passive)

README 文档

README

This package provides Laravel Model Soft Deleting functionality that is disabled by default. No models are scoped out implicitly.

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Codewiser\SoftDeletes\PassiveSoftDeletes;

class Flight extends Model
{
    use PassiveSoftDeletes;
}

Alternatively to Laravel SoftDeletes, PassiveSoftDeletes counts model as thrashed not only then deleted_at attribute is not null but deleted_at is in the past. So you may trash models in advance.

As PassiveSoftDeletes doesn't apply any scopes by default, Route::withTrashed() is unnecessary. You should explicitly scope queries.

Builder

PassiveSoftDeletes doesn't utilize withTrashed builder method. You may use it but it has no sense.

withoutTrashed and onlyTrashed methods influence to records trashed to current moment of time. You may pass the exact date.

// Will exclude flights with `deleted_at` < now()

Flight::query()->withoutTrashed();

// Will return only flights with `deleted_at` in a next month

Flight::query()->onlyTrashed(now()->addMonth());

统计信息

  • 总下载量: 250
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 1

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-28