第一种方法

<?php
namespace Table;
use Illuminate\Database\Eloquent\Builder;
/**
*
*
*/
class TSingleService extends Table{
     
    protected $table = 'single_service_list';
    public $timestamps = false;

    /**
     * 设置单项服务全局查询条件
    */
    protected static function boot()
     {
         parent::boot(); // TODO: Change the autogenerated stub
         static::addGlobalScope('avaiable',function (Builder $builder){
             $builder->where('deleted_at','=',NULL);
         });
     }
}

  

第二种方法

<?php
namespace Table;

use Illuminate\Database\Eloquent\SoftDeletes;
/**
*
*
*/
class TSingleService extends Table{
    use SoftDeletes;
    protected $table = 'single_service_list';
    protected $dates = ['deleted_at'];
    public $timestamps = false;

}

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-05-28
  • 2022-12-23
  • 2022-01-02
  • 2022-02-03
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-24
  • 2022-12-23
  • 2022-12-23
  • 2021-06-20
  • 2022-12-23
相关资源
相似解决方案