private function getRelationshipField($request)
    {
        // We need to make sure that we aren't creating an already existing field

        $dataType = Voyager::model('DataType')->find($request->data_type_id);

        $field = Str::singular($dataType->name).'_'.$request->relationship_type.'_'.Str::singular($request->relationship_table).'_relationship';

        $relationshipFieldOriginal = $relationshipField = strtolower($field);

        $existingRow = Voyager::model('DataRow')->where('field', '=', $relationshipField)->first();
        $index = 1;

        while (isset($existingRow->id)) {
            $relationshipField = $relationshipFieldOriginal.'_'.$index;
            $existingRow = Voyager::model('DataRow')->where('field', '=', $relationshipField)->first();
            $index += 1;
        }

        return $relationshipField;
    }
private function getRelationshipField($request)
    {
        // We need to make sure that we aren't creating an already existing field

        $dataType = Voyager::model('DataType')->find($request->data_type_id);

        $field = Str::singular($dataType->name).'_'.$request->relationship_type.'_'.Str::singular($request->relationship_table).'_relationship';

        $relationshipFieldOriginal = $relationshipField = strtolower($field);

        $existingRow = Voyager::model('DataRow')->where('field', '=', $relationshipField)->first();
        $index = 1;

        while (isset($existingRow->id)) {
            $relationshipField = $relationshipFieldOriginal.'_'.$index;
            $existingRow = Voyager::model('DataRow')->where('field', '=', $relationshipField)->first();
            $index += 1;
        }

        return $relationshipField;
    }
private function getRelationshipField ( $ request ) { // We need to make sure that we aren't creating an already existing field $ dataType = Voyager :: model ( 'DataType' ) -> find ( $ request -> data_type_id ) ; $ field = Str :: singular ( $ dataType -> name ) . '_' . $ request -> relationship_type . '_' . Str :: singular ( $ request -> relationship_table ) . '_relationship' ; $ relationshipFieldOriginal = $ relationshipField = strtolower ( $ field ) ; $ existingRow = Voyager :: model ( 'DataRow' ) -> where ( 'field' , '=' , $ relationshipField ) -> first ( ) ; $ index = 1 ; while ( isset ( $ existingRow -> id ) ) { $ relationshipField = $ relationshipFieldOriginal . '_' . $ index ; $ existingRow = Voyager :: model ( 'DataRow' ) -> where ( 'field' , '=' , $ relationshipField ) -> first ( ) ; $ index += 1 ; } return $ relationshipField ; }
Get Relationship Field.

@param Request $request

@return string
Get Relationship Field .