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


PHP app\Item类代码示例

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


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

示例1: show

 public function show($id, Request $request)
 {
     $id = (int) my_decode($id);
     $data['user'] = $this->person->respondWithItem($this->person->get('person_' . $id), new UserTransformer());
     //get invidvidual reports
     $response = $this->report->individual($id);
     $data['totalIReport'] = 0;
     $data['individual'] = [];
     $item = new Item();
     if (!isset($response['error'])) {
         $data['individual'] = $this->report->respondWithCollection($response['data'], new ReportTransformer());
         foreach ($data['individual'] as $i => $row) {
             $items = $item->getItemsByReport((int) my_decode($row['id']));
             $data['individual'][$i]['items'] = $items['totalRecords'];
         }
         $data['totalIReport'] = $response['totalRecords'];
     }
     $response = $this->report->group($id);
     $data['totalGReport'] = 0;
     $data['group'] = [];
     if (!isset($response['error'])) {
         $data['group'] = $this->report->respondWithCollection($response['data'], new ReportTransformer());
         foreach ($data['group'] as $i => $row) {
             $items = $item->getItemsByReport((int) my_decode($row['id']));
             $data['group'][$i]['items'] = $items['totalRecords'];
         }
         $data['totalGReport'] = $response['totalRecords'];
     }
     return view('users_profile', $data);
 }
开发者ID:grepollo,项目名称:dkb_5sp,代码行数:30,代码来源:UsersController.php

示例2: 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

示例3: create

 public function create(Requests\ItemRequest $request)
 {
     $name = $request->name;
     $shortdesc = $request->shortdesc;
     $desc = $request->desc;
     $price = $request->price;
     $id = $request->id;
     $characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
     $string = '';
     $random_string_length = 12;
     for ($i = 0; $i < $random_string_length; $i++) {
         $string .= $characters[rand(0, strlen($characters) - 1)];
     }
     $imageName = $name . '_' . $string . '.' . $request->file($id . 'image')->getClientOriginalExtension();
     $item = new Item();
     $item->name = $name;
     $item->shortdesc = $shortdesc;
     $item->desc = $desc;
     $item->image = $imageName;
     $item->group_id = $id;
     $item->price = $price;
     $item->save();
     $request->file($id . 'image')->move(base_path() . '/public/upload/itemimages/', $imageName);
     return redirect('admin/catalogue');
 }
开发者ID:silent-sea,项目名称:silent-sea,代码行数:25,代码来源:ItemsController.php

示例4: postAddItemStepTwo

 private function postAddItemStepTwo(ItemRequest $request)
 {
     //Create new item
     $item = new Item();
     $item->name = $request->name;
     $item->description = $request->description;
     $item->price = $request->price;
     $item->by_mail = $request->by_mail ? 1 : 0;
     $item->user()->associate(Auth::user());
     $item->save();
     //Create new itemAttributes based on the defaultAttributes of the market
     foreach ($request->itemAttributes as $name => $value) {
         $itemAttribute = new ItemAttribute();
         $itemAttribute->name = $name;
         $itemAttribute->value = $value;
         $itemAttribute->item()->associate($item);
         $itemAttribute->save();
     }
     //Create new itemPhotos
     /*if (!empty($request->itemPhotos))
       {
           foreach ($request->get('itemPhotos') as $itemPhoto)
           {
               var_dump($itemPhoto);exit;
           }
       }*/
 }
开发者ID:udoblunt,项目名称:marketplaces,代码行数:27,代码来源:ItemController.php

示例5: index

 public function index()
 {
     $person = new Person();
     $report = new Report();
     $item = new Item();
     $role = session('user.role');
     $data = ['total_users' => 0, 'total_report' => 0, 'total_item' => 0];
     if ($role == 'U') {
         //get data on report and item only
     } else {
         if ($role == 'M') {
             $response = $person->getAssignedPersons(session('user.id'));
             if (!empty($response)) {
                 //get total reports or their assigned users
                 $data['total_users'] = $response['totalRecords'];
                 foreach ($response['data'] as $row) {
                     $reports = $report->getReportsByPerson($row['id']);
                     if (!empty($reports['data'])) {
                         $data['total_report'] += $reports['totalRecords'];
                         //get item of the report
                         foreach ($reports['data'] as $srow) {
                             $items = $item->getItemsByReport($srow['id']);
                             $data['total_item'] += $items['totalRecords'];
                         }
                     }
                 }
                 //get current user's report
                 $response = $report->getReportsByPerson(session('user.id'));
                 if (!empty($response['data'])) {
                     $data['total_report'] += $response['totalRecords'];
                     //get item of the report
                     foreach ($response['data'] as $row) {
                         $items = $item->getItemsByReport($row['id']);
                         $data['total_item'] += $items['totalRecords'];
                     }
                 }
             }
         } else {
             //admin
             $response = $person->all([]);
             if (!empty($response)) {
                 //get total reports or their assigned users
                 $data['total_users'] = $response['totalRecords'];
                 foreach ($response['data'] as $row) {
                     $reports = $report->getReportsByPerson($row['id']);
                     if (isset($reports['data']) && !empty($reports['data'])) {
                         $data['total_report'] += $reports['totalRecords'];
                         //get item of the report
                         foreach ($reports['data'] as $srow) {
                             $items = $item->getItemsByReport($srow['id']);
                             $data['total_item'] += $items['totalRecords'];
                         }
                     }
                 }
             }
         }
     }
     return view('dashboard', $data);
 }
