当前位置: 首页>>代码示例>>PHP>>正文


PHP Item::destroy方法代码示例

本文整理汇总了PHP中Item::destroy方法的典型用法代码示例。如果您正苦于以下问题:PHP Item::destroy方法的具体用法?PHP Item::destroy怎么用?PHP Item::destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Item的用法示例。


在下文中一共展示了Item::destroy方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: destroy

 public static function destroy($id)
 {
     self::check_logged_in();
     $item = new Item(array('id' => $id));
     $item->destroy();
     Redirect::to('/item', array('message' => 'The item has been removed successfully!'));
 }
开发者ID:jackrl,项目名称:Tsoha-Bootstrap,代码行数:7,代码来源:items_controller.php

示例2: getDelete

 public function getDelete($item_id)
 {
     $message = "エラーが発生しました。";
     if (Item::find($item_id)) {
         Item::destroy($item_id);
         Review::where('item_id', '=', $item_id)->delete();
         $message = "レビュー対象を削除しました。";
     }
     Session::flash('alert', $message);
     return Redirect::to('/review');
 }
开发者ID:RyoBamboo,项目名称:RoughSetSystem,代码行数:11,代码来源:ReviewController.php

示例3: destroy

 /**
  * Remove the specified item from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Item::destroy($id);
     return Redirect::route('items.index');
 }
开发者ID:noikiy,项目名称:posco-laravel-server,代码行数:11,代码来源:ItemsController.php

示例4: destroy

 /**
  * Remove the specified resource from storage.
  * DELETE /items/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $status = Item::destroy($id);
     return $status ? ['status' => true] : ['status' => false];
 }
开发者ID:sahilkathpal,项目名称:hackcoin,代码行数:12,代码来源:ItemsController.php

示例5: removeItem

 public function removeItem($id)
 {
     Item::destroy($id);
     return redirect('/shop');
 }
开发者ID:yoannamiteva,项目名称:it_talents,代码行数:5,代码来源:ShopController.php

示例6:

<?php

require_once '../classes/session.php';
require __DIR__ . '/../vendor/autoload.php';
require_once '../classes/Restaurant.php';
require_once '../classes/Item.php';
require '../config.php';
require '../classes/boot.php';
$item_id = $_GET['item_id'];
$rest_id = $_GET['rest_id'];
Item::destroy($item_id);
header("location:view_items.php?id={$rest_id}");
开发者ID:helloworldprojects,项目名称:FoodWeb,代码行数:12,代码来源:delete_item.php

示例7: destroy

 /**
  * Remove the specified item from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Item::destroy($id);
     return Redirect::route('items.index')->withDeleteMessage('Item successfully deleted!');
 }
开发者ID:kenkode,项目名称:xaraerp,代码行数:11,代码来源:ItemsController.php

示例8: update

 /**
  * Update the specified resource in storage.
  * PUT /invoices/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $user = Auth::user();
     $invoice = Invoice::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Invoice::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $invoice->biller_id = Input::get('biller_id');
     $invoice->client_id = Input::get('client_id');
     $invoice->currency_id = Input::get('currency_id');
     $invoice->number = Input::get('number');
     $invoice->subtotal = floatval(Input::get('subtotal'));
     $invoice->tax_rate_id = Input::get('tax_rate');
     $invoice->tax_total = floatval(Input::get('invoice_total_tax'));
     $invoice->total = floatval(Input::get('total'));
     $invoice->paid = floatval(Input::get('invoice_total_paid'));
     $invoice->balance = $invoice->total - $invoice->paid;
     $invoice->user_id = $user->id;
     if (Input::has('date')) {
         $invoice->date = Input::get('date');
     }
     if (Input::has('due_date')) {
         $invoice->due_date = Input::get('due_date');
     }
     $invoice->note = Input::get('note');
     if ($invoice->save()) {
         $item_id = Input::get('item_id');
         $name = Input::get('item_name');
         $description = Input::get('item_description');
         $price = Input::get('item_price');
         $quantity = Input::get('item_qty');
         $old_items = $invoice->item->lists('id');
         $diff = array_diff($old_items, $item_id);
         if (!empty($diff)) {
             Item::destroy($diff);
         }
         $keys = array('item_id', 'name', 'description', 'price', 'quantity');
         $items = array();
         foreach (array_map(null, $item_id, $name, $description, $price, $quantity) as $key => $value) {
             $items[] = array_combine($keys, $value);
         }
         foreach ($items as $item) {
             $itemRecord = array('invoice_id' => $invoice->id, 'name' => $item['name'], 'description' => $item['description'], 'price' => floatval($item['price']), 'quantity' => floatval($item['quantity']), 'total' => floatval($item['price']) * floatval($item['quantity']));
             if (empty($item['item_id'])) {
                 $item = Item::create($itemRecord);
                 //$invoice->item()->create($itemRecord);
             } else {
                 // print($item['item_id']);
                 $item = Item::where('id', '=', $item['item_id'])->update($itemRecord);
                 //$invoice->item()->update($itemRecord);
             }
         }
         return Redirect::to('invoices/' . $invoice->id . '/edit')->with('success', Lang::get('invoices.message.success.update'));
     }
 }
开发者ID:mladjom,项目名称:smartinvoice,代码行数:63,代码来源:InvoicesController.php


注:本文中的Item::destroy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。