PHP code example of edstevo / laravel-integration-credentials
1. Go to this page and download the library: Download edstevo/laravel-integration-credentials 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/ */
edstevo / laravel-integration-credentials example snippets
namespace App\Models;
use EdStevo\LaravelIntegrationCredentials\Models\Concerns\MorphManyIntegrationCredentials;
use Illuminate\Database\Eloquent\Model;
class Store extends Model
{
use MorphManyIntegrationCredentials;
}
$store->setIntegrationCredential('shopify', 'access_token', 'token_123');
$credential = $store->getIntegrationCredential('shopify', 'access_token');
$value = $store->getIntegrationCredentialValue('shopify', 'access_token');
$store->setIntegrationCredential(
provider: 'shopify',
key: 'access_token',
value: 'token_123',
expiresAt: now()->addHour(),
);
$validValue = $store->getIntegrationCredentialValue('shopify', 'access_token');
$
$store->forgetIntegrationCredential('shopify', 'access_token');
$store->forgetIntegrationProvider('shopify');
$store = Store::whereHasIntegrationCredentialValue('shopify', 'shop_id', '12345')->first();
$storeIncludingExpired = Store::whereHasIntegrationCredentialValue(
provider: 'shopify',
key: 'shop_id',
value: '12345',
mustBeValid: false,
)->first();
bash
php artisan vendor:publish --tag="laravel-integration-credentials-migrations"
php artisan migrate