Skip to content

PrimaryHelper

App\Helpers\PrimaryHelper

Get Data Model

php
PrimaryHelper::fresnsModelByFsid($modelName, $fsid);

PrimaryHelper::fresnsModelById($modelName, $id);
Parameter NameTypeRequiredDescription
modelNameStringrequiredModel name
fsidNumber / StringrequiredField value, e.g. aid value

Model Name

  • account
  • user
  • group
  • hashtag
  • post
  • comment
  • file
  • extend
  • archive

Get Primary ID

php
PrimaryHelper::fresnsPrimaryId($tableName, $tableKey);
Parameter NameTypeRequiredDescription
tableNameStringrequiredTable Name
tableKeyStringrequiredPrimary Key Name
For example, the aid value
  • configs->item_key
  • accounts->aid
  • users->uid or username
  • posts->pid
  • comments->cid
  • extends->eid
  • groups->gid
  • hashtags->slug

Get Account Primary ID

php
PrimaryHelper::fresnsAccountIdByAid($aid);

PrimaryHelper::fresnsAccountIdByUidOrUsername($uidOrUsername);
Parameter NameTypeRequiredDescription
aidStringoptionalaccounts->aid
uidOrUsernameNumber / Stringoptionalusers->uid or users->username

Get User Primary ID

php
PrimaryHelper::fresnsUserIdByUidOrUsername($uidOrUsername);
Parameter NameTypeRequiredDescription
uidOrUsernameNumber / Stringoptionalusers->uid or users->username

Get Group Primary ID

php
PrimaryHelper::fresnsGroupIdByGid($gid);
Parameter NameTypeRequiredDescription
gidStringoptionalgroups->gid

Get Group Primary ID by ContentFsid

php
PrimaryHelper::fresnsGroupIdByContentFsid($type, $fsid);
Parameter NameTypeRequiredDescription
typeStringrequiredpost or comment
fsidStringoptionalposts->pid or comments->cid

Get Hashtag Primary ID

php
PrimaryHelper::fresnsHashtagIdByHid($hid);
Parameter NameTypeRequiredDescription
hidStringoptionalhashtags->slug

Get Post Primary ID

php
PrimaryHelper::fresnsPostIdByPid($pid);
Parameter NameTypeRequiredDescription
pidStringoptionalposts->pid

Get Comment Primary ID

php
PrimaryHelper::fresnsCommentIdByCid($cid);
Parameter NameTypeRequiredDescription
cidStringoptionalcomments->cid

Get File Primary ID

php
PrimaryHelper::fresnsFileIdByFid($fid);
Parameter NameTypeRequiredDescription
fidStringoptionalfiles->fid

Get Extend Primary ID

php
PrimaryHelper::fresnsExtendIdByEid($eid);
Parameter NameTypeRequiredDescription
eidStringoptionalextends->eid

Released under the Apache-2.0 License