Skip to content

Commit c1e9b33

Browse files
authored
Added Eloquent Model alias at ApplicationProvider
Related psalm#271
1 parent 1c85f59 commit c1e9b33

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/Providers/ApplicationProvider.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
use Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider;
88
use Illuminate\Contracts\Console\Kernel;
99
use Illuminate\Contracts\Foundation\Application;
10+
use Illuminate\Database\Eloquent\Model;
1011
use Illuminate\Foundation\Application as LaravelApplication;
12+
use Illuminate\Foundation\AliasLoader;
1113
use Laravel\Lumen\Application as LumenApplication;
1214
use Orchestra\Testbench\Concerns\CreatesApplication;
1315

@@ -34,9 +36,30 @@ public static function bootApp(): void
3436
$app->boot();
3537
}
3638

39+
self::bootAppRegister();
40+
self::bootAppAlias();
41+
}
42+
43+
/**
44+
* @param LaravelApplication $app
45+
*
46+
* @return void
47+
*/
48+
protected static function bootAppRegister($app): void
49+
{
3750
$app->register(IdeHelperServiceProvider::class);
3851
}
3952

53+
/**
54+
* @param LaravelApplication $app
55+
*
56+
* @return void
57+
*/
58+
protected static function bootAppAlias($app): void
59+
{
60+
AliasLoader::getInstance()->alias('Eloquent', Model::class);
61+
}
62+
4063
/**
4164
* @return LaravelApplication|LumenApplication
4265
*/

0 commit comments

Comments
 (0)