add nova
This commit is contained in:
47
nova/src/Http/Requests/LensActionRequest.php
Normal file
47
nova/src/Http/Requests/LensActionRequest.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Nova\Http\Requests;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use LogicException;
|
||||
|
||||
class LensActionRequest extends ActionRequest
|
||||
{
|
||||
use InteractsWithLenses;
|
||||
|
||||
/**
|
||||
* Transform the request into a query.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function toQuery()
|
||||
{
|
||||
return tap($this->lens()->query(LensRequest::createFrom($this), $this->newSearchQuery()), function ($query) {
|
||||
if (! $query instanceof Builder) {
|
||||
throw new LogicException('Lens must return an Eloquent query instance in order to apply actions.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform the request into a query without scope.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function toQueryWithoutScopes()
|
||||
{
|
||||
return $this->toQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the all actions for the request.
|
||||
*
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
protected function resolveActions()
|
||||
{
|
||||
return $this->isPivotAction()
|
||||
? $this->lens()->resolvePivotActions($this)
|
||||
: $this->lens()->resolveActions($this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user