class UserRepository 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
protected Repository $config
protected DatabaseManager $db
protected PasswordBrokerManager $passwordBrokerManager
protected Factory $authFactory

Methods

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

Collection
getBrowsers()

Get all browser' detail info from the $browsers attribute.

string
inferRelationFromBrowserName(string $browserName)

Guess the browser's relation name (shoud be lower camel case, ex. userGroup, contactOffice).

string
inferModelFromModuleName(string $moduleName)

Guess the module's model name (should be singular upper camel case, ex. User, ArticleType).

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

Collection
getRelatedBrowsers()

Get all related browser' detail info from the $relatedBrowsers attribute.

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.

Collection
getRepeaters()

Get all repeaters' model and relation from the $repeaters attribute.

string
inferRelationFromRepeaterName(string $repeaterName)

Guess the relation name (shoud be lower camel case, ex. userGroup, contactOffice).

string
inferModelFromRepeaterName(string $repeaterName)

Guess the model name (should be singular upper camel case, ex. User, ArticleType).

hydrateHandleFieldsGroups(Model $object, array|null $fields)

No description

array
prepareFieldsBeforeSaveHandleFieldsGroups(Model|null $object, array $fields)

No description

array
prepareFieldsBeforeCreateHandleFieldsGroups(array $fields)

No description

array
getFormFieldsHandleFieldsGroups(Model $object, array $fields)

No description

handleFieldsGroups($fields)

No description

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

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

firstOrCreate($attributes, $fields = [])

No description

create(string[] $fields)

No description

createForPreview(array $fields)

No description

updateOrCreate(array $attributes, array $fields)

No description

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 $user, array $fields)

No description

void
afterUpdateBasic(Model $user, array $fields)

No description

void
beforeSave(Model $object, array $fields)

No description

void
afterSave(Model|User $user, array $fields)

No description

void
afterDelete(Model $object)

No description

void
afterRestore(Model $object)

No description

hydrate(Model $object, array $fields)

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

mixed
getModelRepository(string $relation, Model|ModuleRepository|null $modelOrRepository = null)

No description

array
traitsMethods(string $method = null)

No description

string
getLikeOperator()

No description

mixed
__call(string $method, array $parameters)

No description

bool
hasBehavior(string $behavior)

No description

bool
isTranslatable($column)

No description

hydrateHandleMedias(Model $object, array $fields)

No description

void
afterSaveHandleMedias(Model $object, array $fields)

No description

array
getFormFieldsHandleMedias(Model $object, array $fields)

No description

array
getCrops(string $role)

No description

oauthUser(User $oauthUser)

No description

bool
oauthIsUserLinked(User $oauthUser, string $provider)

No description

oauthUpdateProvider(User $oauthUser, string $provider)

No description

oauthCreateUser(User $oauthUser)

No description

__construct(DatabaseManager $db, Repository $config, PasswordBrokerManager $passwordBrokerManager, Factory $authFactory, User $model)

No description

Details

array prepareFieldsBeforeCreateHandleDates(array $fields)

No description

Parameters

array $fields

Return Value

array

array prepareFieldsBeforeSaveHandleDates(Model|null $object, array $fields)

No description

Parameters

Model|null $object
array $fields

Return Value

array

array prepareDatesField(array $fields, string $f)

No description

Parameters

array $fields
string $f

Return Value

array

void afterSaveHandleBrowsers(Model $object, array $fields)

No description

Parameters

Model $object
array $fields

Return Value

void

array getFormFieldsHandleBrowsers(Model $object, array $fields)

No description

Parameters

Model $object
array $fields

Return Value

array

void updateBrowser(Model $object, array $fields, string $relationship, string $positionAttribute = 'position', string|null $browserName = null, array $pivotAttributes = [])

No description

Parameters

Model $object
array $fields
string $relationship
string $positionAttribute
string|null $browserName
array $pivotAttributes

Return Value

void

void updateOrderedBelongsTomany(Model $object, array $fields, string $relationship, string $positionAttribute = 'position')

No description

Parameters

Model $object
array $fields
string $relationship
string $positionAttribute

Return Value

void

void updateRelatedBrowser(Model $object, array $fields, string $browserName)

No description

Parameters

Model $object
array $fields
string $browserName

Return Value

void

array getFormFieldsForBrowser(Model $object, string $relation, string|null $routePrefix = null, string $titleKey = 'title', string|null $moduleName = null)

No description

Parameters

Model $object
string $relation
string|null $routePrefix
string $titleKey
string|null $moduleName

Return Value

array

array getFormFieldsForRelatedBrowser(Model $object, string $relation, $titleKey = 'title')

No description

Parameters

Model $object
string $relation
$titleKey

Return Value

array

protected Collection getBrowsers()

Get all browser' detail info from the $browsers attribute.

The missing information will be inferred by convention of Twill.

Return Value

Collection

protected string inferRelationFromBrowserName(string $browserName)

Guess the browser's relation name (shoud be lower camel case, ex. userGroup, contactOffice).

Parameters

string $browserName

Return Value

string

