I'm want to display latest 6 posts on my homepage.Here I'm using Laravel and Javascript. but I'm getting the layout in different way. How can I display those things here. Any idea. Thanks in Advance.
<div class="row">
<div class="col-lg-4">
<h2>{{$article->title}}</h2>
{{ $article->created_at->toFormattedDateString() }}
<p>{{$article->body}} </p>
<p><a class="btn btn-primary" href="#" role="button">View details »</a></p>
</div>
<div class="col-lg-4">
<h2>{{$article->title}}</h2>
{{ $article->created_at->toFormattedDateString() }}
<p>{{$article->body}} </p>
<p><a class="btn btn-primary" href="#" role="button">View details »</a></p>
</div>
<div class="col-lg-4">
<h2>{{$article->title}}</h2>
{{ $article->created_at->toFormattedDateString() }}
<p>{{$article->body}}</p>
<p><a class="btn btn-primary" href="#" role="button">View details »</a></p>
</div>
</div>
@extends('master')
@section('content')
<div class="container">
@foreach ($article as $article)
@include('article.post')
@endforeach
</div>
@endsection
I want to display like view in a pattern but i'm getting a duplicate data. how can i rectify that View pic
Please try these
$acticle->orderby('created_at', 'DESC')->take(6)->get()
Thanks
如果表acticle中的字段ID是自动增量,请尝试执行此操作
$acticle->orderby('id', 'DESC')->take(6)->get()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.