Show 1 Cell of data as list in laravel - php

i have database table 'jobs' where there`s description and requirement column.
Each description and column can have several value in the cell separated by an "enter"
how can i show the data in laravel blade as a lists?
This is my blade
<ul class="lst">
<li class="it">
<input class="ipt-hidden" name="tabs-1" type="radio" id="tab1" checked>
<label class="title twomenu" for="tab1">JOB DESCRIPTIONS</label>
<div class="wrp-content">
<ul class="show-item">
<li>{{ $jobs->description }}</li>
</ul>
</div>
</li>
<li class="it">
<input class="ipt-hidden" name="tabs-1" type="radio" id="tab2">
<label class="title twomenu" for="tab2">REQUIREMENTS</label>
<div class="wrp-content">
<ul class="show-item">
<li>{{ $jobs->requirement }}</li>
</ul>
</div>
</li>
</ul>
What i want is the jobs requirements & descriptions can show as several list, can i do that?
because what i get is just 1 list separated by spacing.
Thankyou all :)

Related

How to sort alphabetic index list with foreach loop PHP (Laravel)?

I'm new here and new to Laravel.
For my website, I'm building a page with lists that should be ordered alphabetically. I do get the output already, but it's not ordered correctly.
I've got multiple categories containing lists with links, check the image for the visual idea.
Any idea how to insert some kind of sort function within the code I have?
#foreach($category['theories'] as $letter => $theories)
#if(count($theories) > 0)
<div>
<h3 class="text-xl mb-1">{{$letter}}</h3>
<ul class="mb-4">
#foreach($theories->sortBy('title') as $theory)
<li>
#can(['view-theory'], $theory)
<a href="{{route('theories.show', [$theory->slug])}}" class="no-underline font-bold">
{{$theory->title}}
</a>
#else
<span class="premium-tag cursor-not-allowed flex flex-row items-center">
{{$theory->title}} <i class="fas fa-lock ml-1"></i>
</span>
#endcan
</li>
#endforeach
</ul>
</div>
#endif
#endforeach
I hope somebody is able to help me.
This is what it currently looks like

Lists in validation Laravel

I am doing a validation of a form in Laravel.
In this form I have two inputs (one text and one checkbox).
But I have two lists, in which I can move the elements from one list to another and order them.
But I don't know how to send these lists through the form to the Laravel validation.
Thanks in advance
My form:
<form id="create-menu-opac" action="{{ route('post_create_menu_opac')}}" method="post" role="form" autocomplete="off">
{{ csrf_field() }}
...
<section>
<div class="row">
<div class="col-sm-6">
<h6>{{ trans('menu-opac.buttons_avaiable') }}</h6>
<ul id="buttons_no_selected" class="list-group list-group-sortable-connected connected">
#foreach ($buttons as $button)
<li id="{{$button->id}}" class="list-group-item list-group-item-info">{{$button->description}}</li>
#endforeach
</ul>
</div>
<div class="col-sm-6">
<h6>{{ trans('menu-opac.items_menu') }}</h6>
<ul id="buttons_selected" class="list-group list-group-sortable-connected connected">
</ul>
</div>
</div>
</section>
...
</form>
This two lists work with a library Jquery and Boostrap
My controller
foreach ($request as $_request) {
Log::Debug(print_r($_request,true));
}
In this Log I can see the two inputs (type text and type checkbox), but i can't see the list.
Try adding input hidden in your blade file then see if you get the data in your $request
#foreach ($buttons as $button)
<li id="{{$button->id}}" class="list-group-item list-group-item-info">{{$button->description}}</li>
<input type="hidden" id="{{$button->id}}" value="{{$button->description}}" name="{{$button->description}}">
#endforeach

Display specifics columns of each rows in html

I have been working on a job-listing website during the last few weeks as a self taught CS student. I finished the front end of the website in July and now I am learning mySQL and PHP to produce the back-end.
So, on the current "job listing" page search.html, there is currently 4 listing in the page but I typed those directly on the html when I was making the front-end just to see how it will look like.
I have build my database like this and added few examples:
I also made a back-end page to let the user add a a new listing and it is working.
I am not sure it was a good idea to start with the front-end. I am now trying to display three columns (title, location, type) of eachrowbased on my specific front-end layout. I won't display thedate` yet since I have not created it on mySQL.
search.html
<div class="job-listing">
<div class="container">
<div class="job-number">
<h2>We Found <span id="number-jobs-total" class="text-secondary"></span> Offers For <span>You</span> </h2>
</div>
<ul class="job-board">
<li class="job job-1">
<div class="job-title">
<h2>Process Engineer</h2>
</div>
<div class="job-location">
<p>Location: Naypyitaw</p>
</div>
<div class="job-type">
<p>Type: Full-Time</p>
</div>
<div class="job-date">
<p>Published on 07/19/2019</p>
</div>
<div class="job-industry">
<p>Engineering</p>
</div>
<ul class="job-keywords">
<li>Engineering</li>
<li>Science</li>
</ul>
</li>
<li class="job job-2">
<div class="job-title">
<h2>Chief Financial Officier</h2>
</div>
<div class="job-location">
<p>Location: Naypyitaw</p>
</div>
<div class="job-type">
<p>Type: Full-Time</p>
</div>
<div class="job-date">
<p>Published on 07/18/2019</p>
</div>
</li>
<li class="job job-3">
<div class="job-title">
<h2>Assistant CEO</h2>
</div>
<div class="job-location">
<p>Location: Naypyitaw</p>
</div>
<div class="job-type">
<p>Type: Part-Time</p>
</div>
<div class="job-date">
<p>Published on 07/18/2019</p>
</div>
</li>
<li class="job job-4">
<div class="job-title">
<h2>Front-End Developer</h2>
</div>
<div class="job-location">
<p>Location: Naypyitaw</p>
</div>
<div class="job-type">
<p>Type: Part-Time</p>
</div>
<div class="job-date">
<p>Published on 07/18/2019</p>
</div>
</li>
</ul>
<nav class="pagination-container">
<ul class="pagination">
<li>Previous</li>
<li>Next</li>
</ul>
</nav>
</div>
</div>
Things I will do later:
I need to protect my PHP code against injections
The pagination button is not working

