@@ -58,7 +58,7 @@ public function __construct(Application $app)
5858 *
5959 * @param class-string<\Illuminate\Database\Eloquent\Model>|string $model
6060 * @param string|null $connection
61- * @return array{"class": class-string<\Illuminate\Database\Eloquent\Model>, database: string, table: string, policy: string|null, attributes: \Illuminate\Support\Collection, relations: \Illuminate\Support\Collection, events: \Illuminate\Support\Collection, observers: \Illuminate\Support\Collection}
61+ * @return array{"class": class-string<\Illuminate\Database\Eloquent\Model>, database: string, table: string, policy: class- string|null, attributes: \Illuminate\Support\Collection, relations: \Illuminate\Support\Collection, events: \Illuminate\Support\Collection, observers: \Illuminate\Support\Collection, collection: class-string<\Illuminate\Database\Eloquent\Collection<\Illuminate\Database\Eloquent\Model>>, builder: class-string<\Illuminate\Database\Eloquent\Builder<\Illuminate\Database\Eloquent\Model>> }
6262 *
6363 * @throws BindingResolutionException
6464 */
@@ -82,6 +82,8 @@ public function inspect($model, $connection = null)
8282 'relations ' => $ this ->getRelations ($ model ),
8383 'events ' => $ this ->getEvents ($ model ),
8484 'observers ' => $ this ->getObservers ($ model ),
85+ 'collection ' => $ this ->getCollectedBy ($ model ),
86+ 'builder ' => $ this ->getBuilder ($ model ),
8587 ];
8688 }
8789
@@ -271,6 +273,30 @@ protected function getObservers($model)
271273 return collect ($ formatted );
272274 }
273275
276+ /**
277+ * Get the collection class being used by the model.
278+ *
279+ * @param \Illuminate\Database\Eloquent\Model $model
280+ * @return class-string<\Illuminate\Database\Eloquent\Collection>
281+ */
282+ protected function getCollectedBy ($ model )
283+ {
284+ return $ model ->newCollection ()::class;
285+ }
286+
287+ /**
288+ * Get the builder class being used by the model.
289+ *
290+ * @template TModel of \Illuminate\Database\Eloquent\Model
291+ *
292+ * @param TModel $model
293+ * @return class-string<\Illuminate\Database\Eloquent\Builder<TModel>>
294+ */
295+ protected function getBuilder ($ model )
296+ {
297+ return $ model ->newQuery ()::class;
298+ }
299+
274300 /**
275301 * Qualify the given model class base name.
276302 *
0 commit comments