Ho can compare two post in single blade by date?

Posted 6 days ago by me10071990

I have PEOPLE.blade menu section in this I have two row one is new post and one is old post, I want to arrange by date, I am trying to put the logic but not working. what I have to do next thanks

this is my view.blade(peolple)

@extends('layouts.frontend')

@section('content')

<div style="background-image:url(/app/images/head/event.jpg)"class="wrap-slider my-wrap-slider ">
    <div class="container page-container">
        <div class="page-content">
            <div class="page-title">
                <h1 class="tshadow">{{$category->name}}</h1>

            </div><!-- page-title -->
        </div>
    </div><!-- container -->
</div><!-- wrap-slider -->
<section class="flat-row pd-blog bg-theme blog-list3 blog-list3-style2">
    <div class="container">
        <div class="wrap-post">
            New people
            <div class="row">

                @foreach($category->posts as $post)
                <div class="col-md-12 wrap-grid">
                    <article class="entry">
                        <div class="row">
                            <div class="col-md-8 col-sm-8">
                                <div class="entry-post">
                                    <div class="entry-meta">
                                        <span>{{ \Carbon\Carbon::parse($post->date_time)->format('j F, Y')  }}</span>

                                    </div>
                                    <h3 class="entry-title">{{ $post->title }}</h3>

                                    <div class="entry-content">
                                        <a  target="_blank" href="{{ asset("$post->file") }}"><p style="font-size: 18px;color: #468b10;">   {{ $post->content }}</p></a>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-4 col-sm-4">
                                <div class="feature-post">
                                    @if ($post->featured)

                                  <img src="{{ $post->featured }}" alt="image"></a>
                                </div>

                                @endif
                            </div>
                        </div>
                    </article>



                </div><!-- col-md-6 -->

                @endforeach
            </div><!-- row -->
        </div><!-- wrap-post -->

            Old people

        <div class="row">

            @foreach($category->posts as $post)
                <div class="col-md-12 wrap-grid">
                    <article class="entry">
                        <div class="row">
                            <div class="col-md-8 col-sm-8">
                                <div class="entry-post">
                                    <div class="entry-meta">
                                        <span>{{ \Carbon\Carbon::parse($post->date_time)->format('j F, Y')  }}</span>

                                    </div>
                                    <h3 class="entry-title">{{ $post->title }}</h3>

                                    <div class="entry-content">
                                        <a  target="_blank" href="{{ asset("$post->file") }}"><p style="font-size: 18px;color: #468b10;">   {{ $post->content }}</p></a>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-4 col-sm-4">
                                <div class="feature-post">
                                    @if ($post->featured)

                                        <img src="{{ $post->featured }}" alt="image"></a>
                                </div>

                                @endif
                            </div>
                        </div>
                    </article>



                </div><!-- col-md-6 -->

            @endforeach
        </div><!-- row -->
    </div><!-- wrap-post -->

    </div><!-- container -->
</section>

@endsection

here is part of postController

/ Create Initial Required Data Array $data = [

        'link'=>$request->link,
        'title'=>$request->title,
        'content'=>$request->content,
        'category_id'=>$request->category_id,
        'slug'=>str_slug($request->title),
        'date_time' => Carbon::parse($request->date_time)->format('Y-m-d'),

    ];

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.