Properties

$wordpressPrefix

$wordpressPrefix : boolean

Add wordpressPrefix table name

Type

boolean

$validation

$validation : boolean

Define whether you need to validate the data

Type

boolean

$parent

$parent : \Illuminate\Database\Eloquent\Model

The parent model of the relationship.

Type

\Illuminate\Database\Eloquent\Model

$foreignKey

$foreignKey : string

The name of the foreign key column.

Type

string

$otherKey

$otherKey : string

The name of the "other key" column.

Type

string

$guarded

$guarded : array

The attributes that aren't mass assignable.

Type

array

Methods

getTable()

getTable() : string

Get the table associated with the model.

Returns

string

newEloquentBuilder()

newEloquentBuilder(\Illuminate\Database\Query\Builder  $query) : \Illuminate\Database\Eloquent\Builder|\MocaBonita\tools\eloquent\MbDatabaseEloquentBuilder

Create a new Eloquent query builder for the model.

Parameters

\Illuminate\Database\Query\Builder $query

Returns

\Illuminate\Database\Eloquent\Builder|\MocaBonita\tools\eloquent\MbDatabaseEloquentBuilder

createSchema()

createSchema(\Illuminate\Database\Schema\Blueprint  $table) 

Implement method to create schemas

Parameters

\Illuminate\Database\Schema\Blueprint $table

Throws

\Exception

createSchemaModel()

createSchemaModel(boolean  $deleteIfExists = false) 

Call createSchema when activating, deactivating or uninstalling plugin

Parameters

boolean $deleteIfExists

To recreate scheme

updateSchema()

updateSchema(\Illuminate\Database\Schema\Blueprint  $table) 

Implement method to update schemas

Parameters

\Illuminate\Database\Schema\Blueprint $table

Throws

\Exception

updateSchemaModel()

updateSchemaModel() 

Call updateSchema when activating, deactivating or uninstalling plugin

Throws

\Exception

dropSchemaModel()

dropSchemaModel() 

Call delete scheme

save()

save(array  $options = array()) : boolean

Save the model to the database.

Parameters

array $options

Throws

\MocaBonita\tools\MbException

Returns

boolean

getSchema()

getSchema() : \Illuminate\Database\Schema\Builder

Get TableSchema Builder

Returns

\Illuminate\Database\Schema\Builder

newPivot()

newPivot(\Illuminate\Database\Eloquent\Model  $parent, array  $attributes, string  $table, boolean  $exists, null  $using = null) : \MocaBonita\tools\eloquent\MbPivot

Create a new pivot model instance.

Parameters

\Illuminate\Database\Eloquent\Model $parent
array $attributes
string $table
boolean $exists
null $using

Returns

\MocaBonita\tools\eloquent\MbPivot

__construct()

__construct(\Illuminate\Database\Eloquent\Model  $parent, array  $attributes, string  $table, boolean  $exists = false) 

Create a new pivot model instance.

Parameters

\Illuminate\Database\Eloquent\Model $parent
array $attributes
string $table
boolean $exists

fromRawAttributes()

fromRawAttributes(\Illuminate\Database\Eloquent\Model  $parent, array  $attributes, string  $table, boolean  $exists = false) : static

Create a new pivot model from raw values returned from a query.

Parameters

\Illuminate\Database\Eloquent\Model $parent
array $attributes
string $table
boolean $exists

Returns

static

delete()

delete() : integer

Delete the pivot model record from the database.

Returns

integer

getForeignKey()

getForeignKey() : string

Get the foreign key column name.

Returns

string

getOtherKey()

getOtherKey() : string

Get the "other key" column name.

Returns

string

setPivotKeys()

setPivotKeys(string  $foreignKey, string  $otherKey) : $this

Set the key names for the pivot model instance.

Parameters

string $foreignKey
string $otherKey

Returns

$this

hasTimestampAttributes()

hasTimestampAttributes() : boolean

Determine if the pivot model has timestamp attributes.

Returns

boolean

getCreatedAtColumn()

getCreatedAtColumn() : string

Get the name of the "created at" column.

Returns

string

getUpdatedAtColumn()

getUpdatedAtColumn() : string

Get the name of the "updated at" column.

Returns

string

getWpdb()

getWpdb() : \wpdb

Wordpress DB Manager

Returns

\wpdb

validation()

validation(array  $attributes) : array|\MocaBonita\tools\validation\MbValidation|null

Implement method to validation model

Parameters

array $attributes

Returns

array|\MocaBonita\tools\validation\MbValidation|null

asDateTime()

asDateTime(mixed  $value) : \Carbon\Carbon

Return a timestamp as DateTime object.

Parameters

mixed $value

Returns

\Carbon\Carbon

setKeysForSaveQuery()

setKeysForSaveQuery(\Illuminate\Database\Eloquent\Builder  $query) : \Illuminate\Database\Eloquent\Builder

Set the keys for a save update query.

Parameters

\Illuminate\Database\Eloquent\Builder $query

Returns

\Illuminate\Database\Eloquent\Builder

getDeleteQuery()

getDeleteQuery() : \Illuminate\Database\Eloquent\Builder

Get the query builder for a delete operation on the pivot.

Returns

\Illuminate\Database\Eloquent\Builder