Skip to content

v1.0.0-alpha.3

Pre-release
Pre-release
Compare
Choose a tag to compare
@JosephSilber JosephSilber released this 21 Sep 01:43
· 384 commits to master since this release

New

  • Support Laravel 5.4.31, which broke Bouncer.

  • Greatly enhanced granting multiple roles/abilities at once:

    // Assign multiple roles:
    Bouncer::assign(['admin', 'editor'])->to($user);
    
    // Allow multiple abilities:
    Bouncer::allow($user)->to(['access-dashboard', 'ban-users']);
    
    // Also works with model abilities:
    Bouncer::allow($user)->to(['edit', 'delete'], Post::class);
    Bouncer::allow($user)->to(['edit', 'delete'], $post);
    
    // And even with multiple models:
    Bouncer::allow($user)->to('delete', [Post::class, Category::class]);
    Bouncer::allow($user)->to(['edit', 'delete'], [Post::class, Category::class]);
    
    // Go crazy and pass it an associative array with whatever you want:
    Bouncer::allow($user)->to([
        'create' => Post::class,
        'view'   => User::class,
        'edit'   => $user,
    ]);
  • Added a whereIsNot scope to the hasRoles trait.

Breaking Changes