本文整理汇总了PHP中Vendor::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Vendor::find方法的具体用法?PHP Vendor::find怎么用?PHP Vendor::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vendor
的用法示例。
在下文中一共展示了Vendor::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created resource in storage.
* POST /balancesheets
*
* @return Response
*/
public function store()
{
$balancesheet = new balancesheet();
/* $balancesheet->name = Input::get('name');
$balancesheet->save();
$balancesheet->vendor_type = Input::get('vendortype');
$balancesheet->save();*/
$vendor = Vendor::find(Input::get('vendor'));
$balancesheet->vendor_id = $vendor->id;
$balancesheet->save();
$balancesheet->total_amount = Input::get('Tamount');
$balancesheet->save();
$balancesheet->payable_amount = Input::get('Pamount');
$balancesheet->save();
$balancesheet->receivable_amount = Input::get('Ramount');
$balancesheet->save();
// $balancesheet->vendor_id = Input::get('vendor');
// $balancesheet->save();
if (Input::get('note') == '') {
$balancesheet->note = 'N/A';
} else {
$balancesheet->note = Input::get('note');
}
$balancesheet->save();
$balancesheet->balancesheet_id = "B0" . $balancesheet->id;
$balancesheet->save();
return Redirect::route('balancesheet.index');
}
示例2: update
public function update($id)
{
try {
//get the json from the request.
$updateModel = Input::json()->all();
//select the vendor name of the new selected vendor
$vendorQueryResult = Vendor::find($updateModel['vendor_id']);
$newVendorName = $vendorQueryResult->name;
//update the item model based on the json data sent.
$updateItem = Item::find($id);
$updateItem->description = $updateModel['description'];
$updateItem->email_threshold = $updateModel['email_threshold'];
$updateItem->item_url = $updateModel['item_url'];
$updateItem->name = $updateModel['name'];
$updateItem->on_order_quantity = $updateModel['on_order_quantity'];
$updateItem->vendor_id = $updateModel['vendor_id'];
$updateItem->quantity = $updateItem->quantity + $updateModel['adjustmentQty'];
if ($updateItem->quantity < 0) {
$updateItem->quantity = 0;
}
//save the updated item to the database
$updateItem->save();
//append the new vendor name to the model to send back in the response
$updateItem->vendor_name = $newVendorName;
$updateItem->adjustmentQty = 0;
//send the response
echo $updateItem->toJson();
} catch (Exception $e) {
return json_encode('{"error":{"text":' . $e->getMessage() . '}}');
}
}
示例3: store
public function store()
{
try {
$createOrder = Input::json()->all();
$addOrder = new Order();
$addOrder->status = 1;
$addOrder->save();
$addOrderId = $addOrder->id;
$numberOfItems = 0;
foreach ($createOrder['items'] as $OrderItem) {
$newOrderItem = new Order_Item();
$newOrderItem->order_id = $addOrderId;
$newOrderItem->item_id = $OrderItem['item_id'];
$newOrderItem->order_qty = $OrderItem['order_qty'];
$newOrderItem->save();
$numberOfItems = $numberOfItems + 1;
}
$addOrder->items = $createOrder['items'];
$addOrder->open = 'yes';
$vendorId = $createOrder['vendor_id'];
$addOrder->vendor_id = $vendorId;
$vendorName = Vendor::find($vendorId);
$addOrder->vendor_name = $vendorName->name;
$addOrder->item_count = $numberOfItems;
$this->addOrderToEmail($addOrder);
return $addOrder->toJson();
} catch (Exception $e) {
return '{"error":{"text":' . $e->getMessage() . '}}';
}
}
示例4: update
public function update($id)
{
$vendor = Vendor::find($id);
$data = Input::all();
$vendor->update($data);
if (!$vendor) {
return Redirect::to('admin.vendor.show')->with('message', 'gagal update vendor (ngga tau kenapa, panggil tegar)');
}
return Redirect::back()->with('message', 'berhasil update vendor (mungkin)');
}
示例5: validate
public function validate()
{
$this->error_if_empty("id");
$this->error_if_empty("name");
if (@$this->params["id"]) {
if (Vendor::find($this->params["id"])) {
$this->add_error("id", "Number is already assigned.");
}
}
}
示例6: update
public function update($id)
{
try {
$updateModel = Input::json()->all();
$updateVendor = Vendor::find($id);
$updateVendor->name = $updateModel['name'];
$updateVendor->url = $updateModel['url'];
$updateVendor->save();
} catch (Exception $e) {
return json_encode('{"error":{"text":' . $e->getMessage() . '}}');
}
}
示例7: saveEdit
public function saveEdit()
{
$r = Input::all();
$id = $r['id'];
unset($r['id']);
//We update the database
Vendor::find($id)->update($r);
//Lets fetch the updated data and return it through ajax
$r['id'] = $id;
$data['status'] = 'success';
$data['message'] = $r;
return Response::json($data);
}
示例8: update
public static function update($id)
{
self::check_logged_in();
$params = $_POST;
$attributes = array('id' => $id, 'name' => $params['name']);
$vendor = new Vendor($attributes);
$errors = $vendor->errors();
if (count($errors) > 0) {
$vendor = Vendor::find($id);
View::make('vendor/edit.html', array('errors' => $errors, 'given_name' => $params['name'], 'vendor' => $vendor));
} else {
$vendor->update();
Redirect::to('/vendors/' . $vendor->id, array('message' => 'The vendor has been modified successfully!'));
}
}
示例9: array_merge
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();
}
}
public function action_index()
{
$view = View::make('vendors.index');
$page = intval(Input::get('page') ?: 1);
$view->vendors = Vendor::join('users', 'user_id', '=', 'users.id')->where_null('users.banned_at')->raw_where("EXISTS (SELECT service_id from service_vendor WHERE `vendor_id` = `vendors`.`id`)")->where(function ($q) {
$q->where(DB::raw("RIGHT(image_url, 4)"), '=', 'jpeg');
$q->or_where_in(DB::raw("RIGHT(image_url, 3)"), array('jpg', 'gif', 'png'));
})->select(array('*', 'vendors.id as vendor_id'))->skip(($page - 1) * 10)->take(10)->order_by('vendors.created_at', 'desc')->get();
$this->layout->content = $view;
}
public function action_show()
{
$view = View::make('vendors.show');
$view->vendor = Config::get('vendor');
$this->layout->content = $view;
}
}
Route::filter('vendor_exists', function () {
$id = Request::$route->parameters[0];
$vendor = Vendor::find($id);
if (!$vendor) {
return Redirect::to('/vendors');
}
Config::set('vendor', $vendor);
});
示例10: update
/**
* Update the specified product in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$product = Product::findOrFail($id);
$validator = Validator::make($data = Input::all(), Product::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$vendor = Vendor::find(Input::get('vendor_id'));
$product->vendor()->associate($vendor);
$product->name = Input::get('name');
$product->description = Input::get('description');
$product->price = Input::get('price');
$product->status = 'active';
$product->update();
return Redirect::route('products.index');
}
示例11: array
Router::connect('/forgot-password', array('controller' => 'Webapp', 'action' => 'forgot_password'));
// Router::connect('/reset-password', array('controller' => 'Webapp', 'action' => 'reset_password'));
Router::connect('/change-password', array('controller' => 'Webapp', 'action' => 'change_password'));
// Router::connect('/pay-online', array('controller' => 'Webapp', 'action' => 'payments'));
Router::connect('/feedback', array('controller' => 'Webapp', 'action' => 'feedback'));
//Router::connect('/', array('controller' => 'pages', 'action' => 'login'));
/**
* ...and connect the rest of 'Pages' controller's URLs.
*/
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
/**
* Chef Router
*/
App::uses("Vendor", "Model");
$vendorModel = new Vendor();
$vendors = $vendorModel->find("all", array("contain" => false));
foreach ($vendors as $v) {
$slug = strtolower($v['Vendor']['name']);
$slug = str_replace(" ", "-", $slug);
Router::connect('/' . $slug, array('controller' => 'Webapp', 'action' => 'chef', $slug));
// echo $slug."\n";
}
// exit;
Router::connect('/', array('controller' => 'Webapp', 'action' => 'home'));
Router::connect('/dev', array('controller' => 'Webapp', 'action' => 'dev'));
Router::mapResources('vendors');
Router::parseExtensions();
/**
* Load all plugin routes. See the CakePlugin documentation on
* how to customize the loading of plugin routes.
*/
示例12: infoVendor
public function infoVendor()
{
if (isset($_GET['vendor_id'])) {
if (sizeof(Vendor::find($_GET['vendor_id'])) == 1) {
$data = array('status' => 'ok', 'vendor' => Vendor::find($_GET['vendor_id']));
return $data;
} else {
$data = array('status' => 'failed', 'error_msg' => 'Vendor specified does not exist');
return $data;
}
} else {
$data = array('status' => 'failed', 'error_msg' => 'Vendor ID was not specified');
return $data;
}
}
示例13: edit
/**
* Show the form for editing the specified vendor.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$vendor = Vendor::find($id);
return View::make('vendors.edit', compact('vendor'));
}
示例14:
<div>
<!--STANDART PRICE-->
<?php
echo $form->field($product, 'price', ['inputOptions' => ['class' => 'form-control']])->textInput(['type' => 'number', 'step' => '0.01'])->label(\Yii::t('shop', 'Price'));
?>
</div>
<div>
<!--COUNTRY-->
<?php
echo $form->field($product, 'country_id', ['inputOptions' => ['class' => 'form-control']])->dropDownList(['' => '-- no countries --'] + ArrayHelper::map(ProductCountryTranslation::find()->where(['language_id' => $selectedLanguage->id])->all(), 'country_id', 'title'))->label(\Yii::t('shop', 'Country'));
?>
</div>
<div>
<!--VENDOR-->
<?php
echo $form->field($product, 'vendor_id', ['inputOptions' => ['class' => 'form-control']])->dropDownList(['' => '-- no vendor --'] + ArrayHelper::map(Vendor::find()->all(), 'id', 'title'))->label(\Yii::t('shop', 'Vendor'));
?>
</div>
<div>
<!--AVAILABILITY-->
<?php
echo $form->field($product, 'availability', ['inputOptions' => ['class' => 'form-control']])->dropDownList(ArrayHelper::map(ProductAvailability::find()->all(), 'id', 'translation.title'))->label(\Yii::t('shop', 'Availability'));
?>
</div>
</div>
</div>
<!--SALE-->
<?php
echo $form->field($product, 'sale', ['inputOptions' => ['class' => '']])->checkbox(['class' => '']);
示例15: action_ban_vendor
public function action_ban_vendor($id)
{
$vendor = Vendor::find($id);
$vendor->ban();
return Redirect::back();
}