protected string inferModelFromModuleName(string $moduleName)

Guess the module's model name (should be singular upper camel case, ex. User, ArticleType).

Parameters

string $moduleName

Return Value

string

protected string inferModuleNameFromBrowserName(string $browserName)

Guess the browser's module name (should be plural lower camel case, ex. userGroups, contactOffices).

Parameters

string $browserName

Return Value

string

void afterSaveHandleRelatedBrowsers(Model $object, array $fields)

No description

Parameters

Model $object
array $fields

Return Value

void

array getFormFieldsHandleRelatedBrowsers(Model $object, array $fields)

No description

Parameters

Model $object
array $fields

Return Value

array

protected Collection getRelatedBrowsers()

Get all related browser' detail info from the $relatedBrowsers attribute.

The missing information will be inferred by convention of Twill.

Return Value

Collection

void afterSaveHandleRepeaters(Model $object, array $fields)

No description

Parameters

Model $object
array $fields

Return Value

void

array getFormFieldsHandleRepeaters(Model $object, array $fields)

No description

Parameters

Model $object
array $fields

Return Value

array

void updateRepeaterMany(Model $object, array $fields, string $relation, bool $keepExisting = true, Model|null $model = null)

No description

Parameters

Model $object
array $fields
string $relation
bool $keepExisting
Model|null $model

Return Value

void

void updateRepeaterMorphMany(Model $object, array $fields, string $relation, string|null $morph = null, Model|null $model = null, string|null $repeaterName = null)

No description

Parameters

Model $object
array $fields
string $relation
string|null $morph
Model|null $model
string|null $repeaterName

Return Value

void

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.

Parameters

Model $object
array $fields
string $relation
Model|ModuleRepository|null $modelOrRepository
string|null $repeaterName

Return Value

void

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.

Parameters

Model $object
array $fields
string $relation
Model|ModuleRepository|null $modelOrRepository
string|null $repeaterName

Return Value

array

protected Collection getRepeaters()

Get all repeaters' model and relation from the $repeaters attribute.

The missing information will be inferred by convention of Twill.

Return Value

Collection

protected string inferRelationFromRepeaterName(string $repeaterName)

Guess the relation name (shoud be lower camel case, ex. userGroup, contactOffice).

Parameters

string $repeaterName

Return Value

string

protected string inferModelFromRepeaterName(string $repeaterName)

Guess the model name (should be singular upper camel case, ex. User, ArticleType).

Parameters

string $repeaterName

Return Value

string

Model hydrateHandleFieldsGroups(Model $object, array|null $fields)

No description

Parameters

Model $object
array|null $fields

Return Value

Model

array prepareFieldsBeforeSaveHandleFieldsGroups(Model|null $object, array $fields)

No description

Parameters

Model|null $object
array $fields

Return Value

array

array prepareFieldsBeforeCreateHandleFieldsGroups(array $fields)

No description

Parameters

array $fields

Return Value

array

array getFormFieldsHandleFieldsGroups(Model $object, array $fields)

No description

Parameters

Model $object
array $fields

Return Value

array

protected handleFieldsGroups($fields)

No description

Parameters

$fields

protected array getModelCasts(Model $object)

No description

Parameters

Model $object

Return Value

array

Collection|LengthAwarePaginator get(array $with = [], array $scopes = [], array $orders = [], int $perPage = 20, bool $forcePagination = false)

No description

Parameters

array $with
array $scopes
array $orders
int $perPage
bool $forcePagination

Return Value

Collection|LengthAwarePaginator

int getCountByStatusSlug(string $slug, array $scope = [])

No description

Parameters

string $slug
array $scope

Return Value

int

int getCountForAll()

No description

Return Value

int

int getCountForPublished()

No description

Return Value

int

int getCountForDraft()

No description

Return Value

int

int getCountForTrash()

No description

Return Value

int

Model getById($id, array $with = [], array $withCount = [])

No description

Parameters

$id
array $with
array $withCount

Return Value

Model

Exceptions

ModelNotFoundException

Collection listAll(string $column = 'title', array $orders = [], null $exceptId = null)

No description

Parameters

string $column
array $orders
null $exceptId

Return Value

Collection

Collection cmsSearch($search, array $fields = [])

No description

Parameters

$search
array $fields

Return Value

Collection

Model firstOrCreate($attributes, $fields = [])

No description

Parameters

$attributes
$fields

Return Value

Model

Model create(string[] $fields)

No description

Parameters

string[] $fields

Return Value

Model

Model createForPreview(array $fields)

No description

Parameters

array $fields

Return Value

Model

Model updateOrCreate(array $attributes, array $fields)

No description

Parameters

array $attributes
array $fields

Return Value

Model

Model update(mixed $id, array $fields)

No description

Parameters

mixed $id
array $fields

Return Value

Model

mixed updateBasic(mixed $id, array $values, array $scopes = [])

No description

Parameters

mixed $id
array $values
array $scopes

Return Value

mixed

void setNewOrder(array $ids)

No description

Parameters

array $ids

Return Value

void

mixed duplicate(mixed $id, $titleColumnKey = 'title')

