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


PHP Item::where方法代码示例

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


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

示例1: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $uncompletedItems = Item::where('isCompleted', 0)->get();
     $completedItems = Item::where('isCompleted', 1)->get();
     $data = ['uncompletedItems' => $uncompletedItems, 'completedItems' => $completedItems];
     return view('item.index', $data);
 }
开发者ID:avlima,项目名称:laravel-event-broadcasting,代码行数:12,代码来源:ItemController.php

示例2: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index($course_url, $stage_url)
 {
     $curso = Course::where('url', $course_url)->first();
     $etapa = Stage::where('url', $stage_url)->where('course_id', $curso->id)->first();
     $items = Item::where('stage_id', $etapa->id)->get();
     return view('pages.items.index', ['curso' => $curso, 'etapa' => $etapa, 'items' => $items]);
 }
开发者ID:juanfe190,项目名称:adminclubinnova,代码行数:12,代码来源:ItemController.php

示例3: getItemrfq

 public function getItemrfq(Request $request)
 {
     /* $col;
         if($request->s=='n'){
           $col='name';
         }else{
           $col='item_code';
     
         }*/
     $name = $request->term;
     $item = Item::where('name', 'like', '%' . $name . '%')->orWhere('item_code', 'like', '%' . $name . '%')->limit(5)->get();
     $result = [];
     foreach ($item as $itemlist) {
         $res = [];
         $res['name'] = $itemlist->name;
         $res['id'] = $itemlist->id;
         $res['item_code'] = $itemlist->item_code;
         $res['sell_price'] = $itemlist->price_sell;
         $res['description_1'] = $itemlist->description_1;
         $res['description_2'] = $itemlist->description_2;
         $res['description_3'] = $itemlist->description_3;
         $res['stock'] = $itemlist->stock;
         $res['unit'] = $itemlist->unit;
         $result[] = $res;
     }
     $result = array("results" => $result);
     return response()->json($result);
 }
开发者ID:husseinsbm,项目名称:erp-system-prototype,代码行数:28,代码来源:QtnController.php

示例4: newItem

 public function newItem()
 {
     $type = Input::get('type');
     if ($type == 1) {
         $ReceivingTemps = new ReceivingTemp();
         $ReceivingTemps->item_id = Input::get('item_id');
         $ReceivingTemps->cost_price = Input::get('cost_price');
         $ReceivingTemps->total_cost = Input::get('total_cost');
         $ReceivingTemps->quantity = 1;
         $ReceivingTemps->save();
         return $ReceivingTemps;
     } else {
         $itemkits = ItemKitItem::where('item_kit_id', Input::get('item_id'))->get();
         foreach ($itemkits as $value) {
             $item = Item::where('id', $value->item_id)->first();
             $ReceivingTemps = new ReceivingTemp();
             $ReceivingTemps->item_id = $value->item_id;
             $ReceivingTemps->cost_price = $item->cost_price;
             $ReceivingTemps->total_cost = $item->cost_price * $value->quantity;
             $ReceivingTemps->quantity = $value->quantity;
             $ReceivingTemps->save();
             //return $ReceivingTemps;
         }
         return $ReceivingTemps;
     }
 }
开发者ID:irfanmg,项目名称:tutapos,代码行数:26,代码来源:ReceivingTempApiController.php

示例5: store

 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $validator = Validator::make($request->all(), ['item_name' => 'required']);
     if ($validator->fails()) {
         return redirect('dashboard')->withErrors($validator)->withInput();
     }
     $item = $request->input('item_name');
     if (!Item::where('item_name', $item)->count()) {
         //naya item insert hua hai
         $items = new Item();
         $item_id = $items->insertGetId(['item_name' => $item, 'created_at' => Carbon::now()]);
         $data = new pivot_user_item();
         $data->user_id = Auth::user()->id;
         $data->item_id = $item_id;
         $data->save();
         $request->session()->flash('status', 'Item added.Add another item!');
     } else {
         $item_id = Item::where('item_name', $item)->value('id');
         if (pivot_user_item::where('item_id', $item_id)->where('user_id', Auth::user()->id)->count()) {
             //item agar user ka hoga to added
             $request->session()->flash('list', 'you have already added this item!');
         } else {
             //item naya user add kia hai
             $data = new pivot_user_item();
             $data->user_id = Auth::user()->id;
             $data->item_id = $item_id;
             $data->save();
             $request->session()->flash('status', 'Item added.Add another item!');
         }
     }
     return redirect('items');
 }
