/** * Resolve the permission item and return it's ID. * Defaults to null if no match can be found. * * @param $parent * @return mixed */ protected static function getPermissionID($permission) { $permission_id = null; // // If a string was provided, find the Permission based on that name. // if (is_string($permission)) { // $permission = Permission::where('name', $permission)->first(); // } $permission = Permission::resolve($permission); // If a Permission object was provided or found in the previous block, // return the ID of that object. if ($permission instanceof Permission) { $permission_id = $permission->id; } return $permission_id; }