You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.2 KiB
52 lines
1.2 KiB
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Services\AdminTranslationService;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class ParkingGuardBooth extends Model
|
|
{
|
|
use HasFactory, SoftDeletes;
|
|
|
|
protected $table = 'parking_guard_booth';
|
|
|
|
protected $fillable
|
|
= [
|
|
'name',
|
|
'remark'
|
|
];
|
|
|
|
protected $hidden
|
|
= [
|
|
'updated_at',
|
|
'deleted_at'
|
|
];
|
|
|
|
public static function getData()
|
|
{
|
|
return self::query()->select(['id', 'name'])->get()->each(
|
|
function ($item) {
|
|
$item['name'] = AdminTranslationService::getTranslationTypeName(
|
|
$item['id'],
|
|
7,
|
|
$item['name']
|
|
);
|
|
return $item;
|
|
}
|
|
)->toArray();
|
|
}
|
|
|
|
public function getCreatedAtAttribute($value): string
|
|
{
|
|
return $value ? date("Y-m-d H:i:s", strtotime($value)) : $value;
|
|
}
|
|
|
|
public static function getName($id)
|
|
{
|
|
$name = self::query()->value('name');
|
|
return AdminTranslationService::getTranslationTypeName($id, 7, $name);
|
|
}
|
|
}
|
|
|