joedawson / amazon-ecs

With Laravel, search and lookup Amazon products easily.
MIT License
52 stars 26 forks source link

Class 'App\Http\Controllers\Amazon' not found #5

Closed mniblett closed 8 years ago

mniblett commented 8 years ago

I have the following method in a controller:

public function add()
    {
        $product = Amazon::lookup('B004VLKY8M')->json();
        return $product;

    }

and I'm getting a Class 'App\Http\Controllers\Amazon' not found

I'm not sure what use statement to place in the controller file, I have tried use Amazon; use Dawson\AmazonECS\AmazonECS use Dawson\AmazonECS\Amazon and many more versons and get the same result.

I have both Dawson\AmazonECS\AmazonECSServiceProvider::class, and 'Amazon' => Dawson\AmazonECS\AmazonECSFacade::class, in my config\app.php file in the correct place.

can't figure out why I am getting this error.

mrandibilbao commented 8 years ago

Hi,

please try \Amazon::lookup('B004VLKY8M')->json(); with the backslash \

Often Laravel can not find the class without the backslash.

i hope this helps

mniblett commented 8 years ago

blockquote, div.yahoo_quoted { margin-left: 0 !important; border-left:1px #715FFA solid !important; padding-left:1ex !important; background-color:white !important; } Thanks Joe, I am out of town for the weekend and will try that first thing when I get back. Fingers crossed!

Sent from Yahoo Mail for iPad

On Friday, September 2, 2016, 11:06 PM, mrandibilbao notifications@github.com wrote:

Hi,

please try \Amazon::lookup('B004VLKY8M')->json(); with the backslash \

Often Laravel can not find the class without the backslash.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

mniblett commented 8 years ago

Joe: Thanks, was able to test today and that did the trick. I was also able to go in and add my own parameters to AmazonECS, Since the default response group for the itemlookup is small, it might be nice to have that as a second availabel parameter for the itemlookup function. This is how i changed it to get what i was looking for. $params = $this->params(['ItemId' => $id, 'ResponseGroup' => 'ItemAttributes'], 'ItemLookup');

Thanks so much for your reply and sharing your work with the community.

On Saturday, September 3, 2016 5:34 PM, Michael Niblett <mniblett@sbcglobal.net> wrote:

yiv3145371815 blockquote, #yiv3145371815 div.yiv3145371815yahoo_quoted {margin-left:0 !important;border-left:1px #715FFA solid !important;padding-left:1ex !important;background-color:white;} Thanks Joe, I am out of town for the weekend and will try that first thing when I get back. Fingers crossed!

Sent from Yahoo Mail for iPad

On Friday, September 2, 2016, 11:06 PM, mrandibilbao notifications@github.com wrote: Hi,please try \Amazon::lookup('B004VLKY8M')->json(); with the backslash \ Often Laravel can not find the class without the backslash.— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.