This commit is contained in:
2024-09-01 18:54:23 +05:00
parent 76d18365a5
commit 061f09eca1
1597 changed files with 109451 additions and 1 deletions

View File

@@ -0,0 +1,49 @@
<?php
namespace Laravel\Nova\Http\Requests;
use Closure;
use Illuminate\Support\Collection;
class RestoreResourceRequest extends DeletionRequest
{
/**
* Get the selected models for the action in chunks.
*
* @param int $count
* @param \Closure(\Illuminate\Support\Collection):void $callback
* @return mixed
*/
public function chunks($count, Closure $callback)
{
return $this->chunkWithAuthorization($count, $callback, function ($models) {
return $this->restorableModels($models);
});
}
/**
* Get the models that may be restored.
*
* @param \Illuminate\Support\Collection $models
* @return \Illuminate\Support\Collection
*/
protected function restorableModels(Collection $models)
{
return $models->mapInto($this->resource())
->filter
->isSoftDeleted()
->filter
->authorizedToRestore($this)
->map->model();
}
/**
* Get the trashed status of the request.
*
* @return string
*/
protected function trashed()
{
return 'with';
}
}