我需要从数据库中显示动态徽标和网站口号。这两个数据都是views / includes / topbar.blade.php中的静态定义
查看/包括/ topbar.blade.php
<header>
<div class="container-fluid">
<!--top-->
<div id="top">
<div class="col-left">
<div class="africe"> Website Slogan </div>
<div class="call_us"> call us: <span>+xx-xxxxx</span> </div>
</div>
<div class="col-right">
<div class="top-right">
<ul>
<li>Follow Us:</li>
<li><i class="fa fa-twitter"></i></li>
<li><i class="fa fa-facebook"></i></li>
<li><i class="fa fa-instagram"></i></li>
<li>
<button class="Enquire_now">ENQUIRE NOW</button>
</li>
</ul>
</div>
</div>
</div>
</div>
</header>
答案 0 :(得分:0)
您可以尝试view composers将数据共享到所有视图。
public function compose(View $view)
{
//get options model from database
$options = Model::where('foo', 'bar')->first();
//passing options to view
$view->with('options', $options);
}
在你看来,称他们为,
<div class="col-left">
<div class="africe"> {{ $options->slogan }} </div>
</div>