GlenUK
1 week ago
174
9
Laravel

Dependancy Injection

Posted 1 week ago by GlenUK

Hello,

I have this class constructor:

    public function __construct(SeedData $seedData)
    {
        $this->techSupportList = $seedData::$TECH_SUPPORT;
    }

I see this from the laravel docs:

There is no need to bind classes into the container if they do not depend on any interfaces. The container does not need to be instructed on how to build these objects, since it can automatically resolve these objects using reflection.

So my understanding is $seedData would be an instance of the SeedData class, but my code complains I have not passed in the parameter. How far off the mark am I with this and what's the correct way to do what I wish to achieve here.

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