如何在 Laravel 中使一个词成为通用变量

How to make one word univeral variable in Laravel

不知道合不合逻辑,

我想在 view 文件中制作一个变量 @ads 无论我把 @ads

它将调用特定的 div 元素:

<div class="ads">
@if(condition)
 some block of codes...
@endif
</div>

这是为@ads 定义的。 可能吗?如果是怎么办?

您可以自由使用 @include 指令:

@if(condition)
    @include('ads')
@endif

它将包括来自 ads.blade.php

的 blade 视图