Larastan v3.12.0 added the larastan.relationExistence rule, which
detects Eloquent relations by their declared return type. statuses()
defined the hasMany relation but lacked the ': HasMany' return type, so
the rule could not recognize it and flagged $filter->load([...,
'statuses']) in CustomFilterController.php as referencing a missing
relation. Add the return type to match the sibling keywords() method.
Verified with larastan/larastan v3.12.0 (No errors).
Move all Eloquent models from the app/ root directory to app/Models/
for consistency with modern Laravel conventions. The project already had
54 models in App\Models; this migrates the remaining 52 legacy models.
Changes:
- Move 52 model files from app/ to app/Models/
- Update namespace declarations in each model
- Update all ~1000 import references across the codebase
- Add Relation::morphMap() in AppServiceProvider for backward
compatibility with existing polymorphic database records
- Add missing HasSnowflakePrimary imports for models that relied
on same-namespace resolution
Replace \Cache::, \Log::, \DB:: calls with their imported facade
equivalents. The backslash-prefix relies on global aliases which
PHPStan cannot resolve, causing class.notFound errors.