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

Solution 1:

You should return one array :

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

There is other ways such us :

return view('dashboard', array('doc'=>$doc,'user'=>$user,'type'=>$type));

return view('dashboard', compact('doc','user','type'));

return view('dashboard')
            ->with('doc', $doc)
            ->with('user', $user)
            ->with('type', $type);

return view('dashboard')            //using laravel Magic method.
            ->withDoc($doc)
            ->withUser($user)
            ->withType($type);