ModuleController
abstract class ModuleController extends Controller (View source)
Traits
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 User | $user | ||
protected array | $defaultIndexOptions | Options of the index view. |
|
protected array | $authorizableOptions | Options of the index view and the corresponding auth gates. |
|
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 deprecated | $filters | Additional filters for the index view. |
|
protected array | $filterLinks | Additional links to display in the listing filter. |
|
protected array deprecated | $defaultOrders | Default orders for the index view for fields that are not part of the indexColumns. |
|
protected int | $perPage | ||
protected string | $titleColumnKey | Name of the index column to use as name column. |
|
protected string | $titleColumnLabel | Label 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 | $titleFormLabel | Label of the title field 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 deprecated | $indexColumns | ||
protected array deprecated | $browserColumns | ||
protected string | $permalinkBase | ||
protected array deprecated | $filtersDefaultOptions | Filters that are selected by default in the index view. |
|
protected array deprecated | $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. |
|
protected array | $labels | Array of customizable label translation keys. |
|
protected array|null | $searchColumns | The columns to search for when using the search field. |
|
protected array | $defaultLabels | Default label translation keys that can be overridden in the labels array. |
Methods
No description
The setup method that is called when the controller is booted.
Removes the "Create" button on the listing page.
Disables table interaction and removes edit links.
Disables the ability to sort the table by clicking table headers.
Removes the publish/un-publish icon on the content listing.
Removes the "publish" option from the bulk operations.
Removes "restore" from the list item dropdown on the "Trash" content list.
Removes the "Trash" quick filter.
Removes the "delete" option from the "Trash" content list.
Removes "restore" from the bulk operations on the "Trash" content list.
Removes the "delete" option from the content lists.
Removes the "delete" option from the bulk operations.
Removes the permalink from the create/edit screens.
Disables the editor button.
Disables bulk operations.
Hides publish scheduling information from the content list.
Disables the create modal and directly forwards you to the full edit page.
Allow to feature the content. This requires a 'featured' fillable boolean on the model.
Enables the "Feature" bulk operation.
Enables the "Duplicate" option from the content lists.
Allows to reorder the items, if this was setup on the model.
Enables the function that content is edited in the create modal.
Shows the thumbnail of the content in the list.
Set the field to use for featuring content.
Set the columns to search in.
Set the name of the module you are working with.
The static permalink base to your module. Defaults to setModuleName
when empty.
No description
Sets the field to use as title, defaults to title
.
Sets the label to use for title column, defaults to Title
.
Sets the field to use as title in forms, defaults to title
.
Sets the label to use for title field in forms, defaults to Title
.
Usually not required, but in case customization is needed you can use this method to set the name of the model this controller acts on.
Sets the amount of results to show per page, defaults to 20.
Relations to eager load for the index view.
Relations to eager load for the form view.
Relation count to eager load for the form view.
No description
No description
Similar to getBrowserTableColumns but these will be added on top of the default columns.
Similar to getIndexTableColumns but these will be added on top of the default columns.
Match an option name to a gate name if needed, then authorize it.
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
The quick filters to apply to the listing table.
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Get translation key from labels array and attemps to return a translated string.
Details
__construct(Application $app, Request $request)
No description
void
removeMiddleware(string $middleware)
Attempts to unset the given middleware.
array|null
getSubmitOptions(Model $item)
No description
protected array|null
getSubmitOptionsForDraftRevisions(Model $item)
No description
protected void
setUpController()
The setup method that is called when the controller is booted.
protected void
disableCreate()
Removes the "Create" button on the listing page.
protected void
disableEdit()
Disables table interaction and removes edit links.
protected void
disableSortable()
Disables the ability to sort the table by clicking table headers.
protected void
disablePublish()
Removes the publish/un-publish icon on the content listing.
protected void
disableBulkPublish()
Removes the "publish" option from the bulk operations.
protected void
disableRestore()
Removes "restore" from the list item dropdown on the "Trash" content list.
protected void
disableBulkRestore()
Removes the "Trash" quick filter.
protected void
disableForceDelete()
Removes the "delete" option from the "Trash" content list.
protected void
disableBulkForceDelete()
Removes "restore" from the bulk operations on the "Trash" content list.
protected void
disableDelete()
Removes the "delete" option from the content lists.
protected void
disableBulkDelete()
Removes the "delete" option from the bulk operations.
protected void
disablePermalink()
Removes the permalink from the create/edit screens.
protected void
disableEditor()
Disables the editor button.
protected void
disableBulkEdit()
Disables bulk operations.
protected void
disableIncludeScheduledInList()
Hides publish scheduling information from the content list.
This does not affect custom table builders. Unless implemented.
protected void
enableSkipCreateModal()
Disables the create modal and directly forwards you to the full edit page.
protected void
enableFeature()
Allow to feature the content. This requires a 'featured' fillable boolean on the model.
If you want to use a different column you can use the setFeaturedField
method.
protected void
enableBulkFeature()
Enables the "Feature" bulk operation.
protected void
enableDuplicate()
Enables the "Duplicate" option from the content lists.
protected void
enableReorder()
Allows to reorder the items, if this was setup on the model.
protected void
enableEditInModal()
Enables the function that content is edited in the create modal.
protected void
enableShowImage()
Shows the thumbnail of the content in the list.
protected void
setFeatureField(string $field)
Set the field to use for featuring content.
protected void
setSearchColumns(array $searchColumns)
Set the columns to search in.
SearchColumns are automatically prefixes/suffixed with %.
protected void
setModuleName(string $moduleName)
Set the name of the module you are working with.
protected void
setPermalinkBase(string $permalinkBase)
The static permalink base to your module. Defaults to setModuleName
when empty.
protected void
withoutLanguageInPermalink(bool $without = true)
No description
protected void
setTitleColumnKey(string $titleColumnKey)
Sets the field to use as title, defaults to title
.
protected void
setTitleColumnLabel(string $titleColumnLabel)
Sets the label to use for title column, defaults to Title
.
protected void
setTitleFormKey(string $titleFormKey)
Sets the field to use as title in forms, defaults to title
.
protected void
setTitleFormLabel(string $titleFormLabel)
Sets the label to use for title field in forms, defaults to Title
.
protected void
setModelName(string $modelName)
Usually not required, but in case customization is needed you can use this method to set the name of the model this controller acts on.
protected void
setResultsPerPage(int $resultsPerPage)
Sets the amount of results to show per page, defaults to 20.
protected void
eagerLoadListingRelations(array $relations)
Relations to eager load for the index view.
protected void
eagerLoadFormRelations(array $relations)
Relations to eager load for the form view.
Add relationship used in multiselect and resource form fields.
protected void
eagerLoadFormRelationCounts(array $relations)
Relation count to eager load for the form view.
protected void
setBreadcrumbs(Breadcrumbs $breadcrumbs)
Set the breadcrumbs.
protected TableColumns
getBrowserTableColumns()
No description
protected TableColumns
getIndexTableColumns()
No description
protected TableColumns
additionalBrowserTableColumns()
Similar to getBrowserTableColumns but these will be added on top of the default columns.
protected TableColumns
additionalIndexTableColumns()
Similar to getIndexTableColumns but these will be added on top of the default columns.
protected void
authorizeOption($option, $arguments = [])
Match an option name to a gate name if needed, then authorize it.
protected void
setMiddlewarePermission()
deprecated
deprecated
No description
protected string|int|null
getParentModuleIdFromRequest(Request $request)
No description
mixed
index(int|null $parentModuleId = null)
No description
Form
getCreateForm()
No description
JsonResponse
browser()
No description
JsonResponse
store(int|null $parentModuleId = null)
No description
RedirectResponse
show($id, int|null $submoduleId = null)
No description
mixed
edit(TwillModelContract|int $id)
No description
View
create(int $parentModuleId = null)
No description
JsonResponse
update(TwillModelContract $id, int|null $submoduleId = null)
No description
protected void
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(TwillModelContract $id, int|null $submoduleId = null)
No description
JsonResponse
destroy(TwillModelContract $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
protected array
getIndexData(array $prependScope = [])
No description
protected array
indexData(Request $request)
No description
protected Collection
getIndexItems(array $scopes = [], bool $forcePagination = false)
No description
protected LengthAwarePaginator
transformIndexItems(LengthAwarePaginator $items)
No description
protected array
getIndexTableData(LengthAwarePaginator $items)
No description
protected
indexItemData(TwillModelContract $item)
No description
protected null|int|string
getItemIdentifier(TwillModelContract $item)
No description
TableFilters
filters()
No description
QuickFilters
quickFilters()
The quick filters to apply to the listing table.
protected QuickFilters
getDefaultQuickFilters()
No description
protected array
getIndexUrls(string $moduleName, string $routePrefix)
No description
protected bool
getIndexOption(string $option, $item = null)
No description
protected array
getBrowserData(array $scopes = [])
No description
protected array
getBrowserTableData(LengthAwarePaginator $items, bool $forRepeater = false)
No description
protected Collection
getBrowserItems(array $scopes = [])
No description
protected array
getRequestFilters()
No description
protected void
applyFiltersDefaultOptions()
No description
protected array
orderScope()
No description
protected array
form(int|null $id, TwillModelContract|null $item = null)
No description
protected array
modalFormData(TwillModelContract $modelOrId)
No description
protected array
formData(Request $request)
No description
protected array
previewData(TwillModelContract $item)
No description
protected Request
validateFormRequest()
No description
getFormRequestClass()
No description
protected string
getNamespace()
No description
protected string
getRoutePrefix()
No description
protected string
getModulePermalinkBase()
No description
protected string
getModelName()
No description
protected ModuleRepository
getRepository()
No description
protected string
getRepositoryClass($model)
No description
protected string|null
getViewPrefix()
No description
protected string
getModelTitle()
No description
protected string
getParentModuleForeignKey()
No description
string
getPermalinkBaseUrl()
No description
protected array
getLocalizedPermalinkBase()
No description
protected string
getPermalinkPrefix(string $baseUrl)
No description
protected string
getModuleRoute(int $id, string $action)
No description
protected bool
moduleHas(string $behavior)
No description
protected bool
titleIsTranslatable()
No description
protected void
setBackLink(string|null $back_link = null, array $params = [])
No description
protected string
getBackLink(string|null $fallback = null, array $params = [])
No description
protected string
getBackLinkSessionKey()
No description
protected RedirectResponse
redirectToForm(int $id, array $params = [])
No description
protected JsonResponse
respondWithSuccess(string $message)
No description
protected JsonResponse
respondWithRedirect(string $redirectUrl)
No description
protected JsonResponse
respondWithError(string $message)
No description
protected JsonResponse
respondWithJson(string $message, mixed $variant)
No description
protected
getGroupUserMapping()
No description
protected void
fireEvent(array $input = [])
No description
protected
getShowPermissionFieldset($item)
No description
protected Translator|string|array|null
getTransLabel(string $key, array $replace = [])
Get translation key from labels array and attemps to return a translated string.
Form
getForm(TwillModelContract $model)
No description
Form
getSideFieldsets(TwillModelContract $model)
No description