/** * Store a newly created position in storage. * * @return Response */ public function store() { $validator = Validator::make($data = Input::all(), Position::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $position = Position::create($data); return Redirect::route('admin.positions.index')->with("successMessage", "Berhasil menyimpan {$position->nama} "); }
function testCreate() { $x = 53; $y = 87; $pos = Position::create($x, $y); $this->assertEquals($x, $pos->x); $this->assertEquals($y, $pos->y); $this->assertEquals("({$x}, {$y})", (string) $pos); }