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,26 @@
<?php
namespace Laravel\Nova\Contracts;
use Illuminate\Bus\PendingBatch;
use Laravel\Nova\Fields\ActionFields;
interface BatchableAction
{
/**
* Register `then`, `catch`, and `finally` callbacks on the pending batch.
*
* @param \Laravel\Nova\Fields\ActionFields $fields
* @param \Illuminate\Bus\PendingBatch $batch
* @return void
*/
public function withBatch(ActionFields $fields, PendingBatch $batch);
/**
* Set the batch ID on the job.
*
* @param string $batchId
* @return $this
*/
public function withBatchId(string $batchId);
}

View File

@@ -0,0 +1,13 @@
<?php
namespace Laravel\Nova\Contracts;
interface BehavesAsPanel
{
/**
* Make current field behaves as panel.
*
* @return \Laravel\Nova\Panel
*/
public function asPanel();
}

View File

@@ -0,0 +1,27 @@
<?php
namespace Laravel\Nova\Contracts;
interface Cover
{
/**
* Resolve the thumbnail URL for the field.
*
* @return string|null
*/
public function resolveThumbnailUrl();
/**
* Determine whether the field should have rounded corners.
*
* @return bool
*/
public function isRounded();
/**
* Determine whether the field should have squared corners.
*
* @return bool
*/
public function isSquared();
}

View File

@@ -0,0 +1,42 @@
<?php
namespace Laravel\Nova\Contracts;
/**
* @mixin \Laravel\Nova\Fields\Field
*
* @property callable(\Laravel\Nova\Http\Requests\NovaRequest, mixed, ?string, ?string):mixed $deleteCallback
*/
interface Deletable
{
/**
* Specify the callback that should be used to delete the field.
*
* @param callable(\Laravel\Nova\Http\Requests\NovaRequest, mixed, ?string, ?string):mixed $deleteCallback
* @return $this
*/
public function delete(callable $deleteCallback);
/**
* Specify if the field is able to be deleted.
*
* @param bool $deletable
* @return $this
*/
public function deletable($deletable = true);
/**
* Determine if the field should be pruned when the resource is deleted.
*
* @return bool
*/
public function isPrunable();
/**
* Specify if the field should be pruned when the resource is deleted.
*
* @param bool $prunable
* @return $this
*/
public function prunable($prunable = true);
}

View File

@@ -0,0 +1,13 @@
<?php
namespace Laravel\Nova\Contracts;
/**
* @method \Illuminate\Http\Response toDownloadResponse(\Laravel\Nova\Http\Requests\NovaRequest $request, \Laravel\Nova\Resource $resource)
*
* @mixin \Laravel\Nova\Fields\Field
*/
interface Downloadable
{
//
}

View File

@@ -0,0 +1,34 @@
<?php
namespace Laravel\Nova\Contracts;
use Illuminate\Http\Request;
use Laravel\Nova\Http\Requests\NovaRequest;
interface Filter
{
/**
* Get the key for the filter.
*
* @return string
*/
public function key();
/**
* Apply the filter to the given query.
*
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
* @param \Illuminate\Database\Eloquent\Builder $query
* @param mixed $value
* @return \Illuminate\Database\Eloquent\Builder
*/
public function apply(NovaRequest $request, $query, $value);
/**
* Determine if the filter should be available for the given request.
*
* @param \Illuminate\Http\Request $request
* @return bool
*/
public function authorizedToSee(Request $request);
}

View File

@@ -0,0 +1,43 @@
<?php
namespace Laravel\Nova\Contracts;
use Laravel\Nova\Http\Requests\NovaRequest;
/**
* @mixin \Laravel\Nova\Fields\Field
*
* @method array jsonSerialize()
*
* @property string $attribute
* @property callable|null $filterableCallback
* @property string $name
* @property string $resourceClass
*/
interface FilterableField
{
/**
* Apply the filter to the given query.
*
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
* @param \Illuminate\Database\Eloquent\Builder $query
* @param mixed $value
* @return void
*/
public function applyFilter(NovaRequest $request, $query, $value);
/**
* Make the field filter.
*
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
* @return \Laravel\Nova\Fields\Filters\Filter|null
*/
public function resolveFilter(NovaRequest $request);
/**
* Prepare the field for JSON serialization.
*
* @return array
*/
public function serializeForFilter();
}

View File

@@ -0,0 +1,62 @@
<?php
namespace Laravel\Nova\Contracts;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Contracts\Auth\StatefulGuard;
use Illuminate\Http\Request;
interface ImpersonatesUsers
{
/**
* Start impersonating a user.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Contracts\Auth\StatefulGuard $guard
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @return bool
*/
public function impersonate(Request $request, StatefulGuard $guard, Authenticatable $user);
/**
* Stop impersonating the currently impersonated user and revert to the original session.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Contracts\Auth\StatefulGuard $guard
* @param string $userModel
* @return bool
*/
public function stopImpersonating(Request $request, StatefulGuard $guard, string $userModel);
/**
* Determine if a user is currently being impersonated.
*
* @param \Illuminate\Http\Request $request
* @return bool
*/
public function impersonating(Request $request);
/**
* Remove any impersonation data from the session.
*
* @param \Illuminate\Http\Request $request
* @return void
*/
public function flushImpersonationData(Request $request);
/**
* Redirect an admin after starting impersonation.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\JsonResponse
*/
public function redirectAfterStartingImpersonation(Request $request);
/**
* Redirect an admin after finishing impersonation.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\JsonResponse
*/
public function redirectAfterStoppingImpersonation(Request $request);
}

