love_php/app/Models/SaasAppointment.php

38 lines
815 B
PHP
Raw Normal View History

2026-04-02 09:20:51 +08:00
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon;
class SaasAppointment extends Base
{
protected $fillable = [];
protected $guarded = [];
public function getStartTimeAttribute()
{
if ($this->attributes['start_time']) {
return Carbon::parse($this->attributes['start_time'])->format('H:i');
}
}
public function getEndTimeAttribute()
{
if ($this->attributes['end_time']) {
$time = Carbon::parse($this->attributes['end_time'])->format('H:i');
if($time == '00:00'){
$time = '24:00';
}
return $time;
}
}
public function merchant()
{
return $this->hasOne(MerchantAccount::class, 'id', 'merchant_id');
}
}