__('crm::lang.phone_status_pending'), 'contacted' => __('crm::lang.phone_status_contacted'), 'no_answer' => __('crm::lang.phone_status_no_answer'), 'interested' => __('crm::lang.phone_status_interested'), 'not_interested' => __('crm::lang.phone_status_not_interested'), 'converted' => __('crm::lang.phone_status_converted'), ]; } public function logs() { return $this->hasMany(CrmPhoneFollowUpLog::class, 'phone_follow_up_id')->latest(); } public function assignedUser() { return $this->belongsTo(User::class, 'assigned_to'); } public function createdBy() { return $this->belongsTo(User::class, 'created_by'); } public function lead() { return $this->belongsTo(CrmContact::class, 'lead_id'); } public function company() { return $this->belongsTo(CrmCompany::class, 'company_id'); } public function scopeOnlyOwn($query) { $query->where(function ($qry) { $qry->where('crm_phone_follow_ups.assigned_to', auth()->user()->id) ->orWhere('crm_phone_follow_ups.created_by', auth()->user()->id); }); } }