Skip to content

Instantly share code, notes, and snippets.

View mortenscheel's full-sized avatar

Morten Scheel mortenscheel

View GitHub Profile
@mortenscheel
mortenscheel / entrust-user-permission.md
Last active February 16, 2019 16:55 — forked from uzegonemad/entrust-user-permission.md
Entrust Laravel 5.3+ User Permissions

Edits

All credit goes to uzegonemad. I've only added the following.

  1. Now supports Laravel 5.3+ (using pluck() method in stead of lists())
  2. The methods attachPermission() and detachPermission() now accept strings (name of the permission)
  3. Permissions are reloaded before can() checks to ensure they are up to date.

What is this?

Entrust is a fantastic role-based permission library for Laravel. However, by design, it only supports attaching permissions to roles, not to users.