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


PHP Listing::all方法代码示例

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


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

示例1: myListings

 public function myListings($app)
 {
     if (!$app->user->isLoggedIn()) {
         $app->output->redirect('/account/login');
     }
     $app->output->addBreadcrumb('', 'CSGOShop');
     $app->output->addBreadcrumb('account/listings', 'My Listings');
     $listings = Listing::all(array('conditions' => array('user_id = ? AND ISNULL(parent_listing_id)', $app->user->id), 'order' => 'updated_at DESC', 'include' => array('description')));
     $request = $app->router->flight->request();
     $page = $request->query->p ?: 0;
     $offset = $page * self::MAX_LISTINGS_SHOWN;
     $total = ceil(count($listings) / self::MAX_LISTINGS_SHOWN);
     if ($offset < 0 || $page > $total) {
         $app->output->redirect('/account/listings');
     }
     $listings = array_slice($listings, $offset, self::MAX_LISTINGS_SHOWN);
     if (isset($app->router->flight->request()->query->new)) {
         $app->output->alert('You have successfully requested a new listing.', 'success');
     }
     if (isset($app->router->flight->request()->query->cancel)) {
         $app->output->alert('Your request to cancel a listing has been sent.', 'success');
     }
     if (empty($listings)) {
         $app->output->alert('You do not have any listings open.', 'warning');
     }
     $app->output->setTitle('My Listings');
     $app->output->setActiveTab('account');
     $app->output->render('account.listings', ['listings' => $listings, 'page_num' => $page, 'total' => $total]);
 }
开发者ID:puttyplayer,项目名称:CSGOShop,代码行数:29,代码来源:AccountController.php

示例2: down

 /**
  * Revert the changes to the database.
  *
  * @return void
  */
 public function down()
 {
     //
     $listings = Listing::all();
     foreach ($listings as $listing) {
         $listing->delete();
     }
 }
开发者ID:angmark0309,项目名称:remarket,代码行数:13,代码来源:2013_02_27_213554_insert_listings.php

示例3: up

 /**
  * Make changes to the database.
  *
  * @return void
  */
 public function up()
 {
     //
     $listings = Listing::all();
     foreach ($listings as $l) {
         for ($i = 0; $i < 5; $i++) {
             $image = new Image();
             $image->description = "PIC DESCRIPTIOIN";
             $image->listing_id = $l->id;
             $image->save();
         }
     }
 }
开发者ID:angmark0309,项目名称:remarket,代码行数:18,代码来源:2013_03_13_232334_insert_pics.php

示例4: inventory

 public function inventory($app)
 {
     try {
         $id = $app->user->id;
         $inventory = $app->steam->getInventory($id);
         // Filter out items already in listings
         $listings = Listing::all(array('conditions' => array('user_id = ? AND stage != ?', $id, Listing::STAGE_DELETE)));
         foreach ($listings as $idx => $listing) {
             unset($inventory[$listing->item_id]);
         }
         $inventory_json = array();
         foreach ($inventory as $item_id => $item) {
             print_r($item);
             array_push($inventory_json, array('id' => $item->id, 'market_name' => $item->desc->market_name, 'stackable' => $item->desc->stackable, 'price_preset' => $item->desc->price_preset, 'icon' => $item->desc->icon_url_large ?: $item->desc->icon_url));
         }
         $app->output->json(array('error' => false, 'items' => $inventory_json));
     } catch (SteamAPIException $e) {
         $app->logger->log('Inventory fetch failed (SteamAPIException)', 'ERROR', array('pathway' => 'inventory'), 'user');
         $app->output->json(array('error' => true, 'message' => 'Steam API could not be reached.'), 503);
     } catch (User_InventoryError $e) {
         $app->logger->log('Inventory fetch failed (User_InventoryError)', 'ERROR', array('pathway' => 'inventory'), 'user');
         $app->output->json(array('error' => true, 'message' => 'Your inventory could not be fetched.'), 500);
     }
 }
开发者ID:puttyplayer,项目名称:CSGOShop,代码行数:24,代码来源:DataController.php


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