У меня есть страница категории, и здесь я хочу отобразить два типа ящиков на одной странице, один из них - starting_post
и old_post
или expired
.Как можно разделить одну страницу на две части?
class FrontendController extends Controller
{
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));
}
public function singlePost($slug)
{
$post=Post::whereSlug($slug)->first();
return view('single')->with('post', $post)
->with('content', $post)
->with('levels', Category::take(7)->get());
}
public function category($slug)
{
$category=Category::whereSlug($slug)->firstOrFail();
return view($category->getTemplateFile())->with('category', $category)
->with('title',$category->name)
->with('levels', Category::take(7)->get());
}
public function events($slug)
{
$post = Post::where('slug', $slug)->first();
$coming_events = Post::where('id', '>', $post->id)->desc('id');
$past_events = Post::where('id', '<', $post->id)->asc('id');
return view('events_blade')
->with('post', $post)
->with('categories', Category::take(7)->get())
->with('next', Post::find($coming_events))
->with('prev', Post::find($past_events));
}
}
// Просмотр |клинок
<div class="entry-meta">
<span>{{ \Carbon\Carbon::parse($post->date_time)->format('F j, Y') }}</span>
<div>
<h 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>