Show in view only object with specified id - php

i am woking on a project about a restaurant and i need to show on my staff view only the Chef and Su-Chef which has id (Chef-2, Su-Chef 4).
I need to show on my view all the Chefs and all the Su-Chefs.
The view is organised at the form that is the number is odd (i have the image on left and text on right), if the number is even i have (i have the image on right and text on left)
Here is my Controller
public function index()
{
$staff = Staff::where('visible','yes')->where('delete','no')->orderBy('name','DESC')->get();
return view('staff.staff', ['staff' => $staff]);
}
And this is my View
<section class="bg-deep-yellow">
<div class="container">
<div class="row">
<!-- section title -->
<div class="col-md-12 text-center">
<span class="title-small black-text text-uppercase letter-spacing-3 font-weight-600">I NOSTRI CHEF</span>
<div class="separator-line-thick bg-black no-margin-bottom margin-one xs-margin-top-five"></div>
</div>
<!-- end section title -->
</div>
<div class="row margin-ten no-margin-bottom">
<!-- chef -->
<div class="col-md-12 sm-margin-bottom-ten">
<div class="col-md-5 chef-img cover-background" style="background-image:url({{URL::asset('external_assets/assets/images/images_downloaded/chef.jpg') }});">
<div class="img-border"></div>
</div>
<div class="col-md-7 chef-text bg-white text-center">
<img src="{{URL::asset('external_assets/assets/images/images_downloaded/kapele.png') }}" alt=""/><br>
<span class="text-large black-text text-uppercase letter-spacing-3 font-weight-600 margin-ten display-block no-margin-bottom">Patrick Smith</span>
<span class="text-small text-uppercase letter-spacing-3">Chef, Co-Founder</span>
<p class="text-med margin-ten width-90 center-col" style="text-align: justify">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s</p>
</div>
</div>
<!-- end chef -->
<!-- chef -->
<div class="col-md-12">
<div class="col-md-7 chef-text bg-white text-center">
<img src="{{URL::asset('external_assets/assets/images/images_downloaded/bari.png') }}" alt=""/><br>
<span class="text-large black-text text-uppercase letter-spacing-3 font-weight-600 margin-ten display-block no-margin-bottom">Sancho Pansa</span>
<span class="text-small text-uppercase letter-spacing-3">Bartender</span>
<p class="text-med margin-ten width-90 center-col" style="text-align: justify" >Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
</div>
<div class="col-md-5 chef-img cover-background" style="background-image:url({{URL::asset('external_assets/assets/images/images_downloaded/chef2.jpg') }});">
<div class="img-border"></div>
</div>
</div>
<!-- end chef -->
</div>
</div>
</section>
This is an image of my view

Related

How to create 3 columns for cards using bootstrap row class

I'm trying to display the content (which are presented in cards) of my page in three different columns using bootstrap 4 row class. How do I go about it?
I'm using Laravel 5.8 and bootstrap 4. Other bootstrap functions like carousel and nav bar are working properly.
The code for the content in the main blade file-views/layout/app.blade.php looks like this;
<div class="container-fluid">
#yield('content')
</div>
Then that for the page I desire the layout-views/pages/secondpage.blade.php is;
#extends('layout.app')
#section('content')
<div class="col-12 text-center">
<h2> Page caption</h2>
</div>
<div class="row">
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 1</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 2</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 3</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
</div>
</div>
#endsection
I expect to see the cards arranged in three different columns, but they are all in a single column.
You have an extra div close tag, for all three
thats why you get all in one column
<div class="row">
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 1</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
<!--</div>-->
</div>
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 2</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
<!--</div>-->
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 3</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
<!--</div>-->
</div>
This is causing due to extra div after each col-md-4 div. I have made some correction in HTML.
<div class="row">
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 1</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 2</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
<div class="col-sm-6 col-md-4">
<div class="card border-white">
<div class="card-header">Heading 3</div>
<div class="card-body">
<p class="card-text">Some quick example text to build
on the card
title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
</div>

Popover modal (quick view) for selected item in array list - Twig, Symfony

