Laravel 5.2 withTrashed
Laravel 5.2 withTrashed
我正在学习 Laravel,我想看看 withTrashed()
方法,但我在任何地方都找不到。我查看了 IDE 中的文件,但没有任何迹象。然后我浏览了 Laravel 的 API 文档,但我也在那里找不到它。但是当我在我的代码中使用它时它起作用了。那它位于哪里呢?它是什么 return(我只从文档中的代码片段中 c+p)?
为了回答这个问题,代码看起来包含在
/vendor/laravel/framework/src/Illuminate/Database/Eloquent/SoftDeletingScope.php
具体来说:
// 12:
protected $extensions = ['Restore', 'WithTrashed', 'WithoutTrashed', 'OnlyTrashed'];
// 71:
$builder->macro('restore', function (Builder $builder) {
$builder->withTrashed();
...
// 83 and 85:
protected function addWithTrashed(Builder $builder){
$builder->macro('withTrashed', function (Builder $builder) {
return $builder->withoutGlobalScope($this);
});
我正在学习 Laravel,我想看看 withTrashed()
方法,但我在任何地方都找不到。我查看了 IDE 中的文件,但没有任何迹象。然后我浏览了 Laravel 的 API 文档,但我也在那里找不到它。但是当我在我的代码中使用它时它起作用了。那它位于哪里呢?它是什么 return(我只从文档中的代码片段中 c+p)?
为了回答这个问题,代码看起来包含在
/vendor/laravel/framework/src/Illuminate/Database/Eloquent/SoftDeletingScope.php
具体来说:
// 12:
protected $extensions = ['Restore', 'WithTrashed', 'WithoutTrashed', 'OnlyTrashed'];
// 71:
$builder->macro('restore', function (Builder $builder) {
$builder->withTrashed();
...
// 83 and 85:
protected function addWithTrashed(Builder $builder){
$builder->macro('withTrashed', function (Builder $builder) {
return $builder->withoutGlobalScope($this);
});