本文整理汇总了PHP中Vendor::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Vendor::save方法的具体用法?PHP Vendor::save怎么用?PHP Vendor::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vendor
的用法示例。
在下文中一共展示了Vendor::save方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
public function store()
{
try {
$newVendor = new Vendor();
$newVendor->name = Input::get('name');
$newVendor->url = Input::get('url');
$newVendor->save();
return $newVendor->toJson();
} catch (Exception $e) {
return json_encode('{"error":{"text":' . $e->getMessage() . '}}');
}
}
示例2: store
public static function store()
{
self::check_logged_in();
$params = $_POST;
$attributes = array('name' => $params['name']);
$vendor = new Vendor($attributes);
$errors = $vendor->errors();
if (count($errors) == 0) {
$vendor->save();
Redirect::to('/vendors/' . $vendor->id, array('message' => 'The new vendor has been added to the database'));
} else {
View::make('vendor/new.html', array('errors' => $errors, 'attributes' => $attributes));
}
}
示例3: createVendor
public function createVendor()
{
if (isset($_POST['name']) && isset($_POST['username']) && isset($_POST['email']) && isset($_POST['password'])) {
$vendor = new Vendor();
$vendor->name = $_POST['name'];
$vendor->username = $_POST['username'];
$vendor->email = $_POST['email'];
$vendor->password = Hash::make($_POST['password']);
$vendor->save();
return Redirect::to('/')->with('error', 'Vendor Created!');
} else {
return Redirect::to('/')->with('error', 'Missing Information');
}
}
示例4: save
function save()
{
$id = $this->input->post("id");
if ($id == 0) {
$vendorObject = new Vendor();
} else {
$vendorObject = new Vendor($id);
}
$vendorObject->name = $vendorObject->input->post("name", TRUE);
$vendorObject->address = $vendorObject->input->post("address", TRUE);
$vendorObject->number = $vendorObject->input->post("number", TRUE);
$vendorObject->email = $vendorObject->input->post("email", TRUE);
$vendorObject->save();
echo $vendorObject->id;
}
示例5: store
/**
* Store a newly created vendor in storage.
*
* @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->email = Input::get('email');
$vendor->phone = Input::get('phone');
$vendor->description = Input::get('description');
$vendor->status = Input::get('status');
$vendor->save();
return Redirect::route('vendors.index');
}
示例6: actionCreate
public function actionCreate()
{
$model = new Vendor();
if (isset($_POST['Vendor'])) {
$model->setAttributes($_POST['Vendor']);
if ($model->save()) {
if (Yii::app()->getRequest()->getIsAjaxRequest()) {
Yii::app()->end();
} else {
$this->redirect(array('view', 'id' => $model->id));
}
}
}
$this->render('create', array('model' => $model));
}
示例7: vendor
public static function vendor()
{
$faker = Faker\Factory::create();
$image_urls = array('http://i.imgur.com/Gh4ZX.png', 'http://i.imgur.com/vySFV.png', 'http://i.imgur.com/RdBae.png', 'http://i.imgur.com/ED5fa.png', 'http://i.imgur.com/gJncN.png', 'http://i.imgur.com/3pKFS.png', 'http://i.imgur.com/3pKFS.png');
$u = User::create(array('email' => 'vendor' . self::$vendor_count . '@example.com', 'password' => 'password'));
$v = new Vendor(array('company_name' => $faker->company, 'contact_name' => $faker->name, 'address' => $faker->streetAddress, 'city' => $faker->city, 'state' => $faker->stateAbbr, 'zip' => $faker->postcode, 'ballpark_price' => rand(1, 4), 'image_url' => $image_urls[array_rand($image_urls)], 'homepage_url' => $faker->url, 'more_info' => $faker->paragraph));
$v->user_id = $u->id;
$v->save();
foreach (Service::all() as $service) {
if (rand(1, 2) == 2) {
$v->services()->attach($service->id);
}
}
self::$vendor_count++;
return $v;
}
示例8: action_create
public function action_create()
{
$user_input = Input::get('user');
$user = new User();
$user->email = $user_input["email"];
$user->password = $user_input["password"];
$user->how_hear = $user_input["how_hear"];
$user->send_emails = isset($user_input["send_emails"]) ? true : false;
$vendor = new Vendor(Input::get('vendor'));
if ($user->validator()->passes() && $vendor->validator()->passes()) {
$user->save();
$vendor->user_id = $user->id;
$vendor->save();
$services = Input::get('services') ? array_keys(Input::get('services')) : array();
$user->vendor->services()->sync($services);
Session::regenerate();
Auth::login($user->id);
Mailer::send("NewVendorRegistered", array("user" => $user));
return Redirect::to('/');
} else {
Session::flash('errors', array_merge($user->validator()->errors->all(), $vendor->validator()->errors->all()));
return Redirect::to_route('new_vendors')->with_input();
}
}
示例9: switch
$im_crop->setSave_scale(1);
$im_crop->setSave_name($_SESSION["path"] . $_SESSION["uploaded_file"]);
if (!$im_crop->doResize()) {
print_r($im_crop->getErrorMessage());
exit;
}
switch ($_SESSION["module"]) {
case "category":
$cat = new Category($_SESSION["id"]);
$cat->setImage($_SESSION["uploaded_file"]);
$cat->save();
break;
case "vendor":
$vend = new Vendor($_SESSION["id"]);
$vend->setLogo($_SESSION["uploaded_file"]);
$vend->save();
break;
default:
break;
}
$module = $_SESSION["module"];
unset($_SESSION["uploaded_file"]);
unset($_SESSION["id"]);
unset($_SESSION["module"]);
unset($_SESSION["path"]);
unset($_SESSION["url"]);
header("Location: " . $module . ".php?do=list");
exit;
} else {
$ft->define(array("main" => "template_index.html", "content" => "error.html"));
$ft->assign("ERROR_MESSAGE", "ERROR OCURED");