Please i have array list of product that displays in twig. I will like to display a popover modal view(quick view) for each product. for example when i click on quick view for item 1, i want the information for item 1 to display on the modal popover view. Thanks
{% extends "::base.html.twig" %}
{% block body %}
<header class="page-heading">
<div class="container">
<h2>Collection</h2>
</div>
</header>
<section class="new-arrivals">
<div class="container text-center">
<div class="items">
<div class="row">
{% for entry in product %}
<div class="col-sm-4 item">
<div class="item-image">
<img src="{{ asset('product/'~ entry.imageName ) }}" alt="shirt">
<div class="hover-overlay">
<ul class="list-unstyled list-inline">
<li><a class="expand" data-toggle="modal" data-target="#product_view"><i class="icon-expand"></i></a></li>
</ul>
</div>
</div>
<div class="item-info">
<h5>{{ entry.name }}</h5>
<ul class="price list-unstyled list-inline">
<li class="current">{{ entry.price }}</li>
</ul>
</div>
</div>
<div class="modal fade" id="product_view">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<span class="glyphicon glyphicon-remove"></span>
<h3 class="modal-title">{{ entry.name }}</h3>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-6 product_img">
<img src="{{ asset('product/'~ entry.imageName ) }}" class="img-responsive">
</div>
<div class="col-md-6 product_content">
<h4>Product Id: <span>51526</span></h4>
<div class="rating">
<span class="glyphicon glyphicon-star"></span>
<span class="glyphicon glyphicon-star"></span>
<span class="glyphicon glyphicon-star"></span>
<span class="glyphicon glyphicon-star"></span>
<span class="glyphicon glyphicon-star"></span>
(10 reviews)
</div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<h3 class="cost"><span class="glyphicon glyphicon-usd"></span> 75.00 <small class="pre-cost"><span class="glyphicon glyphicon-usd"></span> 60.00</small></h3>
<div class="row">
<div class="col-md-4 col-sm-6 col-xs-12">
<select class="form-control" name="select">
<option value="" selected="">Color</option>
<option value="black">Black</option>
<option value="white">White</option>
<option value="gold">Gold</option>
<option value="rose gold">Rose Gold</option>
</select>
</div>
<!-- end col -->
<div class="col-md-4 col-sm-6 col-xs-12">
<select class="form-control" name="select">
<option value="">Capacity</option>
<option value="">16GB</option>
<option value="">32GB</option>
<option value="">64GB</option>
<option value="">128GB</option>
</select>
</div>
<!-- end col -->
<div class="col-md-4 col-sm-12">
<select class="form-control" name="select">
<option value="" selected="">QTY</option>
<option value="">1</option>
<option value="">2</option>
<option value="">3</option>
</select>
</div>
<!-- end col -->
</div>
<div class="space-ten"></div>
<div class="btn-ground">
<button type="button" class="btn btn-primary"><span class="glyphicon glyphicon-shopping-cart"></span> Add To Cart</button>
<button type="button" class="btn btn-primary"><span class="glyphicon glyphicon-heart"></span> Add To Wishlist</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
</section>
{% endblock %}
the div class "div class="modal fade" id="product_view""is the one that serves the popover.
All you modal divs have the same id attribute, and you data-target references it, so I guess only the first popup would open.
Just add a key to that id and data-target attributes
id="product_view_{{loop.index}}"

laravel foreach broke column

Sorry for title i couldn't think better title!
anyway, this is my blog page code:
#extends('layouts.frontend_index')
#section('title', 'Blog')
#section('content')
<div class="container">
<div class="row" style="margin-bottom:30px;">
<div class="col-md-8">
<div class="row">
#forelse($posts as $post)
<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12" style="margin-bottom:15px;">
<div class="card card2">
<div class="cardimg">
<img src="{{ url('images/') }}/{{ $post->image }}" class="card-img-top" style="width:100%; height:auto; max-height:500px;" alt="{{ $post->title }}">
</div>
<div class="card-block">
<h4 class="card-title">{{$post->title}}</h4>
<p class="card-text">{!! str_limit($post->body, 10) !!}</p>
<p><a class="btn btn-block btn-link" href="{{ route('frontshow', $post->slug ) }}">Read More <i class="fa fa-arrow-right"></i></a></p>
</div>
</div>
</div>
#empty
<p>No Post Available yet!</p>
<div class="text-center">
<a class="btn btn-error" href="{{url('/')}}">Back to Main Page</a>
</div>
#endforelse
<div class="col-md-12 text-center">
{{$posts->links()}}
</div>
</div><!--end row-->
</div><!--end col-md-8-->
<div class="col-md-4">
<h3>Get Latest Updates...</h3>
<a target="_blank" href="https://t.me/studiotjd"><div id="telegram"></div></a>
<a target="_blank" href="https://www.facebook.com/studiotjd"><div id="facebook"></div></a>
<a target="_blank" href="https://www.instagram.com/studiotjd/"><div id="instagram"></div></a>
</div><!--end col-md-4-->
</div><!--end row-->
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-md-4 span3 wow rollIn" style="animation-delay: 1s;"><div id="Library"></div></div><!--end col-md-4-->
<div class="col-md-4 span3 wow bounceInDown center" style="animation-delay: 1s;"><div id="Library2"></div></div><!--end col-md-4-->
<div class="col-md-4 span3 wow bounceInRight" style="animation-delay: 1s;"><div id="Library3"></div></div><!--end col-md-4-->
</div><!--end row-->
</div><!--end col-md-12-->
</div><!--end row-->
</div>
#endsection
here is how it looks like in view:
I tried almost everything to fix this issue but nothing works!
As you can see in my inspect all col-md-4 goes under first col-md-4 and i don't know why
Is there anyone knows how to fix this issue?
try this
{{ strip_tags(str_limit($post->body, 10)) }}
I think you have html element stored in your database, and you are just using str_limit so the tags in your body is not closed.
problem is a height of div, check it on the inspector code. 1 px or more is

