<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Institution;
use App\Workexperience;
use App\Score;
use App\User;
use App\Proposal;
use App\AcademicLevel;
use App\StudentProposalUpload;
use Auth;
class HomeController extends Controller
{
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('auth');
    }

    /**
     * Show the application dashboard.
     *
     * @return \Illuminate\Contracts\Support\Renderable
     */
    public function index()
    {
        $institution= Institution::where('student_id',Auth::user()->id)->get();
        $work_experience= Workexperience::where('student_id',Auth::user()->id)->get();
        $score= Score::where('student_id',Auth::user()->id)->get(); 
        $proposal= Proposal::where('student_id',Auth::user()->id)->get();
        $user_info= User::find(Auth::user()->id);
        $academic_level= AcademicLevel::all();
        $proposal_files= StudentProposalUpload::where('student_id',Auth::user()->id)->get();
        return view('profile',compact('institution','academic_level','work_experience','score','user_info','proposal','proposal_files'));
    }
}
