mardi 7 mai 2019

Undifined Variable : employess

i want to show image gallery at user page

this my code from ImageUserController

function list(){
    $employees['img_user'] = ImageUser::where('user_id', Auth::user()->id)->get();

    return view('ukm.index', $employees);
}

and this my code from UserContoller

public function list()
{
    $employees = ImageUser::all();
    $ukm    = Ukm::all();

    return view('/ukm/index', compact( 'employees', 'ukm'));
}

this my route

Route::get('/ukm/index', 'ImageUserController@list');

and this my code at ukm/index.blade.php

table class="table table-stripped table-bordered">
        <thead class="thead-dark">
          <tr>
            <th scope="col">ID</th>
            <th scope="col">Name</th>
            <th scope="col">Description</th>
            <th scope="col">Image</th>
            <th scope="col">Edit</th>
            <th scope="col">Delete</th>
          </tr>
        </thead>
        <tbody>
        @foreach ($employees as $employee)
          <tr>
            <th scope="row"></th>
            <td></td>
            <td></td>
            <td><img src="" width="150px;" height="100px;" alt="Image"></td>
            <td><a href="/img_user/editimage/" class="btn btn-success">Edit</a></td>
            <td><a href="/img_user/deleteimage/" class="btn btn-danger">Delete</a></td>
          </tr>
        @endforeach
        </tbody>
      </table>

i'm getting this error : Undefined variable: employees



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire