me10071990
4 months ago

How to display multiple post in single blade by using two row(example starting post, expired_date post)

Posted 4 months ago by me10071990

I have a category page created by template and in this I want to display two types of box in single page, one is starting_post and old_post or expired, how can divide a single page in two part?

public function welcome()

{
   // @TODO Refactor This Line
    return view('welcome')
        ->with('title', Setting::first()->site_name)
        ->with('levels', Category::take(7)->get())
        ->with('levels', Category::take(7)->get())
        ->with('first_post', Post::orderBy('created_at','asc')->first())
        ->with('second_post', Post::orderBy('created_at', 'asc')->skip(1)->take(1)->get()->first())
        ->with('third_post', Post::orderBy('created_at','asc')->skip(2)->take(2)->get()->first())
        ->with('forth_post', Post::orderBy('created_at','asc')->skip(3)->take(3)->get()->first())
        ->with('HOME', Category::find(1))
        ->with('ABOUT US', Category::find(2))
        ->with('RESEARCH', Category::find(3))
        ->with('NEWS AND PUBLICATION', Category::find(4))
        ->with('EVENTS', Category::find(5))
        ->with('PEOPLE', Category::find(6))
       ->with('CONTACT US',Category::find(7));
}

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