开发者ID:vikashkrkashyap,项目名称:Home-shopping-Managements,代码行数:37,代码来源:UserController.php

示例6: store

 public function store(ItemInRequest $request)
 {
     try {
         $counter = $request->input('counter');
         ItemIn::create($request->all());
         $data = ItemIn::orderBy('created_at', 'desc')->first();
         echo $counter;
         for ($i = 0; $i < $counter; $i++) {
             $qty = $request->input('qty' . strval($i));
             $itemId = $request->input('item_id' . strval($i));
             $isItemAvailable = Item::where('id', 'like', '%' . $itemId . '%')->first();
             // Item::findOrFail($itemId);
             if (is_null($isItemAvailable)) {
                 ItemIn::destroy($data->id);
                 return redirect('itemin')->with('message', 'Data dengan kode barang: ' . $itemId . ', tidak ada');
             } else {
                 DetailItemIn::create(['qty' => $qty, 'item_id' => $itemId, 'item_in_id' => $data->id]);
                 Item::addStock($itemId, $qty);
             }
         }
         return redirect('itemin')->with('message', 'Data berhasil dibuat!');
     } catch (\Illuminate\Database\QueryException $e) {
         return redirect('itemin')->with('message', 'Data dengan email tersebut sudah digunakan!');
     } catch (\PDOException $e) {
         return redirect('itemin')->with('message', 'Data dengan email tersebut sudah digunakan!');
     }
 }
开发者ID:Herlanggaws,项目名称:givani,代码行数:27,代码来源:ItemInController.php

示例7: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($course_url, $stage_url, $url)
 {
     $curso = Course::where('url', $course_url)->first();
     $etapa = Stage::where('url', $stage_url)->first();
     $item = Item::where('url', $url)->first();
     $tiposItem = ItemType::all()->pluck('name', 'id');
     return view('pages.items.edit', ['curso' => $curso, 'etapa' => $etapa, 'item' => $item, 'tiposItem' => $tiposItem]);
 }
开发者ID:Kenneth058,项目名称:adminclubinnova,代码行数:14,代码来源:ItemController.php

示例8: done

 public function done(Item $item)
 {
     $login_user = Auth::user();
     $child = $login_user->getChild();
     $child_member_id = $child->member_id;
     $item_record = $item->where("member_id", "=", $child_member_id)->where('did_get', '=', NULL)->first();
     $item_record->did_get = date("Y/m/d H:i:s");
     $item_record->save();
     return redirect()->to('/mypage/cart');
 }
开发者ID:nikotaman01,项目名称:PenGumin,代码行数:10,代码来源:MypageController.php

示例9: getItem

 public function getItem($market, $item)
 {
     $loggedIn = $this->loggedIn;
     $title = $market . ' - ' . $item;
     $marketName = $market;
     $item = Item::where('name', $item)->first();
     $user = $item->user;
     $markets = $this->markets;
     return view('environment.item', compact('title', 'markets', 'item', 'user', 'marketName', 'loggedIn'));
 }
开发者ID:udoblunt,项目名称:marketplaces,代码行数:10,代码来源:EnvironmentController.php

示例10: decreaseStock

 public static function decreaseStock($id, $qty)
 {
     $item = Item::where('id', '=', $id)->first();
     if (!is_null($item)) {
         $totalQty = $item->stock;
         $totalQty = $totalQty - $qty;
         $item->stock = $totalQty;
         $item->save();
     }
 }
开发者ID:Herlanggaws,项目名称:givani,代码行数:10,代码来源:Item.php

