/** * Show the form for creating a new resource. * * @return Response */ public function add_coa() { $mytime = Carbon::now(); $date = $mytime->toDateTimeString(); $coa_code = COA::where('coa_code', '=', Input::get('coa_code'))->first(); if ($coa_code === null) { // Insert in COA table $arrayInsert = array('coa_account' => Input::get('coa_account'), "coa_code" => Input::get('coa_code'), "coa_credit" => Input::get('coa_credit'), "coa_debit" => Input::get('coa_debit')); $last_sale_id = COA::insertGetId($arrayInsert); // Redrect to sale page return Redirect::to('admin/accounts/index_coa'); } else { return Redirect::to('admin/accounts/index_coa')->withErrors('message', 'Register Failed'); } //die; }