我的模型是这样的:
<?php
namespace App\Models;
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
use Jenssegers\Mongodb\Eloquent\HybridRelations;
use Jenssegers\Mongodb\Eloquent\SoftDeletes;
class Message extends Eloquent
{
use HybridRelations;
use SoftDeletes;
protected $connection = 'mongodb';
protected $dates = ['deleted_at'];
protected $fillable = ['subject', 'information', 'created_at', 'update_at'];
}
如果我从这样的模型中获取数据:
Message::withTrashed()->find($id);
我成功获取了带有删除的数据
但我想在模型上定义它
所以当我打电话时:
Message::find($id);
它还可以使用已删除的数据
我该怎么做?