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(); } /** @deprecated 5.7 */ public function pdf_file_path() { $storage_path = Storage::url($this->credit->client->quote_filepath($this).$this->credit->numberFormatter().'.pdf'); if (! Storage::exists($this->credit->client->credit_filepath($this).$this->credit->numberFormatter().'.pdf')) { // (new CreateEntityPdf($this))->handle(); } return $storage_path; } }