Example #1
0
 /**
  * @param  string  $id
  * @param  string  $type
  * @return \Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Model
  */
 private function getObject($id, $type)
 {
     $id = \Hashids::decode($id);
     $id = current($id);
     switch ($type) {
         case 'content':
             return Content::findOrFail($id);
         case 'related':
             return ContentRelated::findOrFail($id);
         case 'entry':
             return Entry::findOrFail($id);
         case 'entry_reply':
             return EntryReply::findOrFail($id);
         case 'comment':
             return Comment::findOrFail($id);
         case 'comment_reply':
             return CommentReply::findOrFail($id);
     }
 }