'boolean', 'updated_at' => 'timestamp', 'created_at' => 'timestamp', 'deleted_at' => 'timestamp', ]; public function getEntityType() { return self::class; } public function backup() { return $this->hasOne(Backup::class); } /** * @return mixed */ public function user() { return $this->belongsTo(User::class)->withTrashed(); } /** * @return mixed */ public function contact() { return $this->belongsTo(ClientContact::class)->withTrashed(); } /** * @return mixed */ public function client() { return $this->belongsTo(Client::class)->withTrashed(); } /** * @return mixed */ public function invoice() { return $this->belongsTo(Invoice::class)->withTrashed(); } /** * @return mixed */ public function payment() { return $this->belongsTo(Payment::class)->withTrashed(); } // public function task() // { // return $this->belongsTo(Task::class)->withTrashed(); // } // public function expense() // { // return $this->belongsTo(Expense::class)->withTrashed(); // } public function company() { return $this->belongsTo(Company::class); } public function resolveRouteBinding($value, $field = null) { if (is_numeric($value)) { throw new ModelNotFoundException("Record with value {$value} not found"); } return $this //->withTrashed() ->where('id', $this->decodePrimaryKey($value))->firstOrFail(); } }