1212use Foxdb \Exceptions \ModelNotFoundException ;
1313use Foxdb \Query \Builder ;
1414use Foxdb \Support \Collection ;
15+ use Foxdb \Eloquent \EagerBuilder ;
1516
1617/**
1718 * Base Model — Eloquent-style Active Record for FoxDB.
4950 * ---------------------------------------------------------------------------
5051 *
5152 * SELECT
52- * @method static Builder select(string|RawExpression ...$columns)
53- * @method static Builder addSelect(string|RawExpression ...$columns)
54- * @method static Builder selectRaw(string $expression, array $bindings = [])
55- * @method static Builder distinct()
53+ * @method static ModelBuilder select(string|RawExpression ...$columns)
54+ * @method static ModelBuilder addSelect(string|RawExpression ...$columns)
55+ * @method static ModelBuilder selectRaw(string $expression, array $bindings = [])
56+ * @method static ModelBuilder distinct()
57+ *
58+ * EAGER LOADING
59+ * @method static EagerBuilder with(string|array ...$relations)
5660 *
5761 * WHERE
58- * @method static Builder orWhere(string|\Closure $column, mixed $operatorOrValue = null, mixed $value = null)
59- * @method static Builder whereNot(string $column, mixed $operatorOrValue, mixed $value = null)
60- * @method static Builder whereRaw(string $expression, array $bindings = [])
61- * @method static Builder orWhereRaw(string $expression, array $bindings = [])
62- * @method static Builder whereIn(string $column, array $values)
63- * @method static Builder whereNotIn(string $column, array $values)
64- * @method static Builder orWhereIn(string $column, array $values)
65- * @method static Builder orWhereNotIn(string $column, array $values)
66- * @method static Builder whereBetween(string $column, mixed $min, mixed $max)
67- * @method static Builder whereNotBetween(string $column, mixed $min, mixed $max)
68- * @method static Builder whereNull(string $column)
69- * @method static Builder whereNotNull(string $column)
70- * @method static Builder orWhereNull(string $column)
71- * @method static Builder orWhereNotNull(string $column)
72- * @method static Builder whereColumn(string $first, string $operator, string $second)
73- * @method static Builder whereExists(callable|Builder $subquery)
74- * @method static Builder whereNotExists(callable|Builder $subquery)
75- * @method static Builder whereDate(string $column, string $operator, mixed $value)
76- * @method static Builder whereMonth(string $column, string $operator, mixed $value)
77- * @method static Builder whereDay(string $column, string $operator, mixed $value)
78- * @method static Builder whereYear(string $column, string $operator, mixed $value)
79- * @method static Builder whereTime(string $column, string $operator, mixed $value)
62+ * @method static ModelBuilder orWhere(string|\Closure $column, mixed $operatorOrValue = null, mixed $value = null)
63+ * @method static ModelBuilder whereNot(string $column, mixed $operatorOrValue, mixed $value = null)
64+ * @method static ModelBuilder whereRaw(string $expression, array $bindings = [])
65+ * @method static ModelBuilder orWhereRaw(string $expression, array $bindings = [])
66+ * @method static ModelBuilder whereIn(string $column, array $values)
67+ * @method static ModelBuilder whereNotIn(string $column, array $values)
68+ * @method static ModelBuilder orWhereIn(string $column, array $values)
69+ * @method static ModelBuilder orWhereNotIn(string $column, array $values)
70+ * @method static ModelBuilder whereBetween(string $column, mixed $min, mixed $max)
71+ * @method static ModelBuilder whereNotBetween(string $column, mixed $min, mixed $max)
72+ * @method static ModelBuilder whereNull(string $column)
73+ * @method static ModelBuilder whereNotNull(string $column)
74+ * @method static ModelBuilder orWhereNull(string $column)
75+ * @method static ModelBuilder orWhereNotNull(string $column)
76+ * @method static ModelBuilder whereColumn(string $first, string $operator, string $second)
77+ * @method static ModelBuilder whereExists(callable|Builder $subquery)
78+ * @method static ModelBuilder whereNotExists(callable|Builder $subquery)
79+ * @method static ModelBuilder whereDate(string $column, string $operator, mixed $value)
80+ * @method static ModelBuilder whereMonth(string $column, string $operator, mixed $value)
81+ * @method static ModelBuilder whereDay(string $column, string $operator, mixed $value)
82+ * @method static ModelBuilder whereYear(string $column, string $operator, mixed $value)
83+ * @method static ModelBuilder whereTime(string $column, string $operator, mixed $value)
8084 *
8185 * WHERE shorthands (v1 compatibility)
82- * @method static Builder is(string $column, mixed $value)
83- * @method static Builder true(string $column)
84- * @method static Builder false(string $column)
85- * @method static Builder like(string $column, string $value)
86- * @method static Builder orLike(string $column, string $value)
87- * @method static Builder null(string $column)
88- * @method static Builder notNull(string $column)
89- * @method static Builder in(string $column, array $values)
90- * @method static Builder notIn(string $column, array $values)
86+ * @method static ModelBuilder is(string $column, mixed $value)
87+ * @method static ModelBuilder true(string $column)
88+ * @method static ModelBuilder false(string $column)
89+ * @method static ModelBuilder like(string $column, string $value)
90+ * @method static ModelBuilder orLike(string $column, string $value)
91+ * @method static ModelBuilder null(string $column)
92+ * @method static ModelBuilder notNull(string $column)
93+ * @method static ModelBuilder in(string $column, array $values)
94+ * @method static ModelBuilder notIn(string $column, array $values)
9195 *
9296 * JOIN
93- * @method static Builder join(string $table, string $first, string $operator, string $second)
94- * @method static Builder leftJoin(string $table, string $first, string $operator, string $second)
95- * @method static Builder rightJoin(string $table, string $first, string $operator, string $second)
96- * @method static Builder crossJoin(string $table)
97- * @method static Builder joinSub(Builder $query, string $alias, string $first, string $operator, string $second)
98- * @method static Builder joinRaw(string $expression)
97+ * @method static ModelBuilder join(string $table, string $first, string $operator, string $second)
98+ * @method static ModelBuilder leftJoin(string $table, string $first, string $operator, string $second)
99+ * @method static ModelBuilder rightJoin(string $table, string $first, string $operator, string $second)
100+ * @method static ModelBuilder crossJoin(string $table)
101+ * @method static ModelBuilder joinSub(Builder $query, string $alias, string $first, string $operator, string $second)
102+ * @method static ModelBuilder joinRaw(string $expression)
99103 *
100104 * GROUP BY / HAVING
101- * @method static Builder groupBy(string ...$columns)
102- * @method static Builder having(string $column, string $operator, mixed $value)
103- * @method static Builder orHaving(string $column, string $operator, mixed $value)
104- * @method static Builder havingRaw(string $expression, array $bindings = [])
105+ * @method static ModelBuilder groupBy(string ...$columns)
106+ * @method static ModelBuilder having(string $column, string $operator, mixed $value)
107+ * @method static ModelBuilder orHaving(string $column, string $operator, mixed $value)
108+ * @method static ModelBuilder havingRaw(string $expression, array $bindings = [])
105109 *
106110 * ORDER / LIMIT / OFFSET
107- * @method static Builder orderBy(string $column, string $direction = 'asc')
108- * @method static Builder orderByDesc(string $column)
109- * @method static Builder orderByRaw(string $expression)
110- * @method static Builder latest(string $column = 'created_at')
111- * @method static Builder oldest(string $column = 'created_at')
112- * @method static Builder inRandomOrder()
113- * @method static Builder reorder()
114- * @method static Builder limit(int $value)
115- * @method static Builder take(int $value)
116- * @method static Builder offset(int $value)
117- * @method static Builder skip(int $value)
111+ * @method static ModelBuilder orderBy(string $column, string $direction = 'asc')
112+ * @method static ModelBuilder orderByDesc(string $column)
113+ * @method static ModelBuilder orderByRaw(string $expression)
114+ * @method static ModelBuilder latest(string $column = 'created_at')
115+ * @method static ModelBuilder oldest(string $column = 'created_at')
116+ * @method static ModelBuilder inRandomOrder()
117+ * @method static ModelBuilder reorder()
118+ * @method static ModelBuilder limit(int $value)
119+ * @method static ModelBuilder take(int $value)
120+ * @method static ModelBuilder offset(int $value)
121+ * @method static ModelBuilder skip(int $value)
118122 *
119123 * EXECUTE / FETCH
120124 * @method static Collection get()
145149 * @method static bool updateOrInsert(array $conditions, array $values = [])
146150 *
147151 * DEBUG
148- * @method static Builder dump()
152+ * @method static ModelBuilder dump()
149153 * @method static never dd()
150154 * @method static string toSql()
151155 * @method static array getBindings()
@@ -624,9 +628,9 @@ public static function query(): ModelBuilder
624628 * User::with(['posts' => fn($q) => $q->where('published', 1)])->get()
625629 *
626630 * @param string|array<string|int, string|callable> ...$relations
627- * @return \Foxdb\Eloquent\ EagerBuilder
631+ * @return EagerBuilder
628632 */
629- public static function with (string |array ...$ relations ): \ Foxdb \ Eloquent \ EagerBuilder
633+ public static function with (string |array ...$ relations ): EagerBuilder
630634 {
631635 // Normalise: accept both with('a','b') and with(['a','b']) and with(['a'=>fn])
632636 $ withs = [];
@@ -644,7 +648,7 @@ public static function with(string|array ...$relations): \Foxdb\Eloquent\EagerBu
644648 }
645649 }
646650
647- return new \ Foxdb \ Eloquent \ EagerBuilder ((new static ())->newQuery (), static ::class, $ withs );
651+ return new EagerBuilder ((new static ())->newQuery (), static ::class, $ withs );
648652 }
649653
650654 /**
0 commit comments