'timestamp', 'created_at' => 'timestamp', 'deleted_at' => 'timestamp', ]; protected $fillable = [ 'first_name', 'last_name', 'phone', 'custom_value1', 'custom_value2', 'custom_value3', 'custom_value4', 'email', 'is_primary', ]; public function getEntityType() { return VendorContact::class; } public function getHashedIdAttribute() { return $this->encodePrimaryKey($this->id); } public function getContactIdAttribute() { return $this->encodePrimaryKey($this->id); } public function vendor() { return $this->belongsTo(Vendor::class)->withTrashed(); } public function primary_contact() { return $this->where('is_primary', true); } public function company() { return $this->belongsTo(Company::class); } public function user() { return $this->belongsTo(User::class)->withTrashed(); } public function sendPasswordResetNotification($token) { $this->notify(new ClientContactResetPassword($token)); } public function preferredLocale() { $languages = Cache::get('languages'); return $languages->filter(function ($item) { return $item->id == $this->client->getSetting('language_id'); })->first()->locale; //$lang = Language::find($this->client->getSetting('language_id')); //return $lang->locale; } /** * Retrieve the model for a bound value. * * @param mixed $value * @return \Illuminate\Database\Eloquent\Model|null */ public function resolveRouteBinding($value) { return $this ->withTrashed() ->where('id', $this->decodePrimaryKey($value))->firstOrFail(); } }