public function supplierSave() { $validation_rule = array('supplier_name' => array('required', 'max:100'), 'supplier_address' => array('required', 'max:500')); $validation = Validator::make(Input::all(), $validation_rule); if ($validation->fails()) { // If validation failed then returned to the serviseForm with error massege return Redirect::to('/addSupplier')->withErrors($validation); } else { $supplier_name = Input::get('supplier_name'); $supplier_address = Input::get('supplier_address'); // Insert data into database ItemConfiguration::addSupplier($supplier_name, $supplier_address); return Redirect::to('/addSupplier')->with('add_success_massege', 'New Supplier Added successfully.'); } }