FileRepository
class FileRepository extends ModuleRepository (View source)
Traits
Mimic HandleBrowsers, but when the relation uses HasRelated instead of being a proper model relation.
Properties
protected array | $browsers | All browsers used in the model, as an array of browser names: [ 'books', 'publications' ]. |
from HandleBrowsers |
protected string|array|(array)|mix|(string|array)) | $relatedBrowsers | All related browsers used in the model, as an array of browser names: [ 'books', 'publications' ]. |
from HandleRelatedBrowsers |
protected array | $repeaters | All repeaters used in the model, as an array of repeater names: [ 'article_repeater', 'page_repeater' ]. |
from HandleRepeaters |
protected TwillModelContract | $model | from ModuleRepository | |
protected string[] | $ignoreFieldsBeforeSave | from ModuleRepository | |
protected array | $countScope | from ModuleRepository | |
protected array | $fieldsGroups | from ModuleRepository | |
bool | $fieldsGroupsFormFieldNamesAutoPrefix | from ModuleRepository | |
string | $fieldsGroupsFormFieldNameSeparator | from ModuleRepository |
Methods
No description
No description
No description
No description
Get all browser' detail info from the $browsers attribute.
Guess the browser's relation name (shoud be lower camel case, ex. userGroup, contactOffice).
Guess the module's model name (should be singular upper camel case, ex. User, ArticleType).
Guess the browser's module name (should be plural lower camel case, ex. userGroups, contactOffices).
Get all related browser' detail info from the $relatedBrowsers attribute.
Called from afterReplicate in ModuleRepository.
No description
No description
No description
Given relation, model and repeaterName, retrieve the repeater data from request and update the database record.
No description
Given relation, model and repeaterName, get the necessary fields for rendering a repeater.
Get all repeaters' model and relation from the $repeaters attribute.
Guess the relation name (should be lower camel case, ex. userGroup, contactOffice).
Guess the model name (should be singular upper camel case, ex. User, ArticleType).
No description
Retrieve user-item permissions fields
Function executed after save on module form
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
Details
array
prepareFieldsBeforeCreateHandleDates(array $fields)
No description
array
prepareFieldsBeforeSaveHandleDates(TwillModelContract|null $object, array $fields)
No description
array
prepareDatesField(array $fields, string $field)
No description
void
afterSaveHandleBrowsers(Model $object, array $fields)
No description
array
getFormFieldsHandleBrowsers(Model $object, array $fields)
No description
void
updateBrowser(TwillModelContract $object, array $fields, string $relationship, string $positionAttribute = 'position', string|null $browserName = null, array $pivotAttributes = [])
No description
void
updateOrderedBelongsTomany(Model $object, array $fields, string $relationship, string $positionAttribute = 'position')
No description
void
updateRelatedBrowser(Model $object, array $fields, string $browserName)
No description
array
getFormFieldsForBrowser(TwillModelContract $object, string $relation, string|null $routePrefix = null, string $titleKey = 'title', string|null $moduleName = null)
No description
array
getFormFieldsForRelatedBrowser(Model $object, string $relation, $titleKey = 'title')
No description
protected Collection
getBrowsers()
Get all browser' detail info from the $browsers attribute.
The missing information will be inferred by convention of Twill.
protected string
inferRelationFromBrowserName(string $browserName)
Guess the browser's relation name (shoud be lower camel case, ex. userGroup, contactOffice).
protected string
inferModelFromModuleName(string $moduleName)
Guess the module's model name (should be singular upper camel case, ex. User, ArticleType).
protected string
inferModuleNameFromBrowserName(string $browserName)
Guess the browser's module name (should be plural lower camel case, ex. userGroups, contactOffices).
void
afterSaveHandleRelatedBrowsers(Model $object, array $fields)
No description
array
getFormFieldsHandleRelatedBrowsers(Model $object, array $fields)
No description
protected Collection
getRelatedBrowsers()
Get all related browser' detail info from the $relatedBrowsers attribute.
The missing information will be inferred by convention of Twill.
void
afterDuplicateHandleRelatedBrowsers(TwillModelContract $old, TwillModelContract $new)
Called from afterReplicate in ModuleRepository.
void
afterSaveHandleRepeaters(TwillModelContract $object, array $fields)
No description
array
getFormFieldsHandleRepeaters(TwillModelContract $object, array $fields)
No description
void
updateRepeaterMany(TwillModelContract $object, array $fields, string $relation, bool $keepExisting = true, string|null $model = null)
deprecated
deprecated
No description
void
updateRepeaterMorphMany(TwillModelContract $object, array $fields, string $relation, string|null $morph = null, string|null $model = null, string|null $repeaterName = null)
No description
void
updateRepeaterWithPivot(TwillModelContract $object, array $fields, string $relation, array $pivotFields, string|null $modelOrRepository = null, string|null $repeaterName = null)
No description
void
updateRepeater(TwillModelContract $object, array $fields, string $relation, ModuleRepository $modelOrRepository = null, string|null $repeaterName = null)
Given relation, model and repeaterName, retrieve the repeater data from request and update the database record.
array
getFormFieldForRepeaterWithPivot(TwillModelContract $object, array $fields, string $relation, array $pivotFields, ModuleRepository $modelOrRepository = null, string|null $repeaterName = null)
No description
array
getFormFieldsForRepeater(TwillModelContract $object, array $fields, string $relation, ModuleRepository $modelOrRepository = null, string|null $repeaterName = null)
Given relation, model and repeaterName, get the necessary fields for rendering a repeater.
protected Collection
getRepeaters()
Get all repeaters' model and relation from the $repeaters attribute.
The missing information will be inferred by convention of Twill.
protected string
inferRelationFromRepeaterName(string $repeaterName)
Guess the relation name (should be lower camel case, ex. userGroup, contactOffice).
protected string
inferModelFromRepeaterName(string $repeaterName)
Guess the model name (should be singular upper camel case, ex. User, ArticleType).
array
prepareFieldsBeforeSaveHandleFieldsGroups(Model|null $object, array $fields)
No description
array
prepareFieldsBeforeCreateHandleFieldsGroups(array $fields)
No description
array
getFormFieldsHandleFieldsGroups(Model $object, array $fields)
No description
protected
handleFieldsGroups($fields)
No description
protected array
getModelCasts(Model $object)
No description
array
getFormFieldsHandlePermissions(TwillModelContract $object, array $fields)
Retrieve user-item permissions fields
afterSaveHandlePermissions(Model $object, array $fields)
Function executed after save on module form
Collection
get(array $with = [], array $scopes = [], array $orders = [], int $perPage = 20, bool $forcePagination = false, array $appliedFilters = [])
No description
int
getCountByStatusSlug(string $slug, array $scope = [])
No description
TwillModelContract
getById(int $id, array $with = [], array $withCount = [])
No description
Collection
listAll(string $column = 'title', array $orders = [], int|string|null $exceptId = null, string $pluckBy = 'id')
No description
Collection
cmsSearch(string $search, array $fields = [])
No description
TwillModelContract
firstOrCreate(array $attributes, array $fields = [])
No description
TwillModelContract
create(array $fields)
No description
TwillModelContract
createForPreview(array $fields)
No description
TwillModelContract
updateOrCreate(array $attributes, array $fields)
No description
TwillModelContract
update(int|string $id, array $fields)
No description
bool
updateBasic(int|string|null|array $id, array $values, array $scopes = [])
No description
void
setNewOrder(array $ids)
No description
TwillModelContract|null
duplicate(int|string $id, string $titleColumnKey = 'title')
No description
bool
delete(int|string $id)
No description
bool
bulkDelete(array $ids)
No description
bool
forceDelete(int|string $id)
No description
bool
bulkForceDelete(array $ids)
No description
bool
restore(int|string $id)
No description
bool
bulkRestore(array $ids)
No description
array
cleanupFields(TwillModelContract|null $object, array $fields)
No description
array
prepareFieldsBeforeCreate(array $fields)
No description
array
prepareFieldsBeforeSave(TwillModelContract $object, array $fields)
No description
void
afterUpdateBasic(TwillModelContract $object, array $fields)
No description
void
beforeSave(TwillModelContract $object, array $fields)
No description
void
afterSaveOriginalData(TwillModelContract $model, array $fields)
No description
void
afterSave(TwillModelContract $model, array $fields)
No description
void
afterDelete(TwillModelContract $object)
No description
void
afterDuplicate(TwillModelContract $old, TwillModelContract $new)
No description
void
afterRestore(TwillModelContract $object)
No description
TwillModelContract
hydrate(TwillModelContract $model, array $fields)
No description
array
getFormFields(TwillModelContract $object)
No description
Builder
filter(Builder $query, array $scopes = [])
No description
Builder
order(Builder $builder, array $orders = [])
No description
void
updateOneToMany(TwillModelContract $object, array $fields, string $relationship, string $formField, string $attribute)
No description
void
updateMultiSelect(TwillModelContract $object, array $fields, string $relationship)
No description
void
addRelationFilterScope(Builder $query, array $scopes, string $scopeField, string $scopeRelation)
No description
void
addLikeFilterScope(Builder $query, array $scopes, string $scopeField)
No description
bool
isUniqueFeature()
No description
void
addIgnoreFieldsBeforeSave(array $ignore = [])
No description
bool
shouldIgnoreFieldBeforeSave(string $ignore)
No description
array
getReservedFields()
No description
protected ModuleRepository
getModelRepository(string $relation, ModuleRepository|null $modelOrRepository = null)
No description
protected array
traitsMethods(string|null $method = null)
No description
protected string
getLikeOperator()
deprecated
deprecated
No description
mixed
__call(string $method, array $parameters)
No description
bool
hasBehavior(string $behavior)
No description
bool
isTranslatable($column)
No description
TwillModelContract
getBaseModel()
No description
void
afterSaveHandleTags(TwillModelContract $object, array $fields)
No description
Collection
getTags(string|null $query = null, array $ids = [])
No description
Collection
getTagsList()
No description
__construct(File $model)
No description