Inheritance: extends Illuminate\Database\Eloquent\Model, use trait App\Models\History\Traits\Relationship\HistoryRelationship
 /**
  * @param $entity_id
  * @return string
  */
 public function renderEntity($entity_id)
 {
     $history = History::with('user', 'type')->where('entity_id', $entity_id)->latest()->get();
     if (!$history->count()) {
         return trans("history.backend.none_for_entity", ['entity' => $history->type->name]);
     }
     return $this->buildList($history);
 }
コード例 #2
0
 /**
  * @param $type
  * @param $entity_id
  * @param null $limit
  * @param bool $paginate
  * @param int $pagination
  * @return string|\Symfony\Component\Translation\TranslatorInterface
  */
 public function renderEntity($type, $entity_id, $limit = null, $paginate = true, $pagination = 10)
 {
     $history = History::with('user', 'type')->where('entity_id', $entity_id);
     $history = $this->checkType($history, $type);
     $history = $this->buildPagination($history, $limit, $paginate, $pagination);
     if (!$history->count()) {
         return trans("history.backend.none_for_entity", ['entity' => $type]);
     }
     return $this->buildList($history, $paginate);
 }