PHP Class LMongo\Eloquent\Relations\MorphOneOrMany

Inheritance: extends HasOneOrMany
Datei anzeigen Open project: navruzm/lmongo

Protected Properties

Property Type Description
$morphClass string The class name of the parent model.
$morphType string The foreign key type for the relationship.

Public Methods

Method Description
__construct ( Builder $query, Model $parent, string $type, string $id ) : void Create a new has many relationship instance.
addConstraints ( ) : void Set the base constraints on the relation query.
addEagerConstraints ( array $models ) : void Set the constraints for an eager load of the relation.
create ( array $attributes ) : Model Create a new instance of the related model.
getAndResetWheres ( ) : array Remove the original where clause set by the relationship.
getMorphClass ( ) : string Get the class name of the parent model.
getMorphType ( ) : string Get the foreign key "type" name.
save ( Model $model ) : Model Attach a model instance to the parent model.

Method Details

__construct() public method

Create a new has many relationship instance.
public __construct ( Builder $query, Model $parent, string $type, string $id ) : void
$query LMongo\Eloquent\Builder
$parent LMongo\Eloquent\Model
$type string
$id string
return void

addConstraints() public method

Set the base constraints on the relation query.
public addConstraints ( ) : void
return void

addEagerConstraints() public method

Set the constraints for an eager load of the relation.
public addEagerConstraints ( array $models ) : void
$models array
return void

create() public method

Create a new instance of the related model.
public create ( array $attributes ) : Model
$attributes array
return LMongo\Eloquent\Model

getAndResetWheres() public method

The remaining constraints on the query will be reset and returned.
public getAndResetWheres ( ) : array
return array

getMorphClass() public method

Get the class name of the parent model.
public getMorphClass ( ) : string
return string

getMorphType() public method

Get the foreign key "type" name.
public getMorphType ( ) : string
return string

save() public method

Attach a model instance to the parent model.
public save ( Model $model ) : Model
$model LMongo\Eloquent\Model
return LMongo\Eloquent\Model

Property Details

$morphClass protected_oe property

The class name of the parent model.
protected string $morphClass
return string

$morphType protected_oe property

The foreign key type for the relationship.
protected string $morphType
return string