HTML/JQuery show/hide panel on hover

I am fairly new to HTML with some PHP thrown in for MSSQL queries, but I would like to add some additional functionality to a page I am building that may need some jquery.
My question: How can I have the Primary Panel, shown in screen shot below, show/appear when I hover over 'View Details' of the 'Jobs Today' panel and hide when the cursor moves from 'View Details'? At the moment its always visible. I have included some code snippets to show how each section is built.
Build Jobs panel:
<div class="row">
<div class="col-lg-3 col-md-6">
<div class="panel panel-primary">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-tasks fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<div class="huge"><?php echo $jobCount ?></div>
<div>Jobs Today</div>
</div>
</div>
</div>
<div class="panel-footer">
<span class="pull-left">View Details</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</div>
</div>
Build Primary Panel (yet to be populated with job info)
<div class="col-lg-4">
<div class="panel panel-primary">
<div class="panel-heading">
Primary Panel
</div>
<div class="panel-body">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum tincidunt est vitae ultrices accumsan. Aliquam ornare lacus adipiscing, posuere lectus et, fringilla augue.</p>
</div>
<div class="panel-footer">
Panel Footer
</div>
</div>
</div>
As always, thanks in advance. Hopefully I haven't missed anything :)
EDIT: I now have the hide working. The details panel is shown when the page first loads, I hover over the 'View Details' and when I leave the panel disappears. What am I missing. Here is the code as is now:
<div class="row">
<div class="col-lg-3 col-md-6">
<div class="panel panel-primary">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-tasks fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<div class="huge">
<?php echo $jobCount ?>
</div>
<div>Jobs Today</div>
</div>
</div>
</div>
<div id="jobs-wrapper">
<a href="#">
<div class="panel-footer" data-panel="job-details">
<span class="pull-left">View Details</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i> </span>
<div class="clearfix"></div>
</div>
</a>
</div>
</div>
</div>
<!-- /.row -->
<div class="col-lg-4">
<div class="panel-primary-jobs" id="job-details">
<div class="panel-heading">
Jobs Today
</div>
<div class="panel-body">
<p>This is where Job info will go</p>
</div>
<div class="panel-footer">
Close
</div>
</div>
</div>
</div>
and the jquery
$('#jobs-wrapper a').mouseenter(function(e) {
if ($(this).data('panel'))
{
$('.panel-primary-jobs').hide();
$('#' + $(this).data('panel')).show();
}
});
$('#jobs-wrapper').mouseleave(function()
{
$('.panel-primary-jobs').hide();
}
);
First, add some classes to tell apart the .header from the .details:
<div class="panel panel-primary header">...</div>
<div class="panel panel-primary details hidden">...</div>
And then:
$('.primary-panel .panel-footer')
.hover( () => $('.details').show(), () => $('.details').hide())
The first function is the hover in handler and the second one, the hover out

bootstrap php includes with sidebar

