shoppingmallv2/app/Entities/OrderEntity.php
2023-08-10 12:22:08 +09:00

28 lines
595 B
PHP

<?php
namespace App\Entities;
class OrderEntity extends BaseEntity
{
protected $datamap = [];
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
protected $casts = [];
//기본기능
final public function getTitle(): string
{
return $this->attributes['name'];
}
//추가기능
public function getOrderHint()
{
$hints = explode("-", $this->getPrimaryKey());
return sprintf(
"%s-**-%s",
str_split($hints[0], 3)[0],
str_split($hints[count($hints) - 1], 5)[0]
);
}
}