PHP or Blade - Organized Columns depending on the number of data

I'm blocked for organize my sub-menu of my menu. As you can see,
it is decomposed into several blocks (i've use paint for delimited the block in black).
currently my code is:
<li class="dropdown yamm-fw">
{{ $category->nom }} <b class="caret"></b>
<ul class="dropdown-menu">
<li>
<div class="yamm-content">
<div class="row">
<div class="col-sm-3">
<h5>test</h5>
<ul>
<?php $count=0 ?>
#foreach ($types->whereIn('id', $category->produit->unique('type_id')->pluck('type_id')) as $type)
#if ($count <= 6)
<li>{{$type->nom}}</li>
<?php $count++ ?>
#endif
#endforeach
</ul>
</div>
<div class="col-sm-3">
<h5>teste 2</h5>
<ul>
<li>Trainers</li>
<li>Sandals</li>
<li>Hiking shoes</li>
<li>Casual</li>
</ul>
</div>
I do not know how to do that after 7 items in the actual div col-sm-3, create another div to continue the foreach and so on.
You can use the $loop variable:
#if ($loop->iteration === 7)
// Create another div here
#endif

How to create dynamic LI and DIV for template

I want to know what language can make my template being dynamic. Example HTML sturtcure
<div id="tabs">
<ul class="tabs">
<li>Header</li>
<li>Navigation</li>
<li>Layout & Colors</li>
<li>Optimization</li>
<li>Miscellaneous</li>
</ul>
<form method="post" action="options.php">
<div class="tab-container">
<div id="tabs-1" class="tab-content">Header</div>
<div id="tabs-2" class="tab-content">Navigation</div>
<div id="tabs-3" class="tab-content">Layout & Colors</div>
<div id="tabs-4" class="tab-content">Optimization</div>
<div id="tabs-5" class="tab-content">Miscellaneous</div>
</div>
</form>
</div>
I want the LI and DIV
<li>Header</li>
<div id="tabs-1" class="tab-content">Header</div>
Can be dynamic without write it one by one. How to do that?
jQuery Templates works best in this scenario.
Check the doc #:
http://api.jquery.com/jQuery.template/
I'd use Python, more specifically Flask. Here's a maybe-working template. I'm guessing your element's names are stored in a list returned by get_titles:
<div id="tabs">
<ul class="tabs">
{% for index in get_titles|length %}
<li>{{ titles[index] }}</li>
{% endfor %}
</ul>
<form method="post" action="options.php">
<div class="tab-container">
{% for index in titles|length %}
<div id="tabs-{{ index + 1 }}" class="tab-content">{{ titles[index] }}</div>
{% endfor %}
</div>
</form>
</div>
But then again, this might be a bit overkill.

Categories