abstract class ModuleController extends Controller (View source)

Traits

AuthorizesRequests
DispatchesJobs
ValidatesRequests

Properties

protected Application $app
protected Request $request
protected string $namespace
protected string $routePrefix
protected string $moduleName
protected string $modelName
protected string $modelTitle
protected ModuleRepository $repository
protected array $defaultIndexOptions

Options of the index view.

protected array $indexWith

Relations to eager load for the index view.

protected array $formWith

Relations to eager load for the form view.

protected array $formWithCount

Relation count to eager load for the form view.

protected array $filters

Additional filters for the index view.

$filterLinks

Additional links to display in the listing filter.

protected array $filtersDefaultOptions

Filters that are selected by default in the index view.

protected array $defaultOrders

Default orders for the index view.

protected int $perPage
protected string $titleColumnKey

Name of the index column to use as name column.

protected string $identifierColumnKey

Name of the index column to use as identifier column.

protected string $titleFormKey

Attribute to use as title in forms.

protected string $featureField

Feature field name if the controller is using the feature route (defaults to "featured").

protected bool $submodule

Indicates if this module is edited through a parent module.

protected int|null $submoduleParentId
protected bool $disableEditor

Can be used in child classes to disable the content editor (full screen block editor).

protected array $indexOptions
protected array $indexColumns
protected array $browserColumns
protected string $permalinkBase
protected array $defaultFilters
protected string $viewPrefix
protected string $previewView
protected array $fieldsPermissions

List of permissions keyed by a request field. Can be used to prevent unauthorized field updates.

protected bool $enableDraftRevisions

Determines if draft revisions can be added on top of published content.

Methods

__construct(Application $app, Request $request)

No description

void
removeMiddleware(string $middleware)

Attempts to unset the given middleware.

array|null
getSubmitOptions(Model $item)

No description

array|null
getSubmitOptionsForDraftRevisions(Model $item)

No description

void
setMiddlewarePermission()

No description

string|int|null
getParentModuleIdFromRequest(Request $request)

No description

array|View
index(int|null $parentModuleId = null)

No description

JsonResponse
browser()

No description

JsonResponse
store(int|null $parentModuleId = null)

No description

RedirectResponse
show($id, int|null $submoduleId = null)

No description

JsonResponse|RedirectResponse|View
edit(int $id, int|null $submoduleId = null)

No description

JsonResponse|RedirectResponse|View
create(int $parentModuleId = null)

No description

JsonResponse
update(int $id, int|null $submoduleId = null)

No description

performUpdate($item)

No description

View
preview(int $id)

No description

View
restoreRevision(int $id)

No description

JsonResponse
publish()

No description

JsonResponse
bulkPublish()

No description

JsonResponse
duplicate(int $id, int|null $submoduleId = null)

No description

JsonResponse
destroy(int $id, int|null $submoduleId = null)

No description

JsonResponse
bulkDelete()

No description

JsonResponse
forceDelete()

No description

JsonResponse
bulkForceDelete()

No description

JsonResponse
restore()

No description

JsonResponse
bulkRestore()

No description

JsonResponse
feature()

No description

JsonResponse
bulkFeature()

No description

JsonResponse
reorder()

No description

JsonResponse
tags()

No description

array
additionalTableActions()

No description

array
getIndexData(array $prependScope = [])

No description

array
indexData(Request $request)

No description

Collection
getIndexItems(array $scopes = [], bool $forcePagination = false)

No description

Collection
transformIndexItems(Collection $items)

No description

array
getIndexTableData(Collection $items)

No description

array
indexItemData(Model $item)

No description

array
getItemColumnData(Model $item, array $column)

No description

int|string
getItemIdentifier(Model $item)

No description

array
getIndexTableColumns(Collection $items)

No description

array
getIndexTableMainFilters(Collection $items, array $scopes = [])

No description

array
getIndexUrls(string $moduleName, string $routePrefix)

No description

bool
getIndexOption(string $option)

No description

array
getBrowserData(array $prependScope = [])

No description

array
getBrowserTableData(Collection $items)

No description

Collection
getBrowserItems(array $scopes = [])

No description

array
filterScope(array $prepend = [])

No description

array
getRequestFilters()

No description

void
applyFiltersDefaultOptions()

No description

array
orderScope()

No description

array
form(int $id, Model|null $item = null)

No description

array
modalFormData(int $id)

No description

array
formData(Request $request)

