|
|
|
|
@ -29,12 +29,12 @@ class Orders extends SoftDeletesModel
|
|
|
|
|
/**
|
|
|
|
|
* 判断是否要签协议
|
|
|
|
|
*/
|
|
|
|
|
public function needAgreements()
|
|
|
|
|
public function needAgreements($order)
|
|
|
|
|
{
|
|
|
|
|
dd($this->paramedic_id , $this->project->agreement);
|
|
|
|
|
if ($this->paramedic_id && $this->project->agreement == 1
|
|
|
|
|
&& strtotime($this->created_at) >= strtotime(Orders::AGREEMENT_START_DATE)
|
|
|
|
|
&& ($this->orderAgreementByLast()->isEmpty() || ($this->orderAgreementByLast()->isNotEmpty() && $this->orderAgreementByLast()->paramedic_id != $this->paramedic_id))) {
|
|
|
|
|
if ($order->paramedic_id
|
|
|
|
|
&& $order->project->agreement == 1
|
|
|
|
|
&& strtotime($order->created_at) >= strtotime(Orders::AGREEMENT_START_DATE)
|
|
|
|
|
&& ($order->orderAgreements->isEmpty() || ($order->orderAgreements->isNotEmpty() && $order->orderAgreements[0]->paramedic_id != $order->paramedic_id))) {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
|