SingletonModuleController
abstract class SingletonModuleController extends ModuleController (View source)
Traits
Properties
protected Application | $app | from ModuleController | |
protected Request | $request | from ModuleController | |
protected string | $namespace | from ModuleController | |
protected string | $routePrefix | from ModuleController | |
protected string | $moduleName | from ModuleController | |
protected string | $modelName | from ModuleController | |
protected string | $modelTitle | from ModuleController | |
protected ModuleRepository | $repository | from ModuleController | |
protected User | $user | from ModuleController | |
protected array | $defaultIndexOptions | Options of the index view. |
from ModuleController |
protected array | $authorizableOptions | Options of the index view and the corresponding auth gates. |
from ModuleController |
protected array | $indexWith | Relations to eager load for the index view. |
from ModuleController |
protected array | $formWith | Relations to eager load for the form view. |
from ModuleController |
protected array | $formWithCount | Relation count to eager load for the form view. |
from ModuleController |
protected array deprecated | $filters | Additional filters for the index view. |
from ModuleController |
protected array | $filterLinks | Additional links to display in the listing filter. |
from ModuleController |
protected array deprecated | $defaultOrders | Default orders for the index view for fields that are not part of the indexColumns. |
from ModuleController |
protected int | $perPage | from ModuleController | |
protected string | $titleColumnKey | Name of the index column to use as name column. |
from ModuleController |
protected string | $titleColumnLabel | Label of the index column to use as name column. |
from ModuleController |
protected string | $identifierColumnKey | Name of the index column to use as identifier column. |
from ModuleController |
protected string | $titleFormKey | Attribute to use as title in forms. |
from ModuleController |
protected string | $titleFormLabel | Label of the title field in forms. |
from ModuleController |
protected string | $featureField | Feature field name if the controller is using the feature route (defaults to "featured"). |
from ModuleController |
protected bool | $submodule | Indicates if this module is edited through a parent module. |
from ModuleController |
protected int|null | $submoduleParentId | from ModuleController | |
protected bool | $disableEditor | Can be used in child classes to disable the content editor (full screen block editor). |
from ModuleController |
protected array | $indexOptions | from ModuleController | |
protected array deprecated | $indexColumns | from ModuleController | |
protected array deprecated | $browserColumns | from ModuleController | |
protected | $permalinkBase | ||
protected array deprecated | $filtersDefaultOptions | Filters that are selected by default in the index view. |
from ModuleController |
protected array deprecated | $defaultFilters | from ModuleController | |
protected string | $viewPrefix | from ModuleController | |
protected string | $previewView | from ModuleController | |
protected array | $fieldsPermissions | List of permissions keyed by a request field. Can be used to prevent unauthorized field updates. |
from ModuleController |
protected bool | $enableDraftRevisions | Determines if draft revisions can be added on top of published content. |
from ModuleController |
protected array | $labels | Array of customizable label translation keys. |
from ModuleController |
protected array|null | $searchColumns | The columns to search for when using the search field. |
from ModuleController |
protected array | $defaultLabels | Default label translation keys that can be overridden in the labels array. |
from ModuleController |
Methods
No description
The setup method that is called when the controller is booted.
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 "delete" option from the "Trash" content list.
Removes "restore" from the bulk operations on the "Trash" content list.
Removes the "delete" option from the 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.
Allows to reorder the items, if this was setup on the model.
Enables the function that content is edited in the create modal.
Set the field to use for featuring content.
Set the name of the module you are working with.
The static permalink base to your module. Defaults to setModuleName
when empty.
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.
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
Get translation key from labels array and attemps to return a translated string.
No description
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
editSingleton()
No description