Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

pluck only category name and id from model in laravel

<select name="category" class="form-control">
  @foreach($categories as $category)
    <option value="{{ $category->id }}" <?php if($hotel->category_id == $category->id) { echo "selected";}?>>{{ $category->name }}</option>
  @endforeach                 
</select>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pluck #category #id #model #laravel
ADD COMMENT
Topic
Name
7+8 =