protected function registerGates()
    {
        Gate::before(function($user, $permission) {
            try {
                if (method_exists($user, 'hasPermissionTo')) {
                    $permission = Shinobi::permission()->where('slug', $permission)->firstOrFail();

                    return $user->hasPermissionTo($permission) ?: null;
                }
            } catch (Exception $e) {
                // 
            }
        });
    }