mercredi 27 septembre 2017

how to fix Undefined variable: collaborators in Laravel 5.2

in My laravel app. I have form.blade.php file in collaborator folder of view file. collaborators/form.blade.php

<div class="col-md-4" style="border:1px solid #ccc;margin-left:15px;padding:10px;">
        <h4 class="page-header">
            Collaborators
        </h4>
        @if( $collaborators)
           @foreach( $collaborators as $collaborator)
                <div>
                    <div>
                        <span>
                            <img src="" />
                        </span>
                    </div>
                    <button class="btn btn-sm btn-danger delete" style="margin-top:5px;padding:4px;width:35px;"
                      data-action="/projects//collaborators/"
                      data-token="">
                    <i class="fa fa-trash-o"></i>
                    </button>
                </div>
                <hr/>
           @endforeach
        @endif

it include with users.blade.php file in projects folder projects/users.blade.php

@include('collaborators.form')

but I got this error massages

Undefined variable: collaborators (View: C:\Users\Flex\Desktop\mati\resources\views\collaborators\form.blade.php)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire