belongsTo(Credit::class)->withTrashed(); } /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function entity(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Credit::class)->withTrashed(); } /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function contact(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(ClientContact::class, 'client_contact_id', 'id')->withTrashed(); } /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(User::class)->withTrashed(); } /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function company(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Company::class); } public function getName() { return $this->key; } public function markViewed() { $this->viewed_date = Carbon::now(); $this->save(); } }