public function getParentKeyName()
    {
        if ($this->getParentName()) {
            
            $func = $this->getParentName();
            $relat = $this->$func();
            
            /*
             * if (! $relat instanceof \Illuminate\Database\Eloquent\Relations\BelongsTo) {
             * $field = $relat->getForeignKey();
             * } else {
             * $field = 'id';
             * }
             */
            
            $field = $relat->getForeignKey();
            
            return $field;
        }
        
        return 'id';
    }
public function getParentKeyName()
    {
        if ($this->getParentName()) {
            
            $func = $this->getParentName();
            $relat = $this->$func();
            
            /*
             * if (! $relat instanceof \Illuminate\Database\Eloquent\Relations\BelongsTo) {
             * $field = $relat->getForeignKey();
             * } else {
             * $field = 'id';
             * }
             */
            
            $field = $relat->getForeignKey();
            
            return $field;
        }
        
        return 'id';
    }
public function getParentKeyName ( ) { if ( $ this -> getParentName ( ) ) { $ func = $ this -> getParentName ( ) ; $ relat = $ this -> $ func ( ) ; /*
             * if (! $relat instanceof \Illuminate\Database\Eloquent\Relations\BelongsTo) {
             * $field = $relat->getForeignKey();
             * } else {
             * $field = 'id';
             * }
             */ $ field = $ relat -> getForeignKey ( ) ; return $ field ; } return 'id' ; }
Return parent key name

@return string
Return parent key name