/** * Creates a new Lead model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Lead(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }
public function actionCreate() { $lead = new Lead(); if ($lead->load(Yii::$app->request->post()) && $lead->save()) { Yii::$app->getSession()->setFlash("success", 'The record was saved.'); return $this->redirect(["lead/"]); } return $this->render("create", ["models" => ["lead" => $lead]]); }
public function store(Request $request) { $lead = new Lead(); $lead->lead_name = $request->input('lead_name'); $lead->lead_company = $request->input('lead_company'); $lead->lead_email = $request->input('lead_email'); $lead->lead_phone = $request->input('lead_phone'); $lead->lead_address = $request->input('lead_address'); $lead->lead_city = $request->input('lead_city'); $lead->lead_state = $request->input('lead_state'); $lead->lead_zip = $request->input('lead_zip'); $lead->lead_type = $request->input('lead_type'); $lead->lead_focus = $request->input('lead_focus'); $lead->lead_involvement = $request->input('lead_involvement'); $lead->lead_boss = $request->input('lead_boss'); $lead->save(); return redirect('leads'); }
public function store(Request $request) { $project = new Project(); $project->project_name = $request->input('project_name'); $project->project_type = $request->input('project_type'); $project->project_description = $request->input('project_description'); $project->project_budget = $request->input('project_budget'); $project->project_timeline = $request->input('project_timeline'); $project->project_size = $request->input('project_size'); $project->project_framework = $request->input('project_framework'); $project->project_theme = $request->input('project_theme'); $project->project_cms = $request->input('project_cms'); $lead = new Lead(); $lead->lead_name = $request->input('lead_name'); $lead->lead_company = $request->input('lead_company'); $lead->lead_email = $request->input('lead_email'); $lead->lead_phone = $request->input('lead_phone'); $lead->lead_address = $request->input('lead_address'); $lead->lead_city = $request->input('lead_city'); $lead->lead_state = $request->input('lead_state'); $lead->lead_zip = $request->input('lead_zip'); $lead->lead_type = $request->input('lead_type'); $lead->lead_focus = $request->input('lead_focus'); $lead->lead_involvement = $request->input('lead_involvement'); $lead->lead_boss = $request->input('lead_boss'); $lead->save(); // link the new project and lead together in the database $project->user_id = Auth::user()->id; $project->lead_id = $lead->id; $project->save(); return redirect('projects'); }