Get a record's slug depending on the type of object used.

@return string|int
519738
private function getLinkSlug()
    {
        if ($this instanceof Content) {
            return $this->slug ?: $this->id;
        }

        if (isset($this->values['slug'])) {
            return $this->values['slug'];
        }

        return $this->id;
    }
1319150
public function slug(){
		if (is_null($this->slug)){
			$hashids = $this->getHashids();

			$this->slug = $hashids->encode($this->{$this->getKeyName()});
		}

		return $this->slug;
	}
984446
public function getEntityObject($slug = null)
    {
        if (! is_null($this->entity)) {
            return $this->entity;
        }

        return $this->getEntity($slug ?? $this->getAttribute('type'))->entity;
    }
1101069
public function count() {
    if (isset($this->_href)) {
      $headers = Recurly_Base::_head($this->_href, $this->_client);
      if (isset($headers['x-records'])) {
        return intval($headers['x-records']);
      }
    } elseif (isset($this->_objects) && is_array($this->_objects)) {
      return count($this->_objects);
    }

    return null;
  }
237499
protected function getDocumentIdFromSlug($slug)
    {
        $parts = (array) sscanf($slug, '%d-%s');
        $id = array_shift($parts);
        if (is_numeric($id)) {
            return (int) $id;
        }
        throw new InvalidArgumentException($slug . ' is not a valid DMSDocument URL');
    }
343451
public function slug() {
		$mo = $this->master_object();
		if ( $mo && $mo->post_name ) {
			return $mo->post_name;
		}
		return $this->post_name;
	}
461842
function get_slug() {
            if ( ! isset( $this->_slug ) ) {
                $id_slug_type_path_map = self::$_accounts->get_option( 'id_slug_type_path_map', array() );
                $this->_slug           = $id_slug_type_path_map[ $this->_module_id ]['slug'];
            }

            return $this->_slug;
        }
1285185
public function getRecord()
    {
        $this->record || $this->record = wei()->appRecord()
            ->tags(false)
            ->setCacheKey('appName:' . $this->namespace)
            ->cache(86400)
            ->find(['name' => $this->namespace]);

        return $this->record;
    }
534188
public function get($slug)
    {
        return $this->ports->first(function (Port $port) use ($slug) {
            return $port->slug() === $slug;
        });
    }
572054
public function findReferenced()
    {
        $liveRecord = $this->getObjectInStage(Versioned::LIVE);

        // For unversioned objects, simply return all owned objects
        if (!$this->isVersioned()) {
            return $liveRecord->findOwned();
        }

        // If we have deleted this record, recursively delete live objects on publish
        if ($this->getChangeType() === ChangeSetItem::CHANGE_DELETED) {
            if (!$liveRecord) {
                return ArrayList::create();
            }
            return $liveRecord->findCascadeDeletes(true);
        }

        // If changed on stage, include all owned objects for publish
        /** @var DataObject|RecursivePublishable $draftRecord */
        $draftRecord = $this->getObjectInStage(Versioned::DRAFT);
        if (!$draftRecord) {
            return ArrayList::create();
        }
        $references = $draftRecord->findOwned();

        // When publishing, use cascade_deletes to partially unpublished sets
        if ($liveRecord) {
            foreach ($liveRecord->findCascadeDeletes(true) as $next) {
                /** @var Versioned|DataObject $next */
                if ($next->hasExtension(Versioned::class) && $next->hasStages() && $next->isOnLiveOnly()) {
                    $this->mergeRelatedObject($references, ArrayList::create(), $next);
                }
            }
        }
        return $references;
    }
169597
public function getFullSlug() : string
    {
        $categories = Category::with('ancestors')->ancestorsAndSelf($this->category->id);

        $slug = "";

        foreach ($categories as $category) {
            $translation = $category->translations->where('locale', $this->locale)->first();
            $slug .= $translation->slug . '/';
        }

        $slug = substr($slug, 0, -1);

        return $slug;
    }
683179
public function getSlugForTitle($title)
    {
        $slug = Str::slug($title);
        $latestSlug = $this->model->whereRaw("slug RLIKE '^{$slug}(-[0-9]*)?$'")->latest()->value('slug');

        if ($latestSlug) {
            $pieces = explode('-', $latestSlug);
            $number = end($pieces);

            return $slug.'-'.($number + 1);
        }

        return $slug;
    }
1334317
protected static function _getRecordClass($record)
    {
        $static = get_called_class();

        if (!static::fieldExists('Class')) {
            return $static;
        }

        $columnName = static::_cn('Class');

        if (!empty($record[$columnName]) && is_subclass_of($record[$columnName], $static)) {
            return $record[$columnName];
        } else {
            return $static;
        }
    }
507987
public static function findBySlug($slug, $postTypeSlug = '')
    {
        $postTypeSlug = ($postTypeSlug ? $postTypeSlug : PostType::getSlug());

        $postObj = (new Post())->setTable($postTypeSlug);
        $post = $postObj
            ->where('slug_'.App::getLocale(), $slug)
            ->with($postObj->getDefaultRelations(getPostType($postTypeSlug)))
            ->first();

        return $post;
    }
282473
public function get_records() {
        global $DB;
        return $DB->get_records_sql($this->build_query(), $this->params, $this->limitfrom, $this->limitnum);
    }
1217088
public function get_data() {

		$data           = [
			$this->slug => [],
		];
		$this->instance = 0;
		$has_data       = true;
		while ( true === $has_data ) {
			$this_data = $this->get_child_data();
			$this_data = array_filter( $this_data );
			if ( ! empty( $this_data ) ) {
				$data[ $this->slug ][] = $this_data;
			} else {
				$has_data = false;
			}
			$this->instance ++;
		}

		return $data;
	}
182001
public function getRootCategories ()
    {
        return self::where('parent' , 0)
            ->where('slug' , '<>' , config('Categories::category.default_category.slug'))
            ->orderby('id' , 'desc')
            ->where('model_type' , $this->modelType)
            ->get();
    }