whereAccountId(Auth::user()->account_id); } public function account() { return $this->belongsTo('App\Models\Account'); } public function user() { return $this->belongsTo('App\Models\User')->withTrashed(); } public function vendorContact() { return $this->belongsTo('App\Models\VendorContact')->withTrashed(); } public function vendor() { return $this->belongsTo('App\Models\Vendor')->withTrashed(); } public function getMessage() { $activityTypeId = $this->activity_type_id; $account = $this->account; $vendor = $this->vendor; $user = $this->user; $contactId = $this->contact_id; $isSystem = $this->is_system; $data = [ 'vendor' => link_to($vendor->getRoute(), $vendor->getDisplayName()), 'user' => $isSystem ? '' . trans('texts.system') . '' : $user->getDisplayName(), 'vendorcontact' => $contactId ? $vendor->getDisplayName() : $user->getDisplayName(), ]; return trans("texts.activity_{$activityTypeId}", $data); } }