自动调用bladelaravel中的路由?

automatically call the route in blade laravel?

我是 Laravel 的新手,如何在 blade 中自动调用路由 这里是 Laravel 中使用 laravel 8

的代码
    @if($activity_type=='General-Activity')
{{ (route('support.direction',$activity_id)) }}
@endif

让我在 Laravelblade 中解释一下我想检查 $activity_type=='General-Activity' 是否路由 support.direction 并传递我使用的值上面的代码只打印这个 http://localhost:8000/progress/direction/21c73354-5158-4697-98cb-066800d16e03 我不知道如何自动路由而不是通过使用

单击

我假设您正在尝试在条件为真时自动重定向用户。您可以使用带有 JavaScriptswitch 案例来处理重定向过程。例如。如果 URI 是 www.example.com/xyz,则通过使用 echo url()->current(); 访问当前页面 url 来获取请求 这将输出请求并使用 switch case 来处理重定向过程。对于 Exapmle,这里是 Laravel.

中的示例代码
{{ $url = url()->current(); }}
@switch($url)
    @case('foo')
        First case...
        <script>
        <!-- simulate the script with a mouse click or http redirect -->
        // Simulate a mouse click:
        window.location.href = "http://www.w3schools.com";

        // Simulate an HTTP redirect:
        window.location.replace("http://www.w3schools.com");
        </script>
        @break

    @case('baz')
        Second case...
        <script>
        <!-- simulate the script with a mouse click or http redirect -->
        // Simulate a mouse click:
        window.location.href = "http://www.w3schools.com";

        // Simulate an HTTP redirect:
        window.location.replace("http://www.w3schools.com");
        </script>
        @break

    @default
        Default case...
@endswitch