public function store(Request $request)
 {
     $vendor = new vendor(array('vendor' => $request->get('vendor'), 'street' => $request->get('street'), 'city' => $request->get('city'), 'state' => $request->get('state'), 'zip' => $request->get('zip')));
     $vendor->save();
     Toastr::success('Vendor created.');
     return redirect('/vendors');
 }
<?php

/*
	vendors/delete-process.php

	access: vendors_write

	Deletes a vendor provided that the vendor has not been assigned to any products or invoices.
*/
// includes
require "../include/config.php";
require "../include/amberphplib/main.php";
// custom includes
require "../include/vendors/inc_vendors.php";
if (user_permissions_get('vendors_write')) {
    $obj_vendor = new vendor();
    /*
    	Load POST Data
    */
    $obj_vendor->id = @security_form_input_predefined("int", "id_vendor", 1, "");
    // these exist to make error handling work right
    $data["name_vendor"] = @security_form_input_predefined("any", "name_vendor", 0, "");
    // confirm deletion
    $data["delete_confirm"] = @security_form_input_predefined("any", "delete_confirm", 1, "You must confirm the deletion");
    /*
    	Error Handling
    */
    // make sure the vendor actually exists
    if (!$obj_vendor->verify_id()) {
        log_write("error", "process", "The vendor you have attempted to edit - " . $obj_vendor->id . " - does not exist in this system.");
    }
     $vendor = new vendor();
     $vendor->form_post_value = $POST;
     $vendor->save();
     if ($vendor->fails()) {
         $app->view->setData('error', "1");
         $app->view->setData('msg', $vendor->getError());
         $app->render(new u('msg'));
     } else {
         $app->view->setData('success', "1");
         $app->view->setData('msg', "Successfully Vendor Created");
         $app->render(new u('msg'));
     }
 });
 //Show
 $app->get('/view', function () use($app) {
     $getVendorList = new vendor();
     $cols = $getVendorList->getVendorList();
     $app->view->setData('rows', $cols);
     $app->render(new u('vendor.view'));
 });
 //Show
 $app->post('/show/:id', function ($id) use($app) {
     $app->render(new u('vendor.show'));
 });
 //Edit Data
 $app->get('/edit/:id', function ($id) use($app) {
     $app->view->setData('form_action', BASEURL . "dashboard/vendor/edit");
     $app->render(new u('vendor.create'));
     $app->render(new u('vendor.edit'));
 });
 //Delete
 function delete_vendor($id)
 {
     log_debug("vendors", "Executing delete_vendor_details({$id}, values...)");
     if (user_permissions_get("vendors_write")) {
         $obj_vendor = new vendor();
         /*
         	Load SOAP Data
         */
         $obj_vendor->id = @security_script_input_predefined("int", $id);
         if (!$obj_vendor->id || $obj_vendor->id == "error") {
             throw new SoapFault("Sender", "INVALID_INPUT");
         }
         /*
         	Error Handling
         */
         // verify vendor ID
         if (!$obj_vendor->verify_id()) {
             throw new SoapFault("Sender", "INVALID_ID");
         }
         // check that the vendor can be safely deleted
         if ($obj_vendor->check_delete_lock()) {
             throw new SoapFault("Sender", "LOCKED");
         }
         /*
         	Perform Changes
         */
         if ($obj_vendor->action_delete()) {
             return 1;
         } else {
             throw new SoapFault("Sender", "UNEXPECTED_ACTION_ERROR");
         }
     } else {
         throw new SoapFault("Sender", "ACCESS DENIED");
     }
 }
 /**
  * test inserting a Vendor, editing it, and then updating it
  **/
 public function testUpdateValidVendor()
 {
     // count the number of rows and save it for later
     $numRows = $this->getConnection()->getRowCount("vendor");
     // create a new vendor and insert to into mySQL
     $vendor = new vendor(null, $this->VALID_contactName, $this->VALID_vendorEmail, $this->VALID_vendorName, $this->VALID_vendorPhoneNumber);
     $vendor->insert($this->getPDO());
     // edit the Notification and update it in mySQL
     $vendor->setContactName($this->VALID_contactName2);
     $vendor->update($this->getPDO());
     // grab the data from mySQL and enforce the fields match our expectations
     $pdoVendor = Vendor::getVendorByVendorId($this->getPDO(), $vendor->getVendorId());
     $this->assertSame($numRows + 1, $this->getConnection()->getRowCount("vendor"));
     $this->assertSame($pdoVendor->getContactName(), $this->VALID_contactName2);
     $this->assertSame($pdoVendor->getVendorEmail(), $this->VALID_vendorEmail);
     $this->assertSame($pdoVendor->getVendorName(), $this->VALID_vendorName);
     $this->assertSame($pdoVendor->getVendorPhoneNumber(), $this->VALID_vendorPhoneNumber);
 }
