/** * Criar a ForeignKey da Associação. * @param $column * @param $other_table * @param null $name * @param null $other_key * @return \Illuminate\Support\Fluent */ public function foreignAssociation($column, $other_table, $name = null, $other_key = null) { $name = is_null($name) ? ForeignKey::makeName($this->table, $column) : $name; $other_key = is_null($other_key) ? self::keyAttr() : $other_key; $fk = $this->foreign($column, $name); $fk->on($other_table); $fk->references($other_key); return $fk; }