Replaced lists with pluck

This commit is contained in:
Manish Verma
2018-08-13 14:42:04 +05:30
parent 87426c0d91
commit 3a52d6f24f
16 changed files with 27 additions and 27 deletions

View File

@@ -44,7 +44,7 @@
@foreach($categorys as $category)
<?php
$num = \App\Model\kb\Relationship::where('category_id','=', $category->id)->get();
$article_id = $num->lists('article_id');
$article_id = $num->pluck('article_id');
$numcount = count($article_id);
?>
<li><a href="{{url('category-list/'.$category->slug)}}"><span class="badge pull-right">{{$numcount}}</span>{{$category->name}}</a></li>

View File

@@ -79,7 +79,7 @@ class = "active"
@foreach($categorys as $category)
<?php
$num = \App\Model\kb\Relationship::where('category_id', '=', $category->id)->get();
$article_id = $num->lists('article_id');
$article_id = $num->pluck('article_id');
$numcount = count($article_id);
?>
<li><a href="{{url('category-list/'.$category->slug)}}"><span class="badge pull-right">{{$numcount}}</span>{{$category->name}}</a></li>

View File

@@ -23,7 +23,7 @@ class = "active"
<?php
$all = App\Model\kb\Relationship::where('category_id', $category->id)->get();
/* from whole attribute pick the article_id */
$article_id = $all->lists('article_id');
$article_id = $all->pluck('article_id');
?>
<section class="articles-list">
<h3><i class="fa fa-folder-open-o fa-fw text-muted"></i> <a href="{{url('category-list/'.$category->slug)}}">{{$category->name}}</a> <span>({{count($all)}})</span></h3>

View File

@@ -37,7 +37,7 @@ class = "active"
/* from whole attribute pick the article_id */
$page = App\Model\kb\Relationship::where('category_id', '=', $category->id)->paginate('3');
/* from whole attribute pick the article_id */
$article_id = $page->lists('article_id');
$article_id = $page->pluck('article_id');
$count = count($article_id);
?>
<div class="col-md-6">
@@ -109,7 +109,7 @@ class = "active"
@foreach($categorys as $category)
<?php
$num = \App\Model\kb\Relationship::where('category_id', '=', $category->id)->get();
$article_id = $num->lists('article_id');
$article_id = $num->pluck('article_id');
$numcount = count($article_id);
?>
<li><a href="{{url('category-list/'.$category->slug)}}"><span class="badge pull-right">{{$numcount}}</span>{{$category->name}}</a></li>

View File

@@ -53,7 +53,7 @@
@foreach($categorys as $category)
<?php
$num = \App\Model\kb\Relationship::where('category_id','=', $category->id)->get();
$article_id = $num->lists('article_id');
$article_id = $num->pluck('article_id');
$numcount = count($article_id);
?>
<li><a href="{{url('category-list/'.$category->slug)}}"><span class="badge pull-right">{{$numcount}}</span>{{$category->name}}</a></li>

View File

@@ -6,7 +6,7 @@
$all = App\Model\kb\Relationship::where('article_id','=', $arti->id)->get();
//dd($all);
/* from whole attribute pick the article_id */
$category_id = $all->lists('category_id')->toArray();
$category_id = $all->pluck('category_id')->toArray();
?>
<div class="site-hero clearfix">
@@ -145,7 +145,7 @@ $category_id = $all->lists('category_id')->toArray();
@foreach($categorys as $category)
<?php
$num = \App\Model\kb\Relationship::where('category_id','=', $category->id)->get();
$article_id = $num->lists('article_id');
$article_id = $num->pluck('article_id');
$numcount = count($article_id);
?>
<li><a href="{{url('category-list/'.$category->slug)}}"><span class="badge pull-right">{{$numcount}}</span>{{$category->name}}</a></li>