Properties

$timestamps

$timestamps : boolean

Stored if table has timestamps

Type

boolean

$wordpressPrefix

$wordpressPrefix : boolean

Add wordpressPrefix table name

Type

boolean

$validation

$validation : boolean

Define whether you need to validate the data

Type

boolean

$ruleAttr

$ruleAttr : string

Stores the custom rule attribute name

Type

string

$primaryKey

$primaryKey : string

Stored table primarykey

Type

string

$dates

$dates : array

Date elements

Type

array

$fillable

$fillable : array

Fillable elements

Type

array

$hidden

$hidden : array

Hidden elementes

Type

array

$casts

$casts : array

The attributes that should be cast to native types.

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

metas()

metas() : \Illuminate\Database\Eloquent\Relations\HasMany

Get user meta

Returns

\Illuminate\Database\Eloquent\Relations\HasMany

getCurrentUser()

getCurrentUser(boolean  $dontThrowException = false) : \MocaBonita\model\MbWpUser

Get current user logged

Parameters

boolean $dontThrowException

Throws

\Exception

Returns

\MocaBonita\model\MbWpUser

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