/** * @test */ public function completing_a_form_returns_the_new_conference() { $input = ['title' => 'AwesomeConf 2015', 'description' => 'The best conference in the world!', 'url' => 'http://example.com']; $form = CreateConferenceForm::fillOut($input, Factory::create('user')); $conference = $form->complete(); $this->assertInstanceOf(Conference::class, $conference); $this->assertNotNull($conference->id); }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $form = CreateConferenceForm::fillOut(Input::all(), Auth::user()); try { $conference = $form->complete(); } catch (ValidationException $e) { return Redirect::to('conferences/create')->withErrors($e->errors())->withInput(); } Session::flash('message', 'Successfully created new conference.'); return Redirect::to('/conferences/' . $conference->id); }