I have a view where I want to display some content according to the adminRole column in the admin table.
My controller
public function adminNotificationList(){
$admin= Admin::all();
return view('Notification.notification_admin', compact('admin'));
}
My view
@foreach ($admin as $role)
{{$role->adminRole}}
@endforeach
When I do this, I get the correct roll listed for all the admins. However what I want to do is display a table if the role is 1 else display another table something like
@foreach ($admin as $role)
@if ($role->adminRole == 1)
show something
@elseif ($role->adminRole == 2)
show something
@endelseif
@endif
@endforeach
But I am not being able to do it as i think it is not the correct way to do it.