public function convert(Request $request, $id) { $this->validate($request, ['opportunity_name' => 'required', 'account_name' => 'required', 'contact_name' => 'required']); $lead = Lead::find($id); $account = Account::create(["name" => $request->account_name, "cvr" => $request->account_cvr, "phone" => $request->account_phone, "email" => $request->account_email, "website" => $request->account_website, "street_name" => $request->account_street_name, "street_number" => $request->account_street_number, "zip" => $request->account_zip, "city" => $request->account_city, "country" => $request->account_country, "user_id" => $lead->user_id]); Contact::create(["name" => $request->contact_name, "title" => $request->contact_title, "phone" => $request->contact_phone, "email" => $request->contact_email, "street_name" => $request->contact_street_name, "street_number" => $request->contact_street_number, "zip" => $request->contact_zip, "city" => $request->contact_city, "country" => $request->contact_country, "user_id" => $lead->user_id, "account_id" => $account->id]); $opportunity = Opportunity::create(["name" => $request->opportunity_name, "amount" => $request->opportunity_amount, "user_id" => $lead->user_id, "account_id" => $account->id]); $lead->delete(); return redirect()->route('app.opportunity.show', $opportunity->id); }
public function edit($id) { return view('app.call.edit', ['call' => Call::find($id), 'leads' => Lead::orderBy('name', 'ASC')->get(), 'accounts' => Account::orderBy('name', 'ASC')->get(), 'contacts' => Contact::orderBy('name', 'ASC')->get(), 'users' => User::orderBy('name', 'ASC')->get()]); }
public function edit($id) { return view('app.ticket.edit', ['ticket' => Ticket::withTrashed()->find($id), 'users' => User::orderBy('name', 'ASC')->get(), 'accounts' => Account::orderBy('name', 'ASC')->get(), 'contacts' => Contact::orderBy('name', 'ASC')->get()]); }
public function activities($id) { return view('app.contact.activities', ['contact' => Contact::withTrashed()->find($id)]); }