|
@@ -13,7 +13,7 @@ class Docter extends BaseModel
|
|
protected $casts = [
|
|
protected $casts = [
|
|
'label' => 'json',
|
|
'label' => 'json',
|
|
];
|
|
];
|
|
- protected $appends = ['is_collect', 'label_texts'];
|
|
|
|
|
|
+ protected $appends = ['is_collect', 'label_texts', 'is_can_phone', 'is_can_chat'];
|
|
|
|
|
|
public function office()
|
|
public function office()
|
|
{
|
|
{
|
|
@@ -95,4 +95,28 @@ class Docter extends BaseModel
|
|
$base_price = DocterTimes::where('docter_id', $this->id)->where('type', 1)->value('base_price');
|
|
$base_price = DocterTimes::where('docter_id', $this->id)->where('type', 1)->value('base_price');
|
|
return $base_price*100;
|
|
return $base_price*100;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public function getIsCanPhoneAttribute()
|
|
|
|
+ {
|
|
|
|
+ if ($this->is_phone == 1) {
|
|
|
|
+ $now_line = (int)date('Hi');
|
|
|
|
+ if (DocterServiceTime::where('docter_id', $this->id)->where('type', 1)->where('start_time_line', '<=', $now_line)->where('end_time_line', '>', $now_line)->exists()) {
|
|
|
|
+ return 1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function getIsCanChatAttribute()
|
|
|
|
+ {
|
|
|
|
+ if ($this->is_chat == 1) {
|
|
|
|
+ $now_line = (int)date('Hi');
|
|
|
|
+ if (DocterServiceTime::where('docter_id', $this->id)->where('type', 2)->where('start_time_line', '<=', $now_line)->where('end_time_line', '>', $now_line)->exists()) {
|
|
|
|
+ return 1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
}
|
|
}
|