feat: display ten most-recent articles on homepage
This commit is contained in:
parent
e8188c28bb
commit
62a9279603
|
|
@ -7,4 +7,18 @@
|
|||
<h1>{{ config('blog.publishing_name') }}<h1>
|
||||
<p><i>{{ config('blog.subheading') }}</i></p>
|
||||
</section>
|
||||
<section>
|
||||
@forelse($articles as $article)
|
||||
<article>
|
||||
<h3>
|
||||
Article: {{ $article->title }}
|
||||
</h3>
|
||||
<p>
|
||||
{!! $article->body !!}
|
||||
</p>
|
||||
</article>
|
||||
@empty
|
||||
<div>No articles published yet. Check back soon!</div>
|
||||
@endforelse
|
||||
</section>
|
||||
@endsection
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ use Illuminate\Support\Facades\Route;
|
|||
*/
|
||||
|
||||
Route::get('/', function () {
|
||||
return view('guest.home');
|
||||
$articles = Article::latest()->limit(10)->get();
|
||||
return view('guest.home', ['articles' => $articles]);
|
||||
});
|
||||
|
||||
Route::get('/test-insert', function () {
|
||||
|
|
|
|||
Loading…
Reference in New Issue