I want to hide a <div>
element if the value is_admin === "0"
in table admins.
Here is my Controller Code
JavaScript
x
function dashboard(Request $request){
$data = ['LoggedUserInfo'=>Admin::where('id','=', session('LoggedUser'))->first()];
$count = DB::table('candidates')->count();
$count2 = DB::table('admins')->count();
$data1 = DB::table('admins');
$data1 = $data1->paginate(10);
return view('dashboard', $data,compact('count','count2','data1'));
}
I want to hide this div if is_admin === "0"
JavaScript
<div class="c1" id="l1">
<div class="container">
<div class="card">
<p class="p">No. of Candidates: {{$count}}</p>
</div>
<div class="card">
<p class="p">No. of Sub Admins: {{$count2}}</p>
</div>
</div>
</div>
Advertisement
Answer
JavaScript
@if($is_admin !== '0')
<div class="c1" id="l1">
<div class="container">
<div class="card">
<p class="p">No. of Candidates: {{$count}}</p>
</div>
<div class="card">
<p class="p">No. of Sub Admins: {{$count2}}</p>
</div>
</div>
</div>
@endif