/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Suppliers();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Suppliers'])) {
         $model->attributes = $_POST['Suppliers'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Suppliers();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Suppliers'])) {
         $model->attributes = $_POST['Suppliers'];
         if ($model->save()) {
             $this->redirect($this->createAbsoluteUrl('index'), array('supplierName' => $model->supplierName, 'sts' => 'created'));
         }
     }
     $this->render('create', array('model' => $model));
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make(Input::all(), Suppliers::$rules);
     if ($validator->passes()) {
         $supplier = new Suppliers();
         $supplier->name = Input::get('name');
         $supplier->address = Input::get('address');
         $supplier->contact = Input::get('contact');
         $supplier->save();
         return Redirect::route('suppliers.index')->with('success', 'Supplier created successfully');
     } else {
         return Redirect::route('suppliers.create')->withErrors($validator)->withInput(Input::all());
     }
 }
 /**
  * Store a newly created supplier in database.
  *
  * @return Response
  */
 public function store()
 {
     $rules = array('name' => 'required', 'phone' => 'required', 'email' => 'required', 'city' => 'required', 'address' => 'required', 'postalCode' => 'required', 'province' => 'required', 'country' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         $messages = $validator->messages();
         return Redirect::to('suppliers/create')->withErrors($validator)->withInput(Input::all());
     } else {
         $supplier = new Suppliers();
         $supplier->name = Input::get('name');
         $supplier->phone = Input::get('phone');
         $supplier->email = Input::get('email');
         $supplier->address = Input::get('address');
         $supplier->city = Input::get('city');
         $supplier->province = Input::get('province');
         $supplier->postalCode = Input::get('postalCode');
         $supplier->country = Input::get('country');
         $supplier->save();
         return Redirect::to('suppliers');
     }
 }