PHP code example of fullstack / stripe-product-manager
1. Go to this page and download the library: Download fullstack/stripe-product-manager 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/ */
fullstack / stripe-product-manager example snippets
use Fullstack\StripeProductManager\Traits\HasStripePermissions;
class User extends Authenticatable
{
use HasStripePermissions;
// ... rest of your User model
}
// Check permissions
if ($user->canViewStripeProducts()) {
// User can view products
}
if ($user->canCreateStripeProducts()) {
// User can create products
}
// Check roles
if ($user->isStripeAdmin()) {
// User is a Stripe admin
}
if ($user->hasStripeRole()) {
// User has any Stripe role
}
// Guard-specific checks
if ($user->isStripeAdminForTenant()) {
// User is a Stripe admin for tenant-admin guard
}
if ($user->isStripeAdminForSuper()) {
// User is a Stripe admin for super-admin guard
}
if ($user->canViewStripeProductsForTenant()) {
// User can view products for tenant-admin guard
}
// In your routes file
Route::middleware(['stripe.guard:tenant-admin'])->group(function () {
Route::get('/stripe/products', [StripeController::class, 'index']);
});
Route::middleware(['stripe.guard:super-admin'])->group(function () {
Route::get('/stripe/admin', [StripeAdminController::class, 'index']);
});
public function __construct()
{
$this->middleware('stripe.guard:tenant-admin');
}