<?php

/*
	vendors/edit-process.php

	access: vendors_write

	Allows existing vendors to be adjusted, or new vendors to be added.
*/
// includes
require "../include/config.php";
require "../include/amberphplib/main.php";
// custom includes
require "../include/vendors/inc_vendors.php";
if (user_permissions_get('vendors_write')) {
    $obj_vendor = new vendor();
    /*
    	Load POST Data
    */
    $obj_vendor->id = @security_form_input_predefined("int", "id_vendor", 0, "");
    $obj_vendor->data["code_vendor"] = @security_form_input_predefined("any", "code_vendor", 0, "");
    $obj_vendor->data["name_vendor"] = @security_form_input_predefined("any", "name_vendor", 1, "You must set a vendor name");
    $obj_vendor->data["date_start"] = @security_form_input_predefined("date", "date_start", 1, "");
    $obj_vendor->data["date_end"] = @security_form_input_predefined("date", "date_end", 0, "");
    $obj_vendor->data["address1_street"] = @security_form_input_predefined("any", "address1_street", 0, "");
    $obj_vendor->data["address1_city"] = @security_form_input_predefined("any", "address1_city", 0, "");
    $obj_vendor->data["address1_state"] = @security_form_input_predefined("any", "address1_state", 0, "");
    $obj_vendor->data["address1_country"] = @security_form_input_predefined("any", "address1_country", 0, "");
    $obj_vendor->data["address1_zipcode"] = @security_form_input_predefined("any", "address1_zipcode", 0, "");
    $obj_vendor->data["address1_same_as_2"] = @security_form_input_predefined("checkbox", "address1_same_as_2", 0, "");
    // If the address 1 is set to be the same as address 2
 /**
  * Store a newly created resource in storage.
  * POST /vendor
  *
  * @return Response
  */
 public function store()
 {
     /* $validator = Validator::make($data = Input::all(), Vendor::$rules);
     
             if ($validator->fails())
             {
                 return Redirect::back()->withErrors($validator)->withInput();
             }*/
     $vendor = new vendor();
     $vendor->name = Input::get('name');
     $vendor->save();
     $vendor->vendor_type = Input::get('vendortype');
     $vendor->save();
     if (Input::has('email')) {
         $vendor->email = Input::get('email');
         $vendor->save();
     } else {
         $vendor->email = 'N/A';
         $vendor->save();
     }
     $vendor->city = Input::get('city');
     $vendor->save();
     $vendor->address = Input::get('address');
     $vendor->save();
     if (Input::has('mobile')) {
         $vendor->mobile = Input::get('mobile');
         $vendor->save();
     } else {
         $vendor->mobile = 'N/A';
         $vendor->save();
     }
     /* if(Input::get('mobile') == ''){
            $vendor->mobile = 'N/A';
        }else {
            $vendor->mobile = Input::get('mobile');
        }
        $vendor->save();*/
     if (Input::has('cnic')) {
         $vendor->cnic = Input::get('cnic');
         $vendor->save();
     } else {
         $vendor->cnic = 'N/A';
         $vendor->save();
     }
     /* if(Input::get('cnic') == ''){
             $vendor->cnic = 'N/A';
         }else {
             $vendor->cnic = Input::get('cnic');
        $vendor->save();
         }*/
     if (Input::get('note') == '') {
         $vendor->note = 'N/A';
     } else {
         $vendor->note = Input::get('note');
     }
     $vendor->save();
     $vendor->vendor_id = "V0" . $vendor->id;
     $vendor->save();
     /*  if(Input::has('email')){
         $data = ['name' => Input::get('name')];
         Mail::queue('emails.vendor_welcome', $data, function($message)
         {
             $message->to(Input::get('email'), Input::get('name'))->subject('Welcome to EMR!');
         });*/
     return Redirect::route('vendor.index');
 }
 function update_vendor()
 {
     $vendor = new vendor();
     $vendor->update($this->params['vendor']);
     expHistory::back();
 }