src/Fk.php
public function add($fk, $column = null, $keyName = null, $onDelete = null, $onUpdate = null)
    {
        $baseFk = $this->baseFk($fk);

        $column = $column ?: $baseFk->defaultColumn();

        static::$foreignKeys[] = [
            'column'          => $column ?: $this->column,
            'key_name'        => $keyName ?: $this->keyName,
            'table'           => $this->table->getTable(),
            'reference_table' => $baseFk->referenceTable(),
            'primary_key'     => $baseFk->primaryKey,
            'on_delete'       => $onDelete ?: $this->onDelete ?: $baseFk->onDelete,
            'on_update'       => $onUpdate ?: $this->onUpdate ?: $baseFk->onUpdate,
        ];

        return $baseFk->createFkColumn($column);
    }
public function add($fk, $column = null, $keyName = null, $onDelete = null, $onUpdate = null)
    {
        $baseFk = $this->baseFk($fk);

        $column = $column ?: $baseFk->defaultColumn();

        static::$foreignKeys[] = [
            'column'          => $column ?: $this->column,
            'key_name'        => $keyName ?: $this->keyName,
            'table'           => $this->table->getTable(),
            'reference_table' => $baseFk->referenceTable(),
            'primary_key'     => $baseFk->primaryKey,
            'on_delete'       => $onDelete ?: $this->onDelete ?: $baseFk->onDelete,
            'on_update'       => $onUpdate ?: $this->onUpdate ?: $baseFk->onUpdate,
        ];

        return $baseFk->createFkColumn($column);
    }
public function add ( $ fk , $ column = null , $ keyName = null , $ onDelete = null , $ onUpdate = null ) { $ baseFk = $ this -> baseFk ( $ fk ) ; $ column = $ column ? : $ baseFk -> defaultColumn ( ) ; static :: $ foreignKeys [ ] = [ 'column' => $ column ? : $ this -> column , 'key_name' => $ keyName ? : $ this -> keyName , 'table' => $ this -> table -> getTable ( ) , 'reference_table' => $ baseFk -> referenceTable ( ) , 'primary_key' => $ baseFk -> primaryKey , 'on_delete' => $ onDelete ? : $ this -> onDelete ? : $ baseFk -> onDelete , 'on_update' => $ onUpdate ? : $ this -> onUpdate ? : $ baseFk -> onUpdate , ] ; return $ baseFk -> createFkColumn ( $ column ) ; }
Add a foreign key to table and defer its foreign key creation.

@param string $fk
@param string $column
@param string $keyName
@param string $onDelete
@param string $onUpdate
@return \Illuminate\Support\Fluent
Add a foreign key to table and defer its foreign key creation .