src/Commands/CrudApiCommand.php
protected function processJSONForeignKeys($file)
    {
        $json = File::get($file);
        $fields = json_decode($json);

        if (! property_exists($fields, 'foreign_keys')) {
            return '';
        }

        $foreignKeysString = '';
        foreach ($fields->foreign_keys as $foreign_key) {
            $foreignKeysString .= $foreign_key->column . '#' . $foreign_key->references . '#' . $foreign_key->on;

            if (property_exists($foreign_key, 'onDelete')) {
                $foreignKeysString .= '#' . $foreign_key->onDelete;
            }

            if (property_exists($foreign_key, 'onUpdate')) {
                $foreignKeysString .= '#' . $foreign_key->onUpdate;
            }

            $foreignKeysString .= ',';
        }

        $foreignKeysString = rtrim($foreignKeysString, ',');

        return $foreignKeysString;
    }
protected function processJSONForeignKeys($file)
    {
        $json = File::get($file);
        $fields = json_decode($json);

        if (! property_exists($fields, 'foreign_keys')) {
            return '';
        }

        $foreignKeysString = '';
        foreach ($fields->foreign_keys as $foreign_key) {
            $foreignKeysString .= $foreign_key->column . '#' . $foreign_key->references . '#' . $foreign_key->on;

            if (property_exists($foreign_key, 'onDelete')) {
                $foreignKeysString .= '#' . $foreign_key->onDelete;
            }

            if (property_exists($foreign_key, 'onUpdate')) {
                $foreignKeysString .= '#' . $foreign_key->onUpdate;
            }

            $foreignKeysString .= ',';
        }

        $foreignKeysString = rtrim($foreignKeysString, ',');

        return $foreignKeysString;
    }
protected function processJSONForeignKeys ( $ file ) { $ json = File :: get ( $ file ) ; $ fields = json_decode ( $ json ) ; if ( ! property_exists ( $ fields , 'foreign_keys' ) ) { return '' ; } $ foreignKeysString = '' ; foreach ( $ fields -> foreign_keys as $ foreign_key ) { $ foreignKeysString .= $ foreign_key -> column . '#' . $ foreign_key -> references . '#' . $ foreign_key -> on ; if ( property_exists ( $ foreign_key , 'onDelete' ) ) { $ foreignKeysString .= '#' . $ foreign_key -> onDelete ; } if ( property_exists ( $ foreign_key , 'onUpdate' ) ) { $ foreignKeysString .= '#' . $ foreign_key -> onUpdate ; } $ foreignKeysString .= ',' ; } $ foreignKeysString = rtrim ( $ foreignKeysString , ',' ) ; return $ foreignKeysString ; }
Process the JSON Foreign keys.

@param  string $file

@return string
Process the JSON Foreign keys .