public function addBrand(Request $request) { $input = Input::all(); try { if ($this->checkBrandnameExist($input['brand_name'], $input['temp_mrktid']) == '1') { return '2'; } else { $brand = new brand(); $brand->MI1 = $input['temp_mrktid']; $brand->BN2 = $input['brand_name']; $brand->BINR3 = 'STORE'; $brand->save(); return json_encode($brand); } } catch (\Exception $e) { return '0' . $e; } }