No description

array
previewData(Request $item)

No description

validateFormRequest()

No description

getFormRequestClass()

No description

string
getNamespace()

No description

string
getRoutePrefix()

No description

string
getModulePermalinkBase()

No description

string
getModelName()

No description

getRepository()

No description

getRepositoryClass($model)

No description

string|null
getViewPrefix()

No description

string
getModelTitle()

No description

string
getParentModuleForeignKey()

No description

string
getPermalinkBaseUrl()

No description

array
getLocalizedPermalinkBase()

No description

string
getPermalinkPrefix(string $baseUrl)

No description

string
getModuleRoute(int $id, string $action)

No description

bool
moduleHas(string $behavior)

No description

bool
titleIsTranslatable()

No description

void
setBackLink(string|null $back_link = null, array $params = [])

No description

string
getBackLink(string|null $fallback = null, array $params = [])

No description

string
getBackLinkSessionKey()

No description

RedirectResponse
redirectToForm(int $id, array $params = [])

No description

JsonResponse
respondWithSuccess(string $message)

No description

JsonResponse
respondWithRedirect(string $redirectUrl)

No description

JsonResponse
respondWithError(string $message)

No description

JsonResponse
respondWithJson(string $message, mixed $variant)

No description

void
fireEvent(array $input = [])

No description

Collection|Block[]
getRepeaterList()

No description

Details

__construct(Application $app, Request $request)

No description

Parameters

Application $app
Request $request

void removeMiddleware(string $middleware)

Attempts to unset the given middleware.

Parameters

string $middleware

Return Value

void

array|null getSubmitOptions(Model $item)

No description

Parameters

Model $item

Return Value

array|null

protected array|null getSubmitOptionsForDraftRevisions(Model $item)

No description

Parameters

Model $item

Return Value

array|null

protected void setMiddlewarePermission()

No description

Return Value

void

protected string|int|null getParentModuleIdFromRequest(Request $request)

No description

Parameters

Request $request

Return Value

string|int|null

array|View index(int|null $parentModuleId = null)

No description

Parameters

int|null $parentModuleId

Return Value

array|View

JsonResponse browser()

No description

Return Value

JsonResponse

JsonResponse store(int|null $parentModuleId = null)

No description

Parameters

int|null $parentModuleId

Return Value

JsonResponse

RedirectResponse show($id, int|null $submoduleId = null)

No description

Parameters

$id
int|null $submoduleId

Return Value

RedirectResponse

JsonResponse|RedirectResponse|View edit(int $id, int|null $submoduleId = null)

No description

Parameters

int $id
int|null $submoduleId

Return Value

JsonResponse|RedirectResponse|View

JsonResponse|RedirectResponse|View create(int $parentModuleId = null)

No description

Parameters

int $parentModuleId

Return Value

JsonResponse|RedirectResponse|View

JsonResponse update(int $id, int|null $submoduleId = null)

No description

Parameters

int $id
int|null $submoduleId

Return Value

JsonResponse

protected performUpdate($item)

No description

Parameters

$item

View preview(int $id)

No description

Parameters

int $id

Return Value

View

View restoreRevision(int $id)

No description

Parameters

int $id

Return Value

View

JsonResponse publish()

No description

Return Value

JsonResponse

JsonResponse bulkPublish()

No description

Return Value

JsonResponse

JsonResponse duplicate(int $id, int|null $submoduleId = null)

No description

Parameters

int $id
int|null $submoduleId

Return Value

JsonResponse

JsonResponse destroy(int $id, int|null $submoduleId = null)

No description

Parameters

int $id
int|null $submoduleId

Return Value

JsonResponse

JsonResponse bulkDelete()

No description

Return Value

JsonResponse

JsonResponse forceDelete()

No description

Return Value

JsonResponse

JsonResponse bulkForceDelete()

No description

Return Value

JsonResponse

JsonResponse restore()

No description

Return Value

JsonResponse

JsonResponse bulkRestore()

No description

Return Value

JsonResponse

JsonResponse feature()

No description

Return Value

JsonResponse

JsonResponse bulkFeature()

No description

Return Value

JsonResponse

JsonResponse reorder()

No description

Return Value

JsonResponse

JsonResponse tags()

No description

Return Value

JsonResponse

array additionalTableActions()

No description

Return Value

array

protected array getIndexData(array $prependScope = [])

No description

Parameters

array $prependScope

