Support the ongoing development of Laravel.io →
posted 9 years ago
IOC

I have set up a repository interface and a repository class

namespace Repository\Findbrok\Contracts;

/**

  • Interface UserRepositoryInterface

  • @package Repository\Findbrok\Contracts */ interface UserRepositoryInterface {

    public function getRegisteredUsers();

}

namespace Repository\Findbrok;

use Repository\Findbrok\Contracts\UserRepositoryInterface;

/**

  • Class UserRepository

  • @package Repository\Findbrok */ class UserRepository implements UserRepositoryInterface {

    public function getRegisteredUsers() { return 3; }

}

I binded it in the register method of the AppServiceProvider like so

//Bind user repository of findbrok $this->app->bind('Repository\Findbrok\Contracts\UserRepositoryInterface', 'Repositroy\Findbrok\UserRepository');

But when I am trying to acces it in my controller using injection in my constructor i am getting an InvalidArgumentException

/** * Class Constructor */ public function __construct(FindbrokUserRepository $repo) { }

Can anyone help me?

Last updated 3 years ago.
0

I realised my mistake a typo in the class name when i binded my interface to my class.

My MIstake

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.