'object', 'updated_at' => 'timestamp', 'created_at' => 'timestamp', 'deleted_at' => 'timestamp', ]; protected $fillable = [ 'name', 'settings', ]; protected $appends = [ 'hashed_id', ]; public function getHashedIdAttribute() { return $this->encodePrimaryKey($this->id); } protected $touches = []; public function company() { return $this->belongsTo(Company::class); } public function user() { return $this->belongsTo(User::class)->withTrashed(); } public function clients() { return $this->hasMany(Client::class, 'id', 'group_settings_id'); } public function documents() { return $this->morphMany(Document::class, 'documentable'); } /** * Retrieve the model for a bound value. * * @param mixed $value * @param null $field * @return Model|null */ public function resolveRouteBinding($value, $field = null) { if (is_numeric($value)) { throw new ModelNotFoundException("Record with value {$value} not found"); } return $this ->withTrashed() ->company() ->where('id', $this->decodePrimaryKey($value))->firstOrFail(); } }