Installation

Composer Installation

You may use Composer to install Marketplaceful into your new or existent Laravel project:

  1. After you've purchased a license, add the satis.marketplaceful.com repository in your composer.json.

    "repositories": [
        {
            "type": "composer",
            "url": "https://satis.marketplaceful.com"
        }
    ],
    
  2. Next, you need to create a file called auth.json and place it either next to the composer.json file in your project, or in the Composer home directory. You can determine the Composer home directory on *nix machines by using this command.

    composer config --list --global | grep home
    

    This is the content you should put in auth.json, and use your Marketplaceful API token:

    {
        "bearer": {
            "satis.marketplaceful.com": "<YOUR-MARKETPLACEFUL-API-TOKEN>"
        }
    }
    
  3. Add the marketplaceful:install command to post-autoload-dump in composer.json.

    "post-autoload-dump": [
        "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
        "@php artisan package:discover --ansi",
        "@php artisan marketplaceful:install --ansi"
    ],
    
  4. Require marketplaceful/marketplaceful-core.

    composer require marketplaceful/marketplaceful-core
    
  5. Add the MarketplacefulAuthenticatable trait to your existing User model:

    namespace App\Models;
    
    use Illuminate\Foundation\Auth\User as Authenticatable;
    use Marketplaceful\Traits\InteractsAsMarketplaceUser;
    
    class User extends Authenticatable {
    
        use InteractsAsMarketplaceUser;
    
    }
    
  6. Run migrations.

    php artisan migrate
    

Dashboard Authorization

Marketplaceful exposes a dashboard at /marketplaceful. By default, you will only be able to access this dashboard in the local environment. To use it in another environment, you need to register a gate check.

You can determine which users of your application are allowed to view the Marketplaceful dashboard by defining a gate check called viewMarketplaceful.

A common place to register this check is in a service provider:

// in a service provider

public function boot()
{
   Gate::define('viewMarketplaceful', function ($user) {
       return in_array($user->email, [
            '[email protected]',
        ]);
   });
}