MediaRepository
class MediaRepository 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 Model | $model | from ModuleRepository | |
protected string[] | $ignoreFieldsBeforeSave | from ModuleRepository | |
protected array | $countScope | from ModuleRepository | |
protected array | $fieldsGroups | from ModuleRepository | |
bool | $fieldsGroupsFormFieldNamesAutoPrefix | from ModuleRepository | |
string|null | $fieldsGroupsFormFieldNameSeparator | from ModuleRepository |
Methods
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.
No description
No description
Given relation, model and repeaterName, retrieve the repeater data from request and update the database record.
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 (shoud be lower camel case, ex. userGroup, contactOffice).
Guess the model name (should be singular upper camel case, ex. User, ArticleType).
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(Model|null $object, array $fields)
No description
array
prepareDatesField(array $fields, string $f)
No description
void
afterSaveHandleBrowsers(Model $object, array $fields)
No description
array
getFormFieldsHandleBrowsers(Model $object, array $fields)
No description
void
updateBrowser(Model $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(Model $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
afterSaveHandleRepeaters(Model $object, array $fields)
No description
array
getFormFieldsHandleRepeaters(Model $object, array $fields)
No description
void
updateRepeaterMany(Model $object, array $fields, string $relation, bool $keepExisting = true, Model|null $model = null)
No description
void
updateRepeaterMorphMany(Model $object, array $fields, string $relation, string|null $morph = null, Model|null $model = null, string|null $repeaterName = null)
No description
void
updateRepeater(Model $object, array $fields, string $relation, Model|ModuleRepository|null $modelOrRepository = null, string|null $repeaterName = null)
Given relation, model and repeaterName, retrieve the repeater data from request and update the database record.
array
getFormFieldsForRepeater(Model $object, array $fields, string $relation, Model|ModuleRepository|null $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 (shoud 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
Collection|LengthAwarePaginator
get(array $with = [], array $scopes = [], array $orders = [], int $perPage = 20, bool $forcePagination = false)
No description
int
getCountByStatusSlug(string $slug, array $scope = [])
No description
int
getCountForAll()
No description
int
getCountForPublished()
No description
int
getCountForDraft()
No description
int
getCountForTrash()
No description
Model
getById($id, array $with = [], array $withCount = [])
No description
Collection
listAll(string $column = 'title', array $orders = [], null $exceptId = null)
No description
Collection
cmsSearch($search, array $fields = [])
No description
Model
firstOrCreate($attributes, $fields = [])
No description
Model
create(string[] $fields)
No description
Model
createForPreview(array $fields)
No description
Model
updateOrCreate(array $attributes, array $fields)
No description
Model
update(mixed $id, array $fields)
No description
mixed
updateBasic(mixed $id, array $values, array $scopes = [])
No description
void
setNewOrder(array $ids)
No description
mixed
duplicate(mixed $id, $titleColumnKey = 'title')
No description
mixed
delete(mixed $id)
No description
mixed
bulkDelete(array $ids)
No description
mixed
forceDelete(mixed $id)
No description
mixed
bulkForceDelete($ids)
No description
mixed
restore(mixed $id)
No description
mixed
bulkRestore(array $ids)
No description
array
cleanupFields(Model $object, array $fields)
No description
array
prepareFieldsBeforeCreate(array $fields)
No description
string[]
prepareFieldsBeforeSave(Model $object, array $fields)
No description
void
afterUpdateBasic(Model $object, array $fields)
No description
void
beforeSave(Model $object, array $fields)
No description
void
afterSave(Model $object, array $fields)
No description
void
afterDelete(Model $object)
No description
void
afterRestore(Model $object)
No description
array
getFormFields(Model $object)
No description
Builder
filter(Builder $query, array $scopes = [])
No description
Builder
order(Builder $query, array $orders = [])
No description
void
updateOneToMany(Model $object, array $fields, string $relationship, string $formField, string $attribute)
No description
void
updateMultiSelect(Model $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
searchIn(Builder $query, array $scopes, string $scopeField, string[] $orFields = [])
No description
bool
isUniqueFeature()
No description
void
addIgnoreFieldsBeforeSave(array $ignore = [])
No description
bool
shouldIgnoreFieldBeforeSave(string $ignore)
No description
string[]
getReservedFields()
No description
protected mixed
getModelRepository(string $relation, Model|ModuleRepository|null $modelOrRepository = null)
No description
protected array
traitsMethods(string $method = null)
No description
protected string
getLikeOperator()
No description
mixed
__call(string $method, array $parameters)
No description
bool
hasBehavior(string $behavior)
No description
bool
isTranslatable($column)
No description
void
afterSaveHandleTags(Model $object, array $fields)
No description
protected
filterHandleTags($query, $scopes)
No description
Collection
getTags(string $query = '', array $ids = [])
No description
Collection
getTagsList()
No description
__construct(Media $model)
No description