Okay, so this is a first for me. Using php includes.
The problem I'm running into is that the content for the page is being pushed down onto another row when i include the sidebar.php.
This is the code for the side bar. The content means pretty much nothing now, because I'll probably change a couple of things. But the col-md-3 class is the thing that most confusing, because it should in theory work in tandem with the pages col-md class.
<?php include('head.php'); ?>
<!--- Start of accordion ---->
<div class="container">
<div class="panel-group col-md-3 panel_custom_group" id="accordian">
<div class="panel panel-custom">
<div class="panel-heading">
<h4 class="panel-title">
APPAREL <span class="panel_plus">+</span>
</h4>
</div>
<div class="panel-collapse collapse" id="apparel">
<div class="panel-body">
<div class="panel-heading">
<h4 class="panel-title">
ALL PRODUCTS <span class="panel_plus">+</span>
</h4>
</div>
<div class="panel-collapse collapse" id="allproducts">
<div class="panel-body">
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-custom">
<div class="panel-heading">
<h4 class="panel-title">
HEADWEAR<span class="glyphicon glyphicon-plus side_bar_glyph"></span>
</h4>
</div>
<div class="panel-collapse collapse" id="headwear">
<div class="panel-body">
</div>
</div>
</div>
<div class="panel panel-custom">
<div class="panel-heading">
<h4 class="panel-title">
BAGS<span class="glyphicon glyphicon-plus"></span>
</h4>
</div>
<div class="panel-collapse collapse" id="bags">
<div class="panel-body">
</div>
</div>
</div>
<div class="panel panel-custom">
<div class="panel-heading">
<h4 class="panel-title">
GIFTS<span class="glyphicon glyphicon-plus"></span>
</h4>
</div>
<div class="panel-collapse collapse" id="gifts">
<div class="panel-body">
</div>
</div>
</div>
<div class="panel panel-custom">
<div class="panel-heading">
<h4 class="panel-title">
BRANDS<span class="glyphicon glyphicon-plus"></span>
</h4>
</div>
<div class="panel-collapse collapse" id="brands">
<div class="panel-body">
</div>
</div>
</div>
<div class="panel panel-custom">
<div class="panel-heading">
<h4 class="panel-title">
CATEGORIES<span class="glyphicon glyphicon-plus"></span>
</h4>
</div>
<div class="panel-collapse collapse" id="categories">
<div class="panel-body">
</div>
</div>
</div>
<div class="panel panel-custom">
<div class="panel-heading">
<h4 class="panel-title">
SPECIALS<span class="glyphicon glyphicon-plus"></span>
</h4>
</div>
<div class="panel-collapse collapse" id="specials">
<div class="panel-body">
</div>
</div>
</div>
</div>
</div>
<!--- end of accordian ---->
And this is the page i inserted it into.
<?php include('head.php'); ?>
<div class="breadcrumb">
<p>Home > Registration</p>
</div>
<section class="container registr_middle col-md-6">
<img class="img-responsive" src="images/become_a_partner_banner.jpg" title="Become a Partner" alt="Become a Partner" />
</section>
<section class="registr_side col-md-3">
<div>
<h3>Partner Registration</h3>
<p>Becoming an Altitude partner can be a life changing event. As Altitude Leisurewear is a sincerely TRADE ONLY SUPPLIER the criteria to become an Altitude agent.<br />
In order to register as an approved distributor of the Altitude Leisure Wear brand, you will be required to complete the following documentation.<br />
Once completed, the following information must be signed and faxed to: <strong>086 580 0596</strong>.<br /></p>
<p class="background_para">Any incomplete application forms will be disregarded</p>
<ul>
<li>A signed copy of our client profile document</li>
<li>A signed copy of our standard terms and conditions</li>
<li>A copy of company Registration(CK Form)</li>
<li>A company profile verifying that our primary business is the resale of corporate and promotional products.</li>
<li>A copy of your business card</li>
<li>A copy of your ID document</li>
<li>An invoice os order to a client or from a supplier showing that you re-sell sorporate wear</li>
</ul>
<p>Please complete the application form below to register with Altitude Leisure Wear. A Customer Care representative will forward you the documentation that needs to be completed in order to do the verification of your status.</p>
</div>
</section>
So shouldn't the side bar's width work with the main content of the pages width. They both add up to 12 (for the grid system).
I think you shoudn't use .container and .col-md-6 on the same element.
It should look like this:
<div class="container-fluid">
<div class="row">
<div class="col-md-6">First half</div>
<div class="col-md-6">Second half</div>
</div>
</div>
http://getbootstrap.com/css/#grid
I let it work by putting a 'div' with the class of 'col-md-3' around the include line and then wrapped all the contents in a container div. I then removed the 'col-md-3' in the sidebar.php file.
<div class="col-md-3">
<?php include('sidebar.php'); ?>
</div>

Categories