flickering icon indicating copy to clipboard operation
flickering copied to clipboard

Dependency Injection with Laravel

Open bkintanar opened this issue 10 years ago • 6 comments

I have a detailed my issue here: http://forums.laravel.io/viewtopic.php?pid=58597#p58597

bkintanar avatar Oct 17 '13 16:10 bkintanar

It seems Laravel is resolving Flickering\Flickering to Flickering\Facades\Flickering, is there any App::bind or alias set that that way ?

Anahkiasen avatar Oct 17 '13 16:10 Anahkiasen

Well I've followed the tutorial here: http://www.mackhankins.com/blog/laravel/recent-flickr-photos-with-flickr-api-and-laravel

and it says to put the following in the app/config/app.php file

'aliases' => array( 'Flickering' => 'Flickering\Facades\Flickering' )

bkintanar avatar Oct 17 '13 16:10 bkintanar

Yeah but that's if you're going to use the Flickering facade directly, if you're going to use the class directly by injection, you don't need it.

Anahkiasen avatar Oct 17 '13 16:10 Anahkiasen

So I've tried removing the alias and what I'm getting now is

Call to undefined method Illuminate\Support\Facades\Config::get()

my code is

class PhotographyController extends BaseController {

    public function __construct(Flickering\Flickering $flickering)
    {
        $this->flickering = $flickering;

        $this->flickering->handshake(Config::get('flickr.app_key'), Config::get('flickr.api_secret'));
    }
}

bkintanar avatar Oct 17 '13 16:10 bkintanar

Can you show me the full code of the controller ?

Anahkiasen avatar Oct 17 '13 17:10 Anahkiasen

I pasted it here: http://paste.laravel.com/ZHY

bkintanar avatar Oct 17 '13 17:10 bkintanar