joshrps / laravel-shopify-API-wrapper

Interface designed for Shopify apps created with Laravel
MIT License
93 stars 48 forks source link

Support for Laravel 5.4 #22

Open smick opened 7 years ago

smick commented 7 years ago

Greetings,

When I install in Laravel 5.4 I get the following error:

FatalThrowableError in shopify.php line 11: Class 'App\Http\Controllers\App' not found

It looks like the App->Make() parameters have been removed from Laravel, which is a breaking change for your API.

ShaunaGordon commented 7 years ago

While the make format doesn't work anymore, you can still use new RocketCode\Shopify\API to create a new instance with parameters.

dvkhang commented 7 years ago

please example , i need it

jnguyendevel commented 7 years ago

put this line at the top of your controller: use RocketCode\Shopify\API

instead of $sh = App->Make('ShopifyAPI');

do this: $sh = new API;

mikebe11 commented 7 years ago

Just spent time wondering why the make with setup shortcut wouldn't work for me and turns out it was the removal of make() with params. You can now use makeWith() in newer 5.4 versions of Laravel. It was added to about a month ago. I just upgraded from 5.4.15 => 5.4.19 and it's in there. https://github.com/laravel/framework/pull/18271

So now either should work:

$sh = App::make('ShopifyAPI'); $sh->setup(['API_KEY' => '', 'API_SECRET' => '', 'SHOP_DOMAIN' => '', 'ACCESS_TOKEN' => '']);

or

$sh = App::makeWith('ShopifyAPI', ['API_KEY' => '', 'API_SECRET' => '', 'SHOP_DOMAIN' => '', 'ACCESS_TOKEN' => '']);