开发者ID:grepollo,项目名称:dkb_5sp,代码行数:59,代码来源:DashboardController.php

示例6: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show()
 {
     $info = new Item();
     $info->setTable($this->getLoginUsername());
     //$info->setTable($this->getLoginUsername());
     $list = $info->all($this->getLoginUsername(), array('taskname', 'deadline', 'description', 'important'));
     return view('auth.profile')->with(array('username' => $this->getLoginUsername(), 'list' => $list));
 }
开发者ID:kakaacac,项目名称:loudengdeng,代码行数:14,代码来源:ToDoListController.php

示例7: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $item = new Item();
     $item->item_name = trim($request->get('item_name'));
     $item->item_id = (int) $request->get('item_id');
     $item->save();
     return redirect('/item')->withSuccess("Item {$item->item_name} was created");
 }
开发者ID:HostOnNet,项目名称:merch.runerank.com,代码行数:14,代码来源:ItemController.php

示例8: getDelete

 public function getDelete(Item $task)
 {
     //echo $task;
     //security, make sure that the correct user deletes this task
     if ($task->owner_id == Auth::user()->id) {
         $task->delete();
     }
     return Redirect::route('home');
 }
开发者ID:Verhoevenwout,项目名称:web-backend-oplossingen,代码行数:9,代码来源:HomeController.php

示例9: store

 public function store(Request $request)
 {
     $item = new Item();
     $item->setSymPass($request->session()->get('sym_pass'));
     $item->key = $request->key;
     $item->val = $request->val;
     $item->resource_id = $request->resource_id;
     $item->save();
     return redirect()->route('resource.show', ['id' => $request->resource_id]);
 }
开发者ID:ruslan2k,项目名称:web-password,代码行数:10,代码来源:ItemController.php

示例10: save

 public function save(Request $request, Response $response, array $args)
 {
     $_POST = array_filter($_POST, 'trim');
     $metadata = array('id' => filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT), 'title' => filter_input(INPUT_POST, 'title'), 'description' => filter_input(INPUT_POST, 'description'), 'date' => filter_input(INPUT_POST, 'date'), 'date_granularity' => filter_input(INPUT_POST, 'date_granularity', FILTER_SANITIZE_NUMBER_INT), 'edit_group' => filter_input(INPUT_POST, 'edit_group', FILTER_SANITIZE_NUMBER_INT), 'read_group' => filter_input(INPUT_POST, 'read_group', FILTER_SANITIZE_NUMBER_INT));
     $tags = filter_input(INPUT_POST, 'tags');
     $item = new Item(null, $this->user);
     $item->save($metadata, $tags, $_FILES['file']['tmp_name'], filter_input(INPUT_POST, 'file_contents'));
     $config = new Config();
     return new RedirectResponse($config->baseUrl() . '/' . $item->getId());
 }
开发者ID:samwilson,项目名称:swidau,代码行数:10,代码来源:ItemController.php

示例11: 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

示例12: addItem

 static function addItem($request)
 {
     $item = new Item();
     $item->user_id = $request->input('user_id');
     $item->name = $request->input('name');
     $item->specifications = $request->input('specifications');
     $item->link = $request->input('link');
     $item->rank = $request->input('rank');
     $item->save();
 }
开发者ID:michael-dean-haynie,项目名称:my-secret-santa,代码行数:10,代码来源:Item.php

示例13: getCategoryItems

 /**
  * Returns category items
  *
  * @param string $alias
  * @return array
  */
 public function getCategoryItems($alias)
 {
     $categories = $this->categoryService->getCategoriesByAlias($alias);
     if (count($categories) === 0) {
         return [];
     }
     $categoryIDs = array_map(function (Category $category) {
         return $category->id;
     }, $categories);
     return $this->itemStorage->getCategoriesItems($categoryIDs);
 }
开发者ID:yayatoure42,项目名称:service-exchange,代码行数:17,代码来源:ItemsService.php

示例14: render

 public function render(Request $request, Response $response, array $args)
 {
     $item = new Item($args['id']);
     $size = isset($args['size']) ? $args['size'] : 'o';
     $version = isset($args['version']) ? $args['version'] : null;
     $cacheFile = $item->getCachePath($size, $version);
     $fileResponse = new BinaryFileResponse($cacheFile);
     $fileResponse->headers->set('Content-Type', 'image/png');
     $fileResponse->setFile($cacheFile);
     $fileResponse->setContentDisposition(ResponseHeaderBag::DISPOSITION_INLINE, $item->getTitle() . '.png');
     return $fileResponse;
 }
开发者ID:samwilson,项目名称:swidau,代码行数:12,代码来源:FileController.php

示例15: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     for ($i = 0; $i < 300; $i++) {
         Item::create(['name' => $faker->shuffle($faker->name()), 'description' => $faker->text(), 'icon' => $faker->imageUrl(100, 100, 'abstract')]);
     }
 }
开发者ID:benjides,项目名称:terrabattlez,代码行数:12,代码来源:ItemSeeder.php


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