/** * Add the relationship * * @return Schema * @author Justin Palmer **/ private function addRelationship($name, $type) { $options = new stdClass(); $options->name = $name; $options->type = $type; $options->alias = Inflections::underscore(str_replace('-', '_', $name)); $options->table = Inflections::tableize($options->alias); $options->foreign_key = Inflections::foreignKey(Inflections::singularize($this->model->table_name())); $this->relationships->set($name, $options); $options->on = $this->autoGenerateOn($name); $this->relationships->set($name, $options); return $this; }