當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。