vhost/app/Entities/BoardEntity.php
2024-05-17 16:08:27 +09:00

39 lines
942 B
PHP

<?php
namespace App\Entities;
class BoardEntity extends BaseHierarchyEntity
{
protected $datamap = [];
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
protected $casts = [];
//기본기능
public function getTitle(): string
{
return $this->attributes['title'];
}
//추가기능
public function getPassword()
{
return $this->attributes['passwd'];
}
public function getCategory(): string
{
return $this->attributes['category'];
}
//파일관련 Field전용
final public function getFileDownload($url, $field = "upload_file")
{
if (is_null($this->attributes[$field])) {
return "";
}
$files = explode(DEFAULTS['DELIMITER_FILE'], $this->attributes[$field]);
return anchor(
$url,
ICONS['IMAGE_FILE'] . $files[0],
["target" => "_self"]
);
}
}