Commit 5f856a0b6c4b1cccd26d8ad16044378072bab7a0

Authored by Hayk Nazaryan
1 parent 12f7faf68d
Exists in master

fix show count ads on company page

Showing 2 changed files with 6 additions and 5 deletions Side-by-side Diff

app/Http/Controllers/CompanyController.php
... ... @@ -63,10 +63,11 @@ class CompanyController extends Controller
63 63 ->where('employer_id', '=', $company[0]->id)
64 64 ->where('is_remove', '=', '0')
65 65 ->where('active_is', 1)
66   - ->OrderByDesc('id')
67   - ->paginate(50)
68   - ;
  66 + ->OrderByDesc('id');
69 67  
70   - return view('info_company_new', compact('company', 'user_id', 'title', 'ads'));
  68 + $countAds = $ads->count();
  69 + $ads = $ads->paginate(50);
  70 +
  71 + return view('info_company_new', compact('company', 'user_id', 'title', 'ads', 'countAds'));
71 72 }
72 73 }
resources/views/info_company_new.blade.php
... ... @@ -141,7 +141,7 @@
141 141 <svg>
142 142 <use xlink:href="{{ asset('images/sprite.svg#grid-1') }}"></use>
143 143 </svg>
144   - {{ $company[0]->ads->count() }} вакансии
  144 + {{ $countAds }} вакансии
145 145 </button>
146 146 </a>
147 147 @guest