vendredi 28 juillet 2017

Laravel: i can't send more then 2 variables from controller to a view

So i am trying to send some query from the controller to a view but when try use the third variable it says:

Undefined variable: type(View:)

The code i'm using is this in the controller :

    $doc=DB::table('documents')
        ->join('users', 'users.id', '=', 'documents.id_user')
        ->join('type_docs', 'type_docs.id', '=', 'documents.id_tipo_doc')
        ->join('departments', 'departments.id', '=', 'documents.id_departamento')
        ->select('documents.*', 'type_docs.type', 'users.name','departments.abbreviation')
        ->get();
  $user=DB::table('users')
  ->select('users.*')
  ->get();
  $type=DB::table('type_docs')
  ->select('type_docs.*')
  ->get();


        //$doc = Document::all();
  return view('dashboard',['doc'=>$doc],['user'=>$user],['type'=>$type]);

and in the view:

       @foreach($type as $types)
                  <option value=""></option>
       @endforeach



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2w6zNUW
via IFTTT

Aucun commentaire:

Enregistrer un commentaire