No description

Parameters

mixed $id
$titleColumnKey

Return Value

mixed

mixed delete(mixed $id)

No description

Parameters

mixed $id

Return Value

mixed

mixed bulkDelete(array $ids)

No description

Parameters

array $ids

Return Value

mixed

mixed forceDelete(mixed $id)

No description

Parameters

mixed $id

Return Value

mixed

mixed bulkForceDelete($ids)

No description

Parameters

$ids

Return Value

mixed

mixed restore(mixed $id)

No description

Parameters

mixed $id

Return Value

mixed

mixed bulkRestore(array $ids)

No description

Parameters

array $ids

Return Value

mixed

array cleanupFields(Model $object, array $fields)

No description

Parameters

Model $object
array $fields

Return Value

array

array prepareFieldsBeforeCreate(array $fields)

No description

Parameters

array $fields

Return Value

array

string[] prepareFieldsBeforeSave(Model $user, array $fields)

No description

Parameters

Model $user
array $fields

Return Value

string[]

void afterUpdateBasic(Model $user, array $fields)

No description

Parameters

Model $user
array $fields

Return Value

void

void beforeSave(Model $object, array $fields)

No description

Parameters

Model $object
array $fields

Return Value

void

void afterSave(Model|User $user, array $fields)

No description

Parameters

Model|User $user
array $fields

Return Value

void

void afterDelete(Model $object)

No description

Parameters

Model $object

Return Value

void

void afterRestore(Model $object)

No description

Parameters

Model $object

Return Value

void

Model hydrate(Model $object, array $fields)

No description

Parameters

Model $object
array $fields

Return Value

Model

array getFormFields(Model $object)

No description

Parameters

Model $object

Return Value

array

Builder filter(Builder $query, array $scopes = [])

No description

Parameters

Builder $query
array $scopes

Return Value

Builder

Builder order(Builder $query, array $orders = [])

No description

Parameters

Builder $query
array $orders

Return Value

Builder

void updateOneToMany(Model $object, array $fields, string $relationship, string $formField, string $attribute)

No description

Parameters

Model $object
array $fields
string $relationship
string $formField
string $attribute

Return Value

void

void updateMultiSelect(Model $object, array $fields, string $relationship)

No description

Parameters

Model $object
array $fields
string $relationship

Return Value

void

void addRelationFilterScope(Builder $query, array $scopes, string $scopeField, string $scopeRelation)

No description

Parameters

Builder $query
array $scopes
string $scopeField
string $scopeRelation

Return Value

void

void addLikeFilterScope(Builder $query, array $scopes, string $scopeField)

No description

Parameters

Builder $query
array $scopes
string $scopeField

Return Value

void

searchIn(Builder $query, array $scopes, string $scopeField, string[] $orFields = [])

No description

Parameters

Builder $query
array $scopes
string $scopeField
string[] $orFields

bool isUniqueFeature()

No description

Return Value

bool

void addIgnoreFieldsBeforeSave(array $ignore = [])

No description

Parameters

array $ignore

Return Value

void

bool shouldIgnoreFieldBeforeSave(string $ignore)

No description

Parameters

string $ignore

Return Value

bool

string[] getReservedFields()

No description

Return Value

string[]

protected mixed getModelRepository(string $relation, Model|ModuleRepository|null $modelOrRepository = null)

No description

Parameters

string $relation
Model|ModuleRepository|null $modelOrRepository

Return Value

mixed

protected array traitsMethods(string $method = null)

No description

Parameters

string $method

Return Value

array

protected string getLikeOperator()

No description

Return Value

string

mixed __call(string $method, array $parameters)

No description

Parameters

string $method
array $parameters

Return Value

mixed

bool hasBehavior(string $behavior)

No description

Parameters

string $behavior

Return Value

bool

bool isTranslatable($column)

No description

Parameters

$column

Return Value

bool

Model hydrateHandleMedias(Model $object, array $fields)

No description

Parameters

Model $object
array $fields

Return Value

Model

void afterSaveHandleMedias(Model $object, array $fields)

No description

Parameters

Model $object
array $fields

Return Value

void

array getFormFieldsHandleMedias(Model $object, array $fields)

No description

Parameters

Model $object
array $fields

Return Value

array

array getCrops(string $role)

No description

Parameters

string $role

Return Value

array

User oauthUser(User $oauthUser)

No description

Parameters

User $oauthUser

Return Value

User

bool oauthIsUserLinked(User $oauthUser, string $provider)

No description

Parameters

User $oauthUser
string $provider

Return Value

bool

User oauthUpdateProvider(User $oauthUser, string $provider)

No description

Parameters

User $oauthUser
string $provider

Return Value

User

User oauthCreateUser(User $oauthUser)

No description

Parameters

User $oauthUser

Return Value

User

__construct(DatabaseManager $db, Repository $config, PasswordBrokerManager $passwordBrokerManager, Factory $authFactory, User $model)

No description

Parameters

DatabaseManager $db
Repository $config
PasswordBrokerManager $passwordBrokerManager
Factory $authFactory
User $model