Package Dependency and namespacing

Posted 3 years ago by jrean


I'm practicing and working on a small test package. Lets say in my package I have a Foo class. The Foo class has a doSomething method which is responsible for updating a particular attribute on the eloquent User model of the authenticated user. I wrote the following:

use App\User;

public function doSomething(User $user)

Now I just realise it will work by default with the App\User namespace but as soon as I "name" my app with the php artisan app:name :name command it will break.

What is the best practice to handle such a situation?

Thank you.

Please sign in or create an account to participate in this conversation.