Resource policies / can

The filament base resource has the static can method, which looks like:

    public static function can(string $action, ?Model $record = null): bool
    {
        if (static::shouldIgnorePolicies()) {
            return true;
        }

        $policy = Gate::getPolicyFor($model = static::getModel());
        $user = Filament::auth()->user();

        if ($policy === null) {
            return true;
        }

        if (! method_exists($policy, $action)) {
            return true;
        }

        return Gate::forUser($user)->check($action, $record ?? $model);
    }


I don't get the point from the last row. When already having the $policy and making sure, there is a method $action, why not just

return $policy->$action($user, $record ?? $model)

or what is the difference? In my current case, "my" line returns true, while Gate::forUser($user)->check($action, $record ?? $model) returns false. Is it possible, that it ignores the used guard?
Was this page helpful?