Hi, I'm looking at the 'Roles and Permissions' video and when I try to add a permission check in the 'boot' function in the 'AuthServiceProvider.php' it gives me the error 'Undefined variable: permission'. I'm using Laravel 5.2
This is the permission check thingy:
foreach ($this->getPermissions() as $permission) {
$gate->define($permission->name, function ($user) {
$user->hasRole($permission->roles);
});
}
And here's the getPermissions
protected function getPermissions()
{
return Permission::with('roles')->get();
}