@bunyad/orm 0.1.0-alpha.0 → 0.2.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/model.d.ts CHANGED
@@ -81,7 +81,7 @@ export declare class Model {
81
81
  /** When false, `save()` skips `created_at` / `updated_at`. */
82
82
  static timestamps: boolean;
83
83
  /**
84
- * Laravel `$casts` property — prefer `static casts()` when adding enums / Attribute.
84
+ * `$casts` property — prefer `static casts()` when adding enums / Attribute.
85
85
  * May be a plain object or a method returning the map.
86
86
  */
87
87
  static casts: Record<string, CastDefinition> | (() => Record<string, CastDefinition>);
@@ -92,22 +92,22 @@ export declare class Model {
92
92
  */
93
93
  static relations: RelationsMap;
94
94
  /**
95
- * Laravel `$touches` — relation names whose related models get `touch()` after
95
+ * `$touches` — relation names whose related models get `touch()` after
96
96
  * this model is saved (or soft-deleted). Honor `withoutTouching`.
97
97
  */
98
98
  static touches: string[];
99
- /** Laravel `$hidden`. */
99
+ /** `$hidden`. */
100
100
  static hidden: string[];
101
- /** Laravel `$visible` allow-list (empty = all non-hidden). */
101
+ /** `$visible` allow-list (empty = all non-hidden). */
102
102
  static visible: string[];
103
- /** Laravel `$appends` — accessors included in `toArray()`. */
103
+ /** `$appends` — accessors included in `toArray()`. */
104
104
  static appends: string[];
105
- /** Laravel `$fillable`. */
105
+ /** `$fillable`. */
106
106
  static fillable: readonly string[] | string[];
107
- /** Laravel `$guarded` — default guard all until fillable is set. */
107
+ /** `$guarded` — default guard all until fillable is set. */
108
108
  static guarded: readonly string[] | string[];
109
109
  id: string | number;
110
- /** Laravel `$exists` — true after retrieve / successful insert. */
110
+ /** `$exists` — true after retrieve / successful insert. */
111
111
  get exists(): boolean;
112
112
  set exists(value: boolean);
113
113
  constructor(attributes?: Record<string, unknown>);
@@ -121,81 +121,81 @@ export declare class Model {
121
121
  /** Current attribute bag (non-function own properties). */
122
122
  getAttributes(): Record<string, unknown>;
123
123
  /**
124
- * Laravel `getAttribute` — throws when `preventAccessingMissingAttributes` is on
124
+ * `getAttribute` — throws when `preventAccessingMissingAttributes` is on
125
125
  * and the key was not retrieved / does not exist (relations exempt).
126
126
  */
127
127
  getAttribute(key: string): unknown;
128
- /** Laravel `isDirty`. */
128
+ /** `isDirty`. */
129
129
  isDirty(...attributes: string[]): boolean;
130
- /** Laravel `isClean`. */
130
+ /** `isClean`. */
131
131
  isClean(...attributes: string[]): boolean;
132
- /** Laravel `getDirty`. */
132
+ /** `getDirty`. */
133
133
  getDirty(): Record<string, unknown>;
134
- /** Laravel `getOriginal`. */
134
+ /** `getOriginal`. */
135
135
  getOriginal(): Record<string, unknown>;
136
136
  getOriginal(key: string): unknown;
137
- /** Laravel `getChanges` — attributes changed by the last save. */
137
+ /** `getChanges` — attributes changed by the last save. */
138
138
  getChanges(): Record<string, unknown>;
139
- /** Laravel `wasChanged`. */
139
+ /** `wasChanged`. */
140
140
  wasChanged(...attributes: string[]): boolean;
141
- /** Laravel `wasRecentlyCreated`. */
141
+ /** `wasRecentlyCreated`. */
142
142
  wasRecentlyCreated(): boolean;
143
- /** Laravel `append`. */
143
+ /** `append`. */
144
144
  append(...attributes: string[]): this;
145
- /** Laravel `setAppends`. */
145
+ /** `setAppends`. */
146
146
  setAppends(attributes: string[]): this;
147
- /** Laravel `getAppends`. */
147
+ /** `getAppends`. */
148
148
  getAppends(): string[];
149
- /** Laravel `getHidden`. */
149
+ /** `getHidden`. */
150
150
  getHidden(): string[];
151
- /** Laravel `getVisible`. */
151
+ /** `getVisible`. */
152
152
  getVisible(): string[];
153
- /** Laravel `setHidden`. */
153
+ /** `setHidden`. */
154
154
  setHidden(attributes: string[]): this;
155
- /** Laravel `setVisible`. */
155
+ /** `setVisible`. */
156
156
  setVisible(attributes: string[]): this;
157
- /** Laravel `makeVisible` — show attributes for this instance. */
157
+ /** `makeVisible` — show attributes for this instance. */
158
158
  makeVisible(...attributes: string[]): this;
159
- /** Laravel `makeHidden` — hide attributes for this instance. */
159
+ /** `makeHidden` — hide attributes for this instance. */
160
160
  makeHidden(...attributes: string[]): this;
161
161
  /**
162
- * Run a callback without touching timestamps (Laravel `Model::withoutTimestamps`).
162
+ * Run a callback without touching timestamps (`Model::withoutTimestamps`).
163
163
  */
164
164
  static withoutTimestamps<T>(this: typeof Model, callback: () => T | Promise<T>): Promise<T>;
165
165
  /**
166
- * Laravel `Model::withoutTouching` — skip parent `touch()` while callback runs.
166
+ * `Model::withoutTouching` — skip parent `touch()` while callback runs.
167
167
  * Pass model classes to limit which models ignore touch; omit for all.
168
168
  */
169
169
  static withoutTouching<T>(this: typeof Model, callback: () => T | Promise<T>): Promise<T>;
170
170
  static withoutTouching<T>(this: typeof Model, models: Array<typeof Model>, callback: () => T | Promise<T>): Promise<T>;
171
171
  /** Whether touch is currently suppressed for this model class. */
172
172
  static isIgnoringTouch(this: typeof Model): boolean;
173
- /** Laravel `Model::preventLazyLoading`. */
173
+ /** `Model::preventLazyLoading`. */
174
174
  static preventLazyLoading(prevent?: boolean): void;
175
- /** Laravel `Model::preventSilentlyDiscardingAttributes`. */
175
+ /** `Model::preventSilentlyDiscardingAttributes`. */
176
176
  static preventSilentlyDiscardingAttributes(prevent?: boolean): void;
177
- /** Laravel `Model::preventAccessingMissingAttributes`. */
177
+ /** `Model::preventAccessingMissingAttributes`. */
178
178
  static preventAccessingMissingAttributes(prevent?: boolean): void;
179
- /** Laravel `Model::shouldBeStrict` — enable/disable the strictness trio. */
179
+ /** `Model::shouldBeStrict` — enable/disable the strictness trio. */
180
180
  static shouldBeStrict(should?: boolean): void;
181
- /** Laravel `Model::addGlobalScope`. */
181
+ /** `Model::addGlobalScope`. */
182
182
  static addGlobalScope(this: typeof Model, nameOrScope: string | GlobalScopeCallback, scope?: GlobalScopeCallback): void;
183
- /** Laravel `Model::addGlobalScope` removal helper. */
183
+ /** `Model::addGlobalScope` removal helper. */
184
184
  static removeGlobalScope(this: typeof Model, name: string): void;
185
185
  /**
186
- * Laravel `boot` — runs once per model class before first use.
186
+ * `boot` — runs once per model class before first use.
187
187
  * Prefer registering listeners in `booted()`.
188
188
  */
189
189
  static boot(): void;
190
190
  /**
191
- * Laravel `booted` — runs once after `boot`. Typical place for `static::created(...)`.
191
+ * `booted` — runs once after `boot`. Typical place for `static::created(...)`.
192
192
  */
193
193
  static booted(): void;
194
194
  /** Ensure this model class has been booted. */
195
195
  static bootIfNotBooted(): void;
196
- /** Laravel `Model::observe`. */
196
+ /** `Model::observe`. */
197
197
  static observe<T extends Model>(this: abstract new (...args: never[]) => T, observer: ModelObserver<T> | (new () => ModelObserver<T>) | Array<ModelObserver<T> | (new () => ModelObserver<T>)>): void;
198
- /** Laravel `Model::withoutEvents`. */
198
+ /** `Model::withoutEvents`. */
199
199
  static withoutEvents<T>(this: typeof Model, callback: () => T | Promise<T>): T | Promise<T>;
200
200
  static retrieved(callback: ModelEventListener): void;
201
201
  static creating(callback: ModelEventListener): void;
@@ -219,13 +219,13 @@ export declare class Model {
219
219
  static castAttributes(attributes: Record<string, unknown>, direction: "get" | "set"): Record<string, unknown>;
220
220
  static setConnection(connection: Connection): void;
221
221
  static getConnection(): Connection;
222
- /** Laravel `$model->setConnection($name)`. */
222
+ /** `$model->setConnection($name)`. */
223
223
  setConnection(connection: string | Connection): this;
224
224
  /** Active connection for this instance (instance override → model → default). */
225
225
  getConnection(): Connection;
226
226
  static db(): DatabaseManager;
227
227
  /**
228
- * Laravel `Model::on($connection)` — same model, different named connection.
228
+ * `Model::on($connection)` — same model, different named connection.
229
229
  */
230
230
  static on<T extends typeof Model>(this: T, connection: string): ModelQuery<InstanceType<T>>;
231
231
  /**
@@ -233,37 +233,37 @@ export declare class Model {
233
233
  * Local scopes (`scopeActive` → `.active()`) are available via proxy.
234
234
  */
235
235
  static newQuery<T extends typeof Model>(this: T, options?: ModelQueryOptions): ModelQuery<InstanceType<T>>;
236
- /** Laravel `withoutGlobalScopes()`. */
236
+ /** `withoutGlobalScopes()`. */
237
237
  static withoutGlobalScopes<T extends typeof Model>(this: T, names?: string[]): ModelQuery<InstanceType<T>>;
238
- /** Laravel `withoutGlobalScope($name)`. */
238
+ /** `withoutGlobalScope($name)`. */
239
239
  static withoutGlobalScope<T extends typeof Model>(this: T, name: string): ModelQuery<InstanceType<T>>;
240
- /** Laravel `Model::query()` — scoped `ModelQuery` (not a raw table builder). */
240
+ /** `Model::query()` — scoped `ModelQuery` (not a raw table builder). */
241
241
  static query<T extends typeof Model>(this: T, options?: ModelQueryOptions): ModelQuery<InstanceType<T>>;
242
- /** Laravel `Model::find`. */
242
+ /** `Model::find`. */
243
243
  static find<T extends typeof Model>(this: T, id: string | number): InstanceType<T> | null | Promise<InstanceType<T> | null>;
244
- /** Laravel `getRouteKeyName()` — column used for implicit route binding. */
244
+ /** `getRouteKeyName()` — column used for implicit route binding. */
245
245
  static getRouteKeyName(): string;
246
246
  /**
247
- * Laravel `resolveRouteBinding` — find by PK or custom `{param:column}` field.
247
+ * `resolveRouteBinding` — find by PK or custom `{param:column}` field.
248
248
  */
249
249
  static resolveRouteBinding<T extends typeof Model>(this: T, value: string | number, field?: string): InstanceType<T> | null | Promise<InstanceType<T> | null>;
250
250
  /**
251
- * Laravel SoftDeletes `resolveSoftDeletableRouteBinding` — same as
251
+ * `resolveSoftDeletableRouteBinding` — same as
252
252
  * `resolveRouteBinding` but includes soft-deleted rows (`withTrashed()`).
253
253
  * Used by the router when the route opts in via `withTrashed()`.
254
254
  */
255
255
  static resolveSoftDeletableRouteBinding<T extends typeof Model>(this: T, value: string | number, field?: string): InstanceType<T> | null | Promise<InstanceType<T> | null>;
256
- /** Laravel `Model::findOrFail`. */
256
+ /** `Model::findOrFail`. */
257
257
  static findOrFail<T extends typeof Model>(this: T, id: string | number): Promise<InstanceType<T>>;
258
- /** Laravel `Model::all`. */
258
+ /** `Model::all`. */
259
259
  static all<T extends typeof Model>(this: T): Promise<OrmCollection<InstanceType<T>>>;
260
260
  /**
261
- * Laravel `Model::get` — same as `query().get()` / `all()`.
261
+ * `Model::get` — same as `query().get()` / `all()`.
262
262
  * Typed helper for autocomplete; Proxy also forwards other terminals.
263
263
  */
264
264
  static get<T extends typeof Model>(this: T): OrmCollection<InstanceType<T>> | Promise<OrmCollection<InstanceType<T>>>;
265
265
  /**
266
- * Laravel `Model::pluck($column, $key = null)`.
266
+ * `Model::pluck($column, $key = null)`.
267
267
  * One column → list Collection; with `key` → keyed Record (see Collection.pluck).
268
268
  */
269
269
  static pluck<T extends typeof Model>(this: T, column: string): Promise<Collection<unknown>>;
@@ -272,13 +272,13 @@ export declare class Model {
272
272
  static allSync<T extends typeof Model>(this: T): OrmCollection<InstanceType<T>>;
273
273
  /** SQLite-only sync `find` — see `ModelQuery.firstSync`. */
274
274
  static findSync<T extends typeof Model>(this: T, id: string | number): InstanceType<T> | null;
275
- /** Laravel `Model::where`. */
275
+ /** `Model::where`. */
276
276
  static where<T extends typeof Model>(this: T, callback: (query: ModelQuery<InstanceType<T>>) => void): ModelQuery<InstanceType<T>>;
277
277
  static where<T extends typeof Model>(this: T, column: string, value: unknown): ModelQuery<InstanceType<T>>;
278
278
  static where<T extends typeof Model>(this: T, column: string, op: string, value: unknown): ModelQuery<InstanceType<T>>;
279
279
  /** Karobar-style multi-column LIKE search. */
280
280
  static search<T extends typeof Model>(this: T, columns: string[], term: string): ModelQuery<InstanceType<T>>;
281
- /** Start a new query and forward common builder methods (Laravel `__callStatic`). */
281
+ /** Start a new query and forward common builder methods (`__callStatic`). */
282
282
  static orWhere<T extends typeof Model>(this: T, column: string, value: unknown): ModelQuery<InstanceType<T>>;
283
283
  static orWhere<T extends typeof Model>(this: T, column: string, op: string, value: unknown): ModelQuery<InstanceType<T>>;
284
284
  static whereIn<T extends typeof Model>(this: T, column: string, values: unknown[]): ModelQuery<InstanceType<T>>;
@@ -294,36 +294,36 @@ export declare class Model {
294
294
  static limit<T extends typeof Model>(this: T, value: number): ModelQuery<InstanceType<T>>;
295
295
  static take<T extends typeof Model>(this: T, value: number): ModelQuery<InstanceType<T>>;
296
296
  static select<T extends typeof Model>(this: T, ...columns: string[]): ModelQuery<InstanceType<T>>;
297
- /** Laravel `Model::whereDate`. */
297
+ /** `Model::whereDate`. */
298
298
  static whereDate<T extends typeof Model>(this: T, column: string, value: DateInput): ModelQuery<InstanceType<T>>;
299
299
  static whereDate<T extends typeof Model>(this: T, column: string, op: string, value: DateInput): ModelQuery<InstanceType<T>>;
300
- /** Laravel `Model::whereNot(closure)`. */
300
+ /** `Model::whereNot(closure)`. */
301
301
  static whereNot<T extends typeof Model>(this: T, callback: (query: ModelQuery<InstanceType<T>>) => void): ModelQuery<InstanceType<T>>;
302
- /** Laravel `Model::orWhereNot(closure)`. */
302
+ /** `Model::orWhereNot(closure)`. */
303
303
  static orWhereNot<T extends typeof Model>(this: T, callback: (query: ModelQuery<InstanceType<T>>) => void): ModelQuery<InstanceType<T>>;
304
- /** Laravel `withTrashed()`. */
304
+ /** `withTrashed()`. */
305
305
  static withTrashed<T extends typeof Model>(this: T): ModelQuery<InstanceType<T>>;
306
- /** Laravel `onlyTrashed()`. */
306
+ /** `onlyTrashed()`. */
307
307
  static onlyTrashed<T extends typeof Model>(this: T): ModelQuery<InstanceType<T>>;
308
- /** Laravel `withoutTrashed()`. */
308
+ /** `withoutTrashed()`. */
309
309
  static withoutTrashed<T extends typeof Model>(this: T): ModelQuery<InstanceType<T>>;
310
310
  /** `get()` returns plain row objects. Models are not built. */
311
311
  static rows<T extends typeof Model>(this: T): ModelQuery<InstanceType<T>, "row">;
312
312
  /** Eager-load relations (`with('posts')`, `with({ posts: (q) => q.where(…) })`). */
313
313
  static with<T extends typeof Model>(this: T, ...relations: Array<string | string[] | Record<string, unknown>>): ModelQuery<InstanceType<T>>;
314
- /** Laravel `Model::whereHas`. */
314
+ /** `Model::whereHas`. */
315
315
  static whereHas<T extends typeof Model>(this: T, relation: string, callback?: (query: ModelQuery) => void): ModelQuery<InstanceType<T>>;
316
- /** Laravel `Model::whereDoesntHave`. */
316
+ /** `Model::whereDoesntHave`. */
317
317
  static whereDoesntHave<T extends typeof Model>(this: T, relation: string, callback?: (query: ModelQuery) => void): ModelQuery<InstanceType<T>>;
318
- /** Laravel `Model::orWhereHas`. */
318
+ /** `Model::orWhereHas`. */
319
319
  static orWhereHas<T extends typeof Model>(this: T, relation: string, callback?: (query: ModelQuery) => void): ModelQuery<InstanceType<T>>;
320
- /** Laravel `Model::whereRelation`. */
320
+ /** `Model::whereRelation`. */
321
321
  static whereRelation<T extends typeof Model>(this: T, relation: string, column: string, opOrValue: unknown, value?: unknown): ModelQuery<InstanceType<T>>;
322
- /** Laravel `Model::orWhereRelation`. */
322
+ /** `Model::orWhereRelation`. */
323
323
  static orWhereRelation<T extends typeof Model>(this: T, relation: string, column: string, opOrValue: unknown, value?: unknown): ModelQuery<InstanceType<T>>;
324
324
  /** `withCount` — `'posts'`, `'posts as post_total'`, a string list, or `{ products: { as: 'productsCount' } }`. */
325
325
  static withCount<T extends typeof Model>(this: T, ...relations: Array<string | string[] | Record<string, unknown>>): ModelQuery<InstanceType<T>>;
326
- /** Laravel `Model::withSum`. */
326
+ /** `Model::withSum`. */
327
327
  static withSum<T extends typeof Model>(this: T, relation: string, column: string): ModelQuery<InstanceType<T>>;
328
328
  static withAvg<T extends typeof Model>(this: T, relation: string, column: string): ModelQuery<InstanceType<T>>;
329
329
  static withMin<T extends typeof Model>(this: T, relation: string, column: string): ModelQuery<InstanceType<T>>;
@@ -335,33 +335,33 @@ export declare class Model {
335
335
  static whereAll<T extends typeof Model>(this: T, columns: string[], opOrValue: unknown, value?: unknown): ModelQuery<InstanceType<T>>;
336
336
  static whereNone<T extends typeof Model>(this: T, columns: string[], opOrValue: unknown, value?: unknown): ModelQuery<InstanceType<T>>;
337
337
  static whereKey<T extends typeof Model>(this: T, id: string | number | Array<string | number>): ModelQuery<InstanceType<T>>;
338
- /** Laravel `Model::whereUuid`. */
338
+ /** `Model::whereUuid`. */
339
339
  static whereUuid<T extends typeof Model>(this: T, column: string, value: string): ModelQuery<InstanceType<T>>;
340
- /** Laravel `Model::whereUlid`. */
340
+ /** `Model::whereUlid`. */
341
341
  static whereUlid<T extends typeof Model>(this: T, column: string, value: string): ModelQuery<InstanceType<T>>;
342
- /** Laravel `Model::join`. */
342
+ /** `Model::join`. */
343
343
  static join<T extends typeof Model>(this: T, table: string, first: string, op: string, second: string): ModelQuery<InstanceType<T>>;
344
- /** Laravel `Model::leftJoin`. */
344
+ /** `Model::leftJoin`. */
345
345
  static leftJoin<T extends typeof Model>(this: T, table: string, first: string, op: string, second: string): ModelQuery<InstanceType<T>>;
346
- /** Laravel `Model::paginate`. */
346
+ /** `Model::paginate`. */
347
347
  static paginate<T extends typeof Model>(this: T, perPage?: number, page?: number, options?: {
348
348
  path?: string;
349
349
  pageName?: string;
350
350
  }): Promise<LengthAwarePaginator<InstanceType<T>>>;
351
- /** Laravel `Model::cursorPaginate`. */
351
+ /** `Model::cursorPaginate`. */
352
352
  static cursorPaginate<T extends typeof Model>(this: T, perPage?: number, cursor?: string | null, options?: {
353
353
  path?: string;
354
354
  cursorName?: string;
355
355
  }): Promise<CursorPaginator<InstanceType<T>>>;
356
- /** Laravel `Model::create` (respects `$fillable` / `$guarded`). */
356
+ /** `Model::create` (respects `$fillable` / `$guarded`). */
357
357
  static create<T extends typeof Model>(this: T, attributes: Record<string, unknown>): InstanceType<T> | Promise<InstanceType<T>>;
358
- /** Laravel `Model::forceCreate` — insert every given attribute, ignoring `$fillable`. */
358
+ /** `Model::forceCreate` — insert every given attribute, ignoring `$fillable`. */
359
359
  static forceCreate<T extends typeof Model>(this: T, useAttrs: Record<string, unknown>): InstanceType<T> | Promise<InstanceType<T>>;
360
- /** Laravel `firstOrNew`. */
360
+ /** `firstOrNew`. */
361
361
  static firstOrNew<T extends typeof Model>(this: T, attributes: Record<string, unknown>, values?: Record<string, unknown>): Promise<InstanceType<T>>;
362
- /** Laravel `firstOrCreate`. */
362
+ /** `firstOrCreate`. */
363
363
  static firstOrCreate<T extends typeof Model>(this: T, attributes: Record<string, unknown>, values?: Record<string, unknown>): Promise<InstanceType<T>>;
364
- /** Laravel `updateOrCreate`. */
364
+ /** `updateOrCreate`. */
365
365
  static updateOrCreate<T extends typeof Model>(this: T, attributes: Record<string, unknown>, values?: Record<string, unknown>): Promise<InstanceType<T>>;
366
366
  /**
367
367
  * Bulk insert. Delegates to `ModelQuery.insert` (timestamps stamped when enabled).
@@ -369,49 +369,49 @@ export declare class Model {
369
369
  */
370
370
  static insert<T extends typeof Model>(this: T, values: Record<string, unknown> | Record<string, unknown>[]): Promise<boolean>;
371
371
  /**
372
- * Laravel `Model::upsert` — bulk insert-or-update on unique conflict.
372
+ * `Model::upsert` — bulk insert-or-update on unique conflict.
373
373
  * Delegates to `ModelQuery.upsert` (timestamps stamped when enabled).
374
374
  */
375
375
  static upsert<T extends typeof Model>(this: T, values: Record<string, unknown> | Record<string, unknown>[], uniqueBy: string | string[], update?: string[] | null): Promise<number>;
376
- /** Laravel `$model->fill($attributes)`. */
376
+ /** `$model->fill($attributes)`. */
377
377
  fill(attributes: Record<string, unknown>): this;
378
- /** Laravel `$model->update($attributes)`. */
378
+ /** `$model->update($attributes)`. */
379
379
  update(attributes: Record<string, unknown>): Promise<this>;
380
380
  save(): this | Promise<this>;
381
- /** Laravel `$model->saveQuietly()`. */
381
+ /** `$model->saveQuietly()`. */
382
382
  saveQuietly(): Promise<this>;
383
- /** Laravel `$model->refresh()`. */
383
+ /** `$model->refresh()`. */
384
384
  refresh(): Promise<this>;
385
385
  /**
386
- * Laravel-style refresh under row lock (`lockForUpdate`).
386
+ * Refresh under row lock (`lockForUpdate`).
387
387
  * Reloads this instance from a locked select of the same primary key.
388
388
  */
389
389
  refreshForUpdate(): Promise<this>;
390
- /** Laravel `$model->fresh()`. */
390
+ /** `$model->fresh()`. */
391
391
  fresh(): Promise<this | null>;
392
392
  /** Eager-load relations onto this model (`load('posts')` / constrained maps). */
393
393
  load(...relations: Array<string | Record<string, unknown>>): Promise<this>;
394
394
  /** Load only relations that are not already present. */
395
395
  loadMissing(...relations: Array<string | Record<string, unknown>>): Promise<this>;
396
- /** Laravel `$model->relationLoaded($key)`. */
396
+ /** `$model->relationLoaded($key)`. */
397
397
  relationLoaded(key: string): boolean;
398
398
  /**
399
- * Laravel `$model->touches($relation)` — whether `$touches` lists this relation.
399
+ * `$model->touches($relation)` — whether `$touches` lists this relation.
400
400
  */
401
401
  touches(relation: string): boolean;
402
402
  /**
403
- * Laravel `$model->touchOwners()` — touch each relation in `$touches`.
403
+ * `$model->touchOwners()` — touch each relation in `$touches`.
404
404
  * Uses `relation.touch()` when available (BelongsTo / HasOne / HasMany);
405
405
  * otherwise loads the related model and calls `touch()` on it.
406
406
  */
407
407
  touchOwners(): Promise<void>;
408
408
  /**
409
- * Laravel `$model->touch()` — bump `updated_at` (no-op while `withoutTouching`).
409
+ * `$model->touch()` — bump `updated_at` (no-op while `withoutTouching`).
410
410
  * Saving also runs `$touches` / `touchOwners()` for listed relations.
411
411
  */
412
412
  touch(): Promise<boolean>;
413
413
  /**
414
- * Relation query builder (`$model->product()` in Laravel).
414
+ * Relation query builder (`$model->product()`).
415
415
  *
416
416
  * Define relations on `static relations` and declare the loaded property:
417
417
  * `declare product: Product | null` — then use `model.product` after `with('product')`,
@@ -420,66 +420,66 @@ export declare class Model {
420
420
  * Legacy instance methods named `product()` remain supported via the prototype.
421
421
  */
422
422
  related(name: string): unknown;
423
- /** Laravel `$model->replicate()`. */
423
+ /** `$model->replicate()`. */
424
424
  replicate(except?: string[]): this;
425
425
  delete(): Promise<void>;
426
426
  restore(): Promise<void>;
427
427
  forceDelete(): Promise<void>;
428
- /** Laravel `$model->deleteQuietly()`. */
428
+ /** `$model->deleteQuietly()`. */
429
429
  deleteQuietly(): Promise<void>;
430
430
  trashed(): boolean;
431
- /** Laravel `$model->toArray()`. */
431
+ /** `$model->toArray()`. */
432
432
  toArray(): Record<string, unknown>;
433
- /** Laravel `$model->loadCount(...$relations)`. */
433
+ /** `$model->loadCount(...$relations)`. */
434
434
  loadCount(...relations: string[]): Promise<this>;
435
- /** Laravel `$model->loadSum($relation, $column)`. */
435
+ /** `$model->loadSum($relation, $column)`. */
436
436
  loadSum(relation: string, column: string): Promise<this>;
437
437
  loadAvg(relation: string, column: string): Promise<this>;
438
438
  loadMin(relation: string, column: string): Promise<this>;
439
439
  loadMax(relation: string, column: string): Promise<this>;
440
- /** Laravel `$model->loadExists(...$relations)`. */
440
+ /** `$model->loadExists(...$relations)`. */
441
441
  loadExists(...relations: string[]): Promise<this>;
442
442
  toJSON(): Record<string, unknown>;
443
443
  /** Alias of {@link toJSON}. */
444
444
  toJson(): Record<string, unknown>;
445
- /** Laravel `$model->increment($column, $amount)`. */
445
+ /** `$model->increment($column, $amount)`. */
446
446
  increment(column: string, amount?: number): Promise<this>;
447
- /** Laravel `$model->decrement($column, $amount)`. */
447
+ /** `$model->decrement($column, $amount)`. */
448
448
  decrement(column: string, amount?: number): Promise<this>;
449
- /** Laravel `Model::destroy($ids)`. */
449
+ /** `Model::destroy($ids)`. */
450
450
  static destroy<T extends typeof Model>(this: T, ids: Array<string | number> | string | number): Promise<number>;
451
451
  /**
452
- * Laravel `Model::forceDestroy($ids)` — permanent delete by key(s).
452
+ * `Model::forceDestroy($ids)` — permanent delete by key(s).
453
453
  * Soft-delete models are found via `withTrashed()` so trashed rows are included.
454
454
  */
455
455
  static forceDestroy<T extends typeof Model>(this: T, ids: Array<string | number> | string | number): Promise<number>;
456
- /** Laravel `$this->hasMany(Related::class)`. */
456
+ /** `$this->hasMany(Related::class)`. */
457
457
  hasMany<R extends ModelClass>(related: R, foreignKey?: string, localKey?: string): HasMany<InstanceType<R>>;
458
- /** Laravel `$this->hasOne(Related::class)`. */
458
+ /** `$this->hasOne(Related::class)`. */
459
459
  hasOne<R extends ModelClass>(related: R, foreignKey?: string, localKey?: string): HasOne<InstanceType<R>>;
460
460
  /**
461
- * Laravel `$this->hasManyThrough(Related::class, Through::class)`.
461
+ * `$this->hasManyThrough(Related::class, Through::class)`.
462
462
  * Parent → Through (firstKey) → Related (secondKey).
463
463
  */
464
464
  hasManyThrough<R extends ModelClass, TThrough extends ModelClass>(related: R, through: TThrough, firstKey?: string, secondKey?: string, localKey?: string, secondLocalKey?: string): HasManyThrough<InstanceType<R>>;
465
465
  /**
466
- * Laravel `$this->hasOneThrough(Related::class, Through::class)`.
466
+ * `$this->hasOneThrough(Related::class, Through::class)`.
467
467
  */
468
468
  hasOneThrough<R extends ModelClass, TThrough extends ModelClass>(related: R, through: TThrough, firstKey?: string, secondKey?: string, localKey?: string, secondLocalKey?: string): HasOneThrough<InstanceType<R>>;
469
- /** Laravel `$this->belongsTo(Related::class)`. */
469
+ /** `$this->belongsTo(Related::class)`. */
470
470
  belongsTo<R extends ModelClass>(related: R, foreignKey?: string, ownerKey?: string): BelongsTo<InstanceType<R>>;
471
- /** Laravel `$this->belongsToMany(Related::class, pivot)`. */
471
+ /** `$this->belongsToMany(Related::class, pivot)`. */
472
472
  belongsToMany<R extends ModelClass>(related: R, table?: string, foreignPivotKey?: string, relatedPivotKey?: string): BelongsToMany<InstanceType<R>>;
473
473
  /**
474
474
  * Polymorphic many-to-many (`model_has_roles`-style pivots).
475
475
  * Third argument may be the pivot table name or an options bag (tenant/legacy morph types).
476
476
  */
477
477
  morphToMany<R extends ModelClass>(related: R, name: string, tableOrOptions?: string | MorphToManyOptions, foreignPivotKey?: string, relatedPivotKey?: string): MorphToMany<InstanceType<R>>;
478
- /** Laravel `$this->morphMany(Related::class, name)`. */
478
+ /** `$this->morphMany(Related::class, name)`. */
479
479
  morphMany<R extends ModelClass>(related: R, name: string, type?: string, id?: string, localKey?: string): MorphMany<InstanceType<R>>;
480
- /** Laravel `$this->morphOne(Related::class, name)`. */
480
+ /** `$this->morphOne(Related::class, name)`. */
481
481
  morphOne<R extends ModelClass>(related: R, name: string, type?: string, id?: string, localKey?: string): MorphOne<InstanceType<R>>;
482
- /** Laravel `$this->morphTo($name)`. */
482
+ /** `$this->morphTo($name)`. */
483
483
  morphTo(name: string, type?: string, id?: string, ownerKey?: string): MorphTo;
484
484
  }
485
485
  /** True when `value` is a Model subclass constructor (O(1) prototype check). */