Properties

$timestamps

$timestamps : boolean

Disable 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

$primaryKey

$primaryKey : string

Stored table primarykey

Type

string

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

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