Laravel Nova在资源中添加了custum标题和描述

时间:2019-07-03 11:16:52

标签: php laravel laravel-nova

比方说,我在左侧边栏中有一个名为“博客”的资源。在Nova中显示该资源时,我可以看到所有已创建的博客文章。我想做的是在要传递给index.blade.php的资源上添加标题和描述,但这是否可能?

现在我的控制器如下:

public function index()
{

    $blogs = Blog::where("publishes_on", "<=", Carbon::now())
        ->orderBy('publishes_on', 'desc')
        ->published()
        ->get();

    return view('app.blog.index')->with('blogs', $blogs);
}

我希望我的index.blade.php看起来像这样:

<header>            
   <div class="col col-lg-8 mx-lg-auto col-xl-6">
       <h1> {{ TITLE OF RESOURCE }} </h1> // forexample "Blog"
       <p> {{ DESCRIPTION OF RESOURCE }}</p> // forexample "Here you can see all blog posts, please click on them to read.."

   </div>
</header
<div>
 @foreach($blogs as $blog)
     <div class="col-12 col-md-6 col-lg-6 mx-lg-auto col-xl-6 card-blog">
          <div class="card mb-4 ">
              <div class="row no-gutters position-relative">
                  <div class="col-12">
                     <img class="card-img-top" src="{{ asset('storage/'. $blog->teaser_image) }}" alt="{{ $blog->title }}">
                   </div>
                   <div class="col-12 position-static">
                      <div class="card-body">
                         <h3 class="card-title">{!! $blog->title !!}</h3>
                         <a href="/blog/{{ $blog->slug }}" class="card-link d-block mt-4 stretched-link">Læs mere</a>
                      </div>
                   </div>
               </div>
          </div>
     </div>
@endforeach

有人可以帮我吗?

0 个答案:

没有答案