View File

@@ -0,0 +1,11 @@
<?php
namespace Laravel\Nova\Contracts;
/**
* @mixin \Laravel\Nova\Fields\Field
*/
interface ListableField extends BehavesAsPanel
{
//
}

View File

@@ -0,0 +1,14 @@
<?php
namespace Laravel\Nova\Contracts;
/**
* @mixin \Laravel\Nova\Fields\Field
*
* @property bool $allowDuplicateRelations
* @property string $manyToManyRelationship
*/
interface PivotableField
{
//
}

View File

@@ -0,0 +1,17 @@
<?php
namespace Laravel\Nova\Contracts;
/**
* @mixin \Laravel\Nova\Fields\Field
*/
interface Previewable
{
/**
* Return a preview for the given field value.
*
* @param string $value
* @return mixed
*/
public function previewFor($value);
}

View File

@@ -0,0 +1,96 @@
<?php
namespace Laravel\Nova\Contracts;
use Laravel\Nova\Http\Requests\NovaRequest;
use Laravel\Nova\TrashedStatus;
/**
* @method $this tap(callable(\Illuminate\Database\Eloquent\Builder):void $callback)
*/
interface QueryBuilder
{
/**
* Build a "whereKey" query for the given resource.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param string $key
* @return $this
*/
public function whereKey($query, $key);
/**
* Build a "search" query for the given resource.
*
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
* @param \Illuminate\Database\Eloquent\Builder $query
* @param string|null $search
* @param array<int, \Laravel\Nova\Query\ApplyFilter> $filters
* @param array<string, string> $orderings
* @param string $withTrashed
* @return $this
*/
public function search(NovaRequest $request, $query, $search = null,
array $filters = [], array $orderings = [],
$withTrashed = TrashedStatus::DEFAULT);
/**
* Set the "take" directly to Scout or Eloquent builder.
*
* @param int $limit
* @return $this
*/
public function take($limit);
/**
* Defer setting a "limit" using query callback and only executed via Eloquent builder.
*
* @param int $limit
* @return $this
*/
public function limit($limit);
/**
* Get the results of the search.
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public function get();
/**
* Get a lazy collection for the given query by chunks of the given size.
*
* @param int $chunkSize
* @return \Illuminate\Support\LazyCollection
*/
public function lazy($chunkSize = 1000);
/**
* Get a lazy collection for the given query.
*
* @return \Illuminate\Support\LazyCollection
*/
public function cursor();
/**
* Get the paginated results of the query.
*
* @param int $perPage
* @return array{0: \Illuminate\Contracts\Pagination\Paginator, 1: int|null, 2: bool}
*/
public function paginate($perPage);
/**
* Convert the query builder to an Eloquent query builder (skip using Scout).
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function toBase();
/**
* Convert the query builder to fluent query builder (skip using Scout).
*
* @return \Illuminate\Database\Query\Builder
*/
public function toBaseQueryBuilder();
}

View File

@@ -0,0 +1,27 @@
<?php
namespace Laravel\Nova\Contracts;
/**
* @mixin \Laravel\Nova\Fields\Field
*
* @property string $attribute
* @property \Laravel\Nova\Resource $resourceClass
* @property string $resourceName
*/
interface RelatableField
{
/**
* Get the relationship name.
*
* @return string
*/
public function relationshipName();
/**
* Get the relationship type.
*
* @return string
*/
public function relationshipType();
}

View File

@@ -0,0 +1,29 @@
<?php
namespace Laravel\Nova\Contracts;
/**
* @property bool $pivot
* @property string|null $pivotAccessor
* @property \Illuminate\Database\Eloquent\Relations\MorphToMany|\Illuminate\Database\Eloquent\Relations\BelongsToMany|null $pivotRelation
*/
interface Resolvable
{
/**
* Resolve the element's value.
*
* @param mixed $resource
* @param string|null $attribute
* @return void
*/
public function resolve($resource, $attribute = null);
/**
* Resolve the field's value for display.
*
* @param mixed $resource
* @param string|null $attribute
* @return void
*/
public function resolveForDisplay($resource, $attribute = null);
}

View File

@@ -0,0 +1,34 @@
<?php
namespace Laravel\Nova\Contracts;
interface Storable
{
/**
* Get the disk that the field is stored on.
*
* @return string|null
*/
public function getStorageDisk();
/**
* Get the default disk for the field.
*
* @return string
*/
public function getDefaultStorageDisk();
/**
* Get the dir that the field is stored at on disk.
*
* @return string|null
*/
public function getStorageDir();
/**
* Get the full path that the field is stored at on disk.
*
* @return string|null
*/
public function getStoragePath();
}