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


PHP Item::findOrFail方法代码示例

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


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

示例1: getDelete

 public function getDelete($item_id)
 {
     $task = Item::findOrFail($item_id);
     if ($task->user_id == Auth::user()->id) {
         $task->delete();
     }
     return Redirect::route('home');
 }
开发者ID:huang53798584,项目名称:To-do-list,代码行数:8,代码来源:HomeController.php

示例2: postIndex

 public function postIndex()
 {
     $id = Input::get('id');
     $item = Item::findOrFail($id);
     if ($item->onwer_id == Auth::user()->id) {
         $item->mark();
     }
     return Redirect::route('home');
 }
开发者ID:allapo,项目名称:to-do-list,代码行数:9,代码来源:HomeController.php

示例3: store

 /**
  * Store a newly created stock in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Stock::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $item_id = Input::get('item');
     $location_id = Input::get('location');
     $item = Item::findOrFail($item_id);
     $location = Location::find($location_id);
     $quantity = Input::get('quantity');
     $date = Input::get('date');
     Stock::addStock($item, $location, $quantity, $date);
     return Redirect::route('stocks.index')->withFlashMessage('stock has been successfully updated!');
 }
开发者ID:arapmelly,项目名称:xaraerp,代码行数:20,代码来源:StocksController.php

示例4: update

 /**
  * Update the specified item in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $item = Item::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Item::$rules, Item::$messages);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $item->name = Input::get('name');
     $item->description = Input::get('description');
     $item->purchase_price = Input::get('pprice');
     $item->selling_price = Input::get('sprice');
     $item->sku = Input::get('sku');
     $item->tag_id = Input::get('tag');
     $item->reorder_level = Input::get('reorder');
     $item->update();
     return Redirect::route('items.index')->withFlashMessage('Item successfully updated!');
 }
开发者ID:kenkode,项目名称:xaraerp,代码行数:23,代码来源:ItemsController.php

示例5: store

 /**
  * Store a newly created order in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validation = array('customer' => 'required', 'date' => 'required');
     $validator = Validator::make(Input::all(), $validation);
     if ($validator->fails()) {
         return Redirect::to('orders/create')->withErrors($validator);
     } else {
         $postorder = Input::all();
         $data = array('customer' => $postorder['customer'], 'date' => $postorder['date'], 'total_amount' => $postorder['total_amount'], 'discount' => $postorder['discount'], 'payable_amount' => $postorder['payable_amount'], 'payment' => $postorder['payment'], 'balance' => $postorder['balance']);
         $id = DB::table('orders')->insertGetId($data);
         for ($i = 0; $i < count($postorder['product_id']); $i++) {
             $data_detail = array('product_id' => $postorder['product_id'][$i], 'item' => $postorder['item'][$i], 'quantity' => $postorder['quantity'][$i], 'price' => $postorder['price'][$i], 'amount_charged' => $postorder['amount_charged'][$i], 'Order_id' => $id);
             DB::table('order_details')->insert($data_detail);
             $date = $postorder['date'];
             $location = Location::findOrFail($postorder['location']);
             foreach ($data_detail as $item) {
                 $it = Item::findOrFail($postorder['item'][$i]);
                 $quantity = $postorder['quantity'][$i];
                 Stock::removeStock($it, $location, $quantity, $date);
             }
         }
         return Redirect::route('orders.index')->with('success', 'Item Successfully Added');
     }
 }
开发者ID:kenkode,项目名称:gasexpress,代码行数:29,代码来源:OrdersController.php

示例6: getItem

 public function getItem($id)
 {
     $item = Item::findOrFail($id);
     dd("called");
     return Redirect::route('employees.index', compact('item'));
 }
开发者ID:noikiy,项目名称:posco-laravel-server,代码行数:6,代码来源:ItemsController.php

示例7: show

 /**
  * Display the specified resource.
  * GET /items/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     return Item::findOrFail($id);
 }
开发者ID:sahilkathpal,项目名称:hackcoin,代码行数:11,代码来源:ItemsController.php

示例8: Erporder

    //$orderitems = Session::get('erppurchase');
    $erporder = Session::get('erporder');
    $orderitems = Session::get('quotationitems');
    $total = Input::all();
    // $client = Client: :findorfail(array_get($erporder, 'client'));
    // print_r($total);
    $order = new Erporder();
    $order->order_number = array_get($erporder, 'order_number');
    $order->client()->associate(array_get($erporder, 'client'));
    $order->date = date('Y-m-d', strtotime(array_get($erporder, 'date')));
    $order->status = 'new';
    //$order->discount_amount = array_get($total, 'discount');
    $order->type = 'quotations';
    $order->save();
    foreach ($orderitems as $item) {
        $itm = Item::findOrFail($item['itemid']);
        $ord = Erporder::findOrFail($order->id);
        $orderitem = new Erporderitem();
        $orderitem->erporder()->associate($ord);
        $orderitem->item()->associate($itm);
        $orderitem->price = $item['price'];
        $orderitem->quantity = $item['quantity'];
        //s$orderitem->duration = $item['duration'];
        $orderitem->save();
    }
    //Session::flush('orderitems');
    //Session::flush('erporder');
    return Redirect::to('quotationorders');
});
Route::get('erporders/cancel/{id}', function ($id) {
    $order = Erporder::findorfail($id);
开发者ID:kenkode,项目名称:umash-1,代码行数:31,代码来源:routes.php

示例9: update

 /**
  * Update the specified item in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $item = Item::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Item::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $item->update($data);
     return Redirect::route('admin.items.index');
 }
开发者ID:yanguanglan,项目名称:sz,代码行数:16,代码来源:ItemsController.php


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