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

Don't alias App\Nova by default #66

Merged
merged 1 commit into from
Feb 26, 2019
Merged

Don't alias App\Nova by default #66

merged 1 commit into from
Feb 26, 2019

Conversation

dwightwatson
Copy link
Contributor

This isn't a bug, but something minor that I believe could be improved. Generally my use of the autoloader in Tinker is to perform database queries, as it saves you prefixing each model with App\. However, if you're also using Nova in your app all those classes will take precedence because of the order they are loaded.

>>> User::first()
[!] Aliasing 'User' to 'App\Nova\User' for this Tinker session.
PHP Fatal error:  Call to undefined method User::first() in Psy Shell code on line 1
>>> App\User::first()

The easiest fix here would be not to alias Nova classes - and I wonder if this might be considered for the default config rather than something you'd have to add yourself.

'dont_alias' => [
    'App\Nova'
],

Obviously it assumes your main namespace will be App for this to work, and it won't negatively affect anyone who isn't using Nova. However, it might be a nice improvement to the experience.

@taylorotwell taylorotwell merged commit 46c1866 into laravel:master Feb 26, 2019
@dwightwatson dwightwatson deleted the nova branch February 26, 2019 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants