PHP code example of jaspaul / laravel-rollout

1. Go to this page and download the library: Download jaspaul/laravel-rollout 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/ */

    

jaspaul / laravel-rollout example snippets




use Jaspaul\LaravelRollout\Helpers\User as Contract;

class User implements Contract
{
    /**
     * @return string
     */
    public function getRolloutIdentifier()
    {
        return $this->id;
    }
}



use Jaspaul\LaravelRollout\Contracts\Group;

class BetaUsersGroup implements Group
{
    /**
     * The name of the group.
     *
     * @return string
     */
    public function getName(): string
    {
        return 'beta-users';
    }

     /**
     * Defines the rule membership in the group.
     *
     * @return boolean
     */
    public function hasMember($user = null): bool
    {
        if (!is_null($user)) {
            return $user->hasOptedIntoBeta();
        }

        return false;
    }
}

return [
    ...
    'groups' => [
        BetaUsersGroup::class
    ],
    ...
]
sh
php artisan vendor:publish --provider 'Jaspaul\LaravelRollout\ServiceProvider'
sh
php artisan migrate