Laravel PHP: Do not display 'blank' checkbox data in view


I have a form that contains checkboxes. After the form is submitted, the user is taken back to the view 'index.blade.php'. In 'index.blade.php', I do not want 'blank' checkbox data to be displayed, only checkbox data that the user selected. I am displaying the checkbox data as 'li' elements.


@foreach($allStones as $stone)
                         <td>{{ $stone->stone_id }}</b></td>
                         <td>{{ $stone->stone_name }}</td>
                         <td>{{ $stone->stone_type }}</td>
                            /* Checkbox data */ 
                            /* Only display checkbox data that is checked */
                            <li>{{ $stone->stone_color_black}}</li>
                            <li>{{ $stone->stone_color_blue }}</li> 
                            <li>{{ $stone->stone_color_brown }}</li>
                            <li>{{ $stone->stone_color_gold }}</li>
                            <li>{{ $stone->stone_color_gray }}</li>
                            <li>{{ $stone->stone_color_green }}</li> 
                            <li>{{ $stone->stone_color_red }}</li> 
                            <li>{{ $stone->stone_color_white }}</li>
                         <td>{{ $stone->stone_origin }}</td>
                         <td>{{ $stone->stone_pattern }}</td>
                            /* Checkbox data */ 
                            /* Only display checkbox data that is checked. */
                            <li>{{ $stone->stone_application_kitchen}}</li>
                            <li>{{ $stone->stone_application_bathroom }}</li> 
                            <li>{{ $stone->stone_application_fireplace }}</li>
                            <li>{{ $stone->stone_application_floor }}</li>
                            <li>{{ $stone->stone_application_outdoor }}</li>
                         <td><b>{{ link_to_route('show_stone', 'Edit', array($stone->stone_id)) }}</b></td>


public function index()
    $allStones = Stone::paginate(10);
    $this->layout->content = \View::make('home.index', array('allStones' => $allStones));

Is there a simple way of accomplishing this task instead of having 'blank' checkbox data displayed?

People are also looking for solutions to the problem: php sql pdo return results grouped by a field?


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.