PHP Class Silber\Bouncer\Database\Models

Mostrar archivo Open project: JosephSilber/bouncer Class Usage Examples

Protected Properties

Property Type Description
$models array Map for the bouncer's models.
$ownership array Holds the map of ownership for models.
$prefix string The prefix for the tables.
$tables array Map for the bouncer's tables.

Public Methods

Method Description
ability ( array $attributes = [] ) : Ability Get an instance of the ability model.
classname ( string $model ) : string Get the classname mapping for the given model.
isOwnedBy ( Model $authority, Model $model ) : boolean Determines whether the given model is owned by the given authority.
ownedVia ( string | Closure $model, string | Closure | null $attribute = null ) : void Register an attribute/callback to determine if a model is owned by a given authority.
prefix ( ) : string Get the prefix for the tables.
reset ( ) : void Reset all settings to their original state.
role ( array $attributes = [] ) : Role Get an instance of the role model.
setAbilitiesModel ( string $model ) : void Set the model to be used for abilities.
setPrefix ( string $prefix ) : void Set the prefix for the tables.
setRolesModel ( string $model ) : void Set the model to be used for roles.
setTables ( array $map ) : void Set custom table names.
setUsersModel ( string $model ) : void Set the model to be used for users.
table ( string $table ) : string Get a custom table name mapping for the given table.
user ( array $attributes = [] ) : Model Get an instance of the user model.

Protected Methods

Method Description
basename ( string | object $class ) : string Get the basename of the given class.
isOwnedVia ( string | Closure $attribute, Model $authority, Model $model ) : boolean Determines ownership via the given attribute.
make ( string $model, array $attributes = [] ) : Model Get an instance of the given model.

Method Details

ability() public static method

Get an instance of the ability model.
public static ability ( array $attributes = [] ) : Ability
$attributes array
return Ability

basename() protected static method

Get the basename of the given class.
protected static basename ( string | object $class ) : string
$class string | object
return string

classname() public static method

Get the classname mapping for the given model.
public static classname ( string $model ) : string
$model string
return string

isOwnedBy() public static method

Determines whether the given model is owned by the given authority.
public static isOwnedBy ( Model $authority, Model $model ) : boolean
$authority Illuminate\Database\Eloquent\Model
$model Illuminate\Database\Eloquent\Model
return boolean

isOwnedVia() protected static method

Determines ownership via the given attribute.
protected static isOwnedVia ( string | Closure $attribute, Model $authority, Model $model ) : boolean
$attribute string | Closure
$authority Illuminate\Database\Eloquent\Model
$model Illuminate\Database\Eloquent\Model
return boolean

make() protected static method

Get an instance of the given model.
protected static make ( string $model, array $attributes = [] ) : Model
$model string
$attributes array
return Illuminate\Database\Eloquent\Model

ownedVia() public static method

Register an attribute/callback to determine if a model is owned by a given authority.
public static ownedVia ( string | Closure $model, string | Closure | null $attribute = null ) : void
$model string | Closure
$attribute string | Closure | null
return void

prefix() public static method

Get the prefix for the tables.
public static prefix ( ) : string
return string

reset() public static method

Reset all settings to their original state.
public static reset ( ) : void
return void

role() public static method

Get an instance of the role model.
public static role ( array $attributes = [] ) : Role
$attributes array
return Role

setAbilitiesModel() public static method

Set the model to be used for abilities.
public static setAbilitiesModel ( string $model ) : void
$model string
return void

setPrefix() public static method

Set the prefix for the tables.
public static setPrefix ( string $prefix ) : void
$prefix string
return void

setRolesModel() public static method

Set the model to be used for roles.
public static setRolesModel ( string $model ) : void
$model string
return void

setTables() public static method

Set custom table names.
public static setTables ( array $map ) : void
$map array
return void

setUsersModel() public static method

Set the model to be used for users.
public static setUsersModel ( string $model ) : void
$model string
return void

table() public static method

Get a custom table name mapping for the given table.
public static table ( string $table ) : string
$table string
return string

user() public static method

Get an instance of the user model.
public static user ( array $attributes = [] ) : Model
$attributes array
return Illuminate\Database\Eloquent\Model

Property Details

$models protected_oe static_oe property

Map for the bouncer's models.
protected static array $models
return array

$ownership protected_oe static_oe property

Holds the map of ownership for models.
protected static array $ownership
return array

$prefix protected_oe static_oe property

The prefix for the tables.
protected static string $prefix
return string

$tables protected_oe static_oe property

Map for the bouncer's tables.
protected static array $tables
return array