/** * Show the form for creating a new resource. * * @return Response */ public function create() { if (!Auth::guest()) { $user = User::where('priviledge', '!=', 'superuser')->get(); $user_designation = Designation::where('id', '=', Auth::user()->id)->pluck('designation'); $user_votes = Vote::where('user_id', '=', Auth::user()->id)->get(); $count = count($user_votes); $i = 0; foreach ($user_votes as $user_vote) { $user_name[$i] = user::where('id', '=', $user_vote->login_id)->pluck('user_name'); $i++; } //var_dump($user_name);die; $weights = Vote::where('user_id', '=', Auth::id())->sum('performance'); $sum = $weights; $name = priviledge::where('user_id', '=', Auth::user()->id)->pluck('name_show'); $path = file::where('user_id', '=', Auth::user()->id)->pluck('path'); $authority = Priviledge::all(); return View::make('votes.profile', compact('authority', 'path', 'user_designation', 'user_votes', 'sum', 'user', 'name', 'user_name')); } else { return Redirect::intended('login'); } }