modelType == 'POST') ? true : false; } public function getIsTagAttribute() { return ($this->modelType == 'TAG') ? true : false; } public function getHasFilesAttribute() { return $this->hasFiles; } public function getHasPublicationsAttribute() { return $this->hasPublications; } public function user() { return $this->HasOne('App\Models\User', 'id', 'user_id'); } public function getUpdatedAttribute($value) { return \Carbon\Carbon::createFromTimestamp(strtotime($this->updated_at))->diffForHumans(); } public function getCreatedAttribute($value) { return \Carbon\Carbon::createFromTimestamp(strtotime($this->created_at))->diffForHumans(); } public function getDeletedAttribute($value) { if(empty($value)) { return $value; } else { return \Carbon\Carbon::createFromTimestamp(strtotime($this->deleted_at))->diffForHumans(); } } public function disableTimestamps() { $this->timestamps = false; } public function enableTimestamps() { $this->timestamps = true; } }