/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit(Lead $lead) { // Edit an exisiting lead $stages = Stage::lists('name', 'id'); $sources = Source::lists('name', 'id'); $genders = Gender::lists('name', 'id'); $titles = Title::lists('name', 'id'); $users = User::lists('name', 'id'); return view('leads.edit', compact('lead', 'stages', 'sources', 'users', 'titles', 'genders')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { // $post = Post::findOrFail($id); //Populate the select(dropdowns) //$department_options = Department::lists('name', 'id'); //$department_id = $post->department_id; $department_options = Department::lists('name', 'id'); $department_selected = $post->departments->lists('id'); //$project_options = Project::lists('name', 'id'); //$project_id = $post->project_id; $source_options = Source::lists('name', 'id'); $source_selected = $post->sources->lists('id'); $staff_options = Staff::select('Id', DB::raw('CONCAT(first_name, " ", last_name) AS full_name'))->orderBy('first_name')->lists('full_name', 'Id'); $staff_selected = $post->staffs->lists('id'); // Show the page return view('posts.forms.edit', compact('post', 'department_options', 'department_selected', 'source_options', 'source_selected', 'staff_options', 'staff_selected')); }