<div class="post-box"> <a href="{{ route('timeline.getTimeline', $post->user->id) }}"> <img class="img-rounded" src="{{ $post->user->portrait_large }}" width="50" height="50" alt=""> </a> <div> <h5><a href="{{ route('job.show', $post->slug) }}">{{ $post->title }}</a></h5> <small>{{ date("M d, Y",strtotime($post->created_at)) }}</small> </div> </div> @endforeach </div> {{-- /Recent Posts Widget --}} {{-- Tags Widget --}} <div class="widget"> <div class="widget-title"> <h4>热议主题</h4> </div> <ul class="widget-tag"> <?php $categories = JobCategories::where('cat_status', 'open')->orderBy('sort_order')->get(); ?> @foreach($categories as $category) <li> <a href="{{ route('job.category', $category->id) }}" class="tag-link">{{ $category->name }}</a> </li> @endforeach </ul> </div> {{-- /Tags Widget --}} </div> </div> </div>
/** * Resource list * @return Respanse */ public function category($category_id) { $job = $this->model->where('category_id', $category_id)->orderBy('created_at', 'desc')->paginate(6); $categories = JobCategories::orderBy('sort_order')->get(); $current_category = JobCategories::where('id', $category_id)->first(); return View::make('job.category')->with(compact('job', 'categories', 'category_id', 'current_category')); }