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="{{$types->id}}">{{$types->type}}</option>
@endforeach
You should return one array :
There is other ways such us :