$clients * @property-read int|null $clients_count * @property-read \App\Models\Company $company * @property-read \Illuminate\Database\Eloquent\Collection $documents * @property-read int|null $documents_count * @property-read mixed $hashed_id * @property-read \App\Models\User|null $user * @method static \Illuminate\Database\Eloquent\Builder|StaticModel company() * @method static \Illuminate\Database\Eloquent\Builder|StaticModel exclude($columns) * @method static \Illuminate\Database\Eloquent\Builder|GroupSetting newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|GroupSetting newQuery() * @method static \Illuminate\Database\Eloquent\Builder|GroupSetting onlyTrashed() * @method static \Illuminate\Database\Eloquent\Builder|GroupSetting query() * @method static \Illuminate\Database\Eloquent\Builder|GroupSetting whereCompanyId($value) * @method static \Illuminate\Database\Eloquent\Builder|GroupSetting whereCreatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|GroupSetting whereDeletedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|GroupSetting whereId($value) * @method static \Illuminate\Database\Eloquent\Builder|GroupSetting whereIsDefault($value) * @method static \Illuminate\Database\Eloquent\Builder|GroupSetting whereIsDeleted($value) * @method static \Illuminate\Database\Eloquent\Builder|GroupSetting whereName($value) * @method static \Illuminate\Database\Eloquent\Builder|GroupSetting whereSettings($value) * @method static \Illuminate\Database\Eloquent\Builder|GroupSetting whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|GroupSetting whereUserId($value) * @method static \Illuminate\Database\Eloquent\Builder|GroupSetting withTrashed() * @method static \Illuminate\Database\Eloquent\Builder|GroupSetting withoutTrashed() * @property-read \Illuminate\Database\Eloquent\Collection $clients * @mixin \Eloquent */ class GroupSetting extends StaticModel { use MakesHash; use SoftDeletes; protected $casts = [ 'settings' => '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(); } }