Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Eloquent Model alias at ApplicationProvider #273

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/Providers/ApplicationProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@

use Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider;
use Illuminate\Contracts\Console\Kernel;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Application as LaravelApplication;
use Illuminate\Foundation\AliasLoader;
use Laravel\Lumen\Application as LumenApplication;
use Orchestra\Testbench\Concerns\CreatesApplication;

use function define;
Expand All @@ -33,9 +37,20 @@ public static function bootApp(): void
// @todo do not bootstrap \Illuminate\Foundation\Bootstrap\HandleExceptions
$consoleApp->bootstrap();

self::bootAppRegister($app);
self::bootAppAlias();
}

protected static function bootAppRegister(LaravelApplication $app): void
{
$app->register(IdeHelperServiceProvider::class);
}

protected static function bootAppAlias(): void
{
AliasLoader::getInstance()->alias('Eloquent', Model::class);
}

public static function getApp(): LaravelApplication
{
if (self::$app instanceof \Illuminate\Container\Container) {
Expand Down