Illuminate\Database\Eloquent\Relations\BelongsTo::dissociate PHP Метод

dissociate() публичный Метод

Dissociate previously associated model from the given parent.
public dissociate ( ) : Model
Результат Illuminate\Database\Eloquent\Model
    public function dissociate()
    {
        $this->parent->setAttribute($this->foreignKey, null);
        return $this->parent->setRelation($this->relation, null);
    }

Usage Example

Пример #1
2
 public static function setBelongsTo(BelongsTo $belongsTo, $object = null)
 {
     return $object ? $belongsTo->associate($object) : $belongsTo->dissociate();
 }