PHP code example of culturekings / shopify-app-auth-laravel
1. Go to this page and download the library: Download culturekings/shopify-app-auth-laravel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
culturekings / shopify-app-auth-laravel example snippets
// $appName comes from url passed into method as param (look at middleware)
$shopifyAppConfig = config('shopify-auth.'.$appName);
/ call shopify api
$this->shopify
->setKey($shopifyAppConfig['key'])
->setSecret($shopifyAppConfig['secret'])
->setShopUrl($shopUrl)
->setAccessToken($accessToken)
->post('admin/script_tags.json', $scriptTags);
public function __construct(ShopifyApi $shopify, Request $request, ShopifyAuthService $shopifyAuthService)
{
$this->shopify = $shopify;
$this->shopifySession = $request->session()->get('shopifyapp');
$this->shopifyAuthService = $shopifyAuthService;
}
public function getDashboard()
{
$shopUrl = $this->shopifySession['shop_url'];
$appName = $this->shopifySession['app_name'];
// find user, then get countdowns based on that
$user = ShopifyUser::where([
'shop_url' => $shopUrl,
'app_name' => $appName,
])->first();
$appConfig = config('shopify-auth.' . $appName);
$this->checkExistsAndCreateScriptTag($shopUrl, $user->access_token, $user, $appName);
return view('app_name.dashboard')->with([
'app_key' => config($appConfig['key']),
]);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.