Return Value

array

protected array indexData(Request $request)

No description

Parameters

Request $request

Return Value

array

protected Collection getIndexItems(array $scopes = [], bool $forcePagination = false)

No description

Parameters

array $scopes
bool $forcePagination

Return Value

Collection

protected Collection transformIndexItems(Collection $items)

No description

Parameters

Collection $items

Return Value

Collection

protected array getIndexTableData(Collection $items)

No description

Parameters

Collection $items

Return Value

array

protected array indexItemData(Model $item)

No description

Parameters

Model $item

Return Value

array

protected array getItemColumnData(Model $item, array $column)

No description

Parameters

Model $item
array $column

Return Value

array

protected int|string getItemIdentifier(Model $item)

No description

Parameters

Model $item

Return Value

int|string

protected array getIndexTableColumns(Collection $items)

No description

Parameters

Collection $items

Return Value

array

protected array getIndexTableMainFilters(Collection $items, array $scopes = [])

No description

Parameters

Collection $items
array $scopes

Return Value

array

protected array getIndexUrls(string $moduleName, string $routePrefix)

No description

Parameters

string $moduleName
string $routePrefix

Return Value

array

protected bool getIndexOption(string $option)

No description

Parameters

string $option

Return Value

bool

protected array getBrowserData(array $prependScope = [])

No description

Parameters

array $prependScope

Return Value

array

protected array getBrowserTableData(Collection $items)

No description

Parameters

Collection $items

Return Value

array

protected Collection getBrowserItems(array $scopes = [])

No description

Parameters

array $scopes

Return Value

Collection

protected array filterScope(array $prepend = [])

No description

Parameters

array $prepend

Return Value

array

protected array getRequestFilters()

No description

Return Value

array

protected void applyFiltersDefaultOptions()

No description

Return Value

void

protected array orderScope()

No description

Return Value

array

protected array form(int $id, Model|null $item = null)

No description

Parameters

int $id
Model|null $item

Return Value

array

protected array modalFormData(int $id)

No description

Parameters

int $id

Return Value

array

protected array formData(Request $request)

No description

Parameters

Request $request

Return Value

array

protected array previewData(Request $item)

No description

Parameters

Request $item

Return Value

array

protected Request validateFormRequest()

No description

Return Value

Request

getFormRequestClass()

No description

protected string getNamespace()

No description

Return Value

string

protected string getRoutePrefix()

No description

Return Value

string

protected string getModulePermalinkBase()

No description

Return Value

string

protected string getModelName()

No description

Return Value

string

protected ModuleRepository getRepository()

No description

Return Value

ModuleRepository

getRepositoryClass($model)

No description

Parameters

$model

protected string|null getViewPrefix()

No description

Return Value

string|null

protected string getModelTitle()

No description

Return Value

string

protected string getParentModuleForeignKey()

No description

Return Value

string

protected string getPermalinkBaseUrl()

No description

Return Value

string

protected array getLocalizedPermalinkBase()

No description

Return Value

array

protected string getPermalinkPrefix(string $baseUrl)

No description

Parameters

string $baseUrl

Return Value

string

protected string getModuleRoute(int $id, string $action)

No description

Parameters

int $id
string $action

Return Value

string

protected bool moduleHas(string $behavior)

No description

Parameters

string $behavior

Return Value

bool

protected bool titleIsTranslatable()

No description

Return Value

bool

No description

Parameters

string|null $back_link
array $params

Return Value

void

No description

Parameters

string|null $fallback
array $params

Return Value

string

protected string getBackLinkSessionKey()

No description

Return Value

string

protected RedirectResponse redirectToForm(int $id, array $params = [])

No description

Parameters

int $id
array $params

Return Value

RedirectResponse

protected JsonResponse respondWithSuccess(string $message)

No description

Parameters

string $message

Return Value

JsonResponse

protected JsonResponse respondWithRedirect(string $redirectUrl)

No description

Parameters

string $redirectUrl

Return Value

JsonResponse

protected JsonResponse respondWithError(string $message)

No description

Parameters

string $message

Return Value

JsonResponse

protected JsonResponse respondWithJson(string $message, mixed $variant)

No description

Parameters

string $message
mixed $variant

Return Value

JsonResponse

protected void fireEvent(array $input = [])

No description

Parameters

array $input

Return Value

void

Collection|Block[] getRepeaterList()

No description

Return Value

Collection|Block[]