示例11: indexPath

 public function indexPath($path, Category $category, $parent = null)
 {
     $directory = new \DirectoryIterator($path);
     $dev = stat($path)[0];
     $files = [];
     $directories = [];
     foreach ($directory as $file) {
         if ($file->isDot() || !$file->isReadable()) {
             continue;
         }
         if ($file->isFile()) {
             $node = $file->getInode();
             if ($node <= 0 || $node == false) {
                 continue;
             }
             $f = File::where('dev', $dev)->where('inode', $node)->get();
             if (is_null($f) || !count($f)) {
                 $f = new File(['dev' => $dev, 'inode' => $node]);
             } else {
                 $f = $f->first();
             }
             $f->filename = $file->getFilename();
             $f->size = $file->getSize();
             if ($f->isDirty()) {
                 $f->save();
             }
             $files[] = $f;
         } else {
             if ($file->isDir()) {
                 $directories[] = $file->getPathname();
             }
         }
     }
     if (count($files) > 0 || count($directories) > 0) {
         $pathFile = new SplFileInfo($path);
         $item = Item::where('path', $pathFile->getRealPath())->get();
         if (is_null($item) || !count($item)) {
             $item = $category->items()->create(['title' => $pathFile->getFilename(), 'path' => $pathFile->getRealPath(), 'parent_id' => $parent]);
         } else {
             $item = $item->first();
         }
         // Files
         foreach ($files as $ob) {
             $ob->item()->associate($item);
             $ob->save();
         }
         /**
          * Directories
          * @todo Improve recursion
          */
         foreach ($directories as $dir) {
             $this->indexPath($dir, $category, $item->id);
         }
     }
 }
开发者ID:bagf,项目名称:laravel-file-search,代码行数:55,代码来源:IndexPath.php

示例12: index

 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     $items = Item::where('type', 1)->count();
     $item_kits = Item::where('type', 2)->count();
     $customers = Customer::count();
     $suppliers = Supplier::count();
     $receivings = Receiving::count();
     $sales = Sale::count();
     $employees = User::count();
     return view('home')->with('items', $items)->with('item_kits', $item_kits)->with('customers', $customers)->with('suppliers', $suppliers)->with('receivings', $receivings)->with('sales', $sales)->with('employees', $employees);
 }
开发者ID:rambo82,项目名称:tutapos,代码行数:16,代码来源:HomeController.php

示例13: search

 public function search()
 {
     $input = Request::all();
     $query = $input['query'];
     $items = Item::where('name', 'LIKE', "%{$query}%")->orWhere('description', 'LIKE', "%{$query}%")->paginate(10);
     if ($items == "[]") {
         //flash()->error('There are no suppliers that match your query.');
         return redirect()->action('ItemsController@index');
     }
     $items->appends(Request::only('query'));
     return view('items.index', compact('items'));
 }
开发者ID:jacqhernandez,项目名称:hsms,代码行数:12,代码来源:ItemsController.php

示例14: read

 public function read(int $id)
 {
     if (!$this->keyOwnsList(\App\Key::find($_GET['key_id']), $id)) {
         return $this->error('Permission denied or non existent');
     }
     $response = ['list' => \App\ItemList::find($id), 'items' => []];
     $items = \App\Item::where('list_id', $id)->get();
     if (!empty($items)) {
         $response['items'] = $items;
     }
     return response()->json($response);
 }
开发者ID:ashleyhindle,项目名称:mylistisonfire,代码行数:12,代码来源:ListController.php

示例15: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $itemType = ItemType::find($request['item_type_id']);
     do {
         $itemCode = $itemType->pre_code . self::DASH . StringUtil::getRandomString();
         $items = Item::where('item_code', $itemCode)->first();
         if (empty($items)) {
             $request['item_code'] = $itemCode;
             break;
         }
     } while (true);
     return $next($request);
 }
开发者ID:Kenneth058,项目名称:adminclubinnova,代码行数:20,代码来源:GenerateItemCode.php


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