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


PHP Stock::all方法代码示例

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


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

示例1: inventory

 public static function inventory()
 {
     return function ($request, $response) {
         if ($request->session('admin')) {
             try {
                 $response->header('Content-Type', 'application/pdf');
                 $stocks_report = Zend_Pdf::load('../pdf/inv.pdf');
                 $page = $stocks_report->pages[0];
                 $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_COURIER);
                 $page->setFont($font, 10);
                 $page->drawText(Time::unixToDate(time()), 290, 818);
                 $row = 765;
                 $stocks = Stock::all();
                 foreach ($stocks as $stock) {
                     $page->drawText(sprintf("%10.39s", $stock->product->name), 32, $row);
                     $page->drawText($stock->product->description, 280, $row);
                     $page->drawText(sprintf("%4u", $stock->quantity), 550, $row);
                     $row -= 15;
                 }
                 $page->drawText("Prepared by:", 300, 80);
                 $page->drawText("________________________________", 300, 50);
                 echo $stocks_report->render();
             } catch (Exception $e) {
                 $response->header('Content-Type', 'text/plain');
                 echo $e->getMessage();
             }
         } else {
             $response->code(403);
         }
     };
 }
开发者ID:samdubey,项目名称:ads2,代码行数:31,代码来源:reportctrl.php

示例2: index

 public static function index()
 {
     return function ($request, $response) {
         if ($request->session('admin')) {
             switch ($request->method()) {
                 case 'GET':
                     # code...
                     $stocks = Stock::all();
                     $response->json($stocks->as_array());
                     break;
                 case 'POST':
                     # code...
                     $data = $request->data();
                     $stock = new Stock();
                     $stock->product = $data->product->id;
                     $stock->quantity = $data->quantity;
                     $stock->save();
                     $response->json($stock->as_array());
                     break;
                 case 'DELETE':
                     # code...
                     echo "DELETE";
                     break;
                 case 'PUT':
                     # code...
                     echo "PUT";
                     break;
                 default:
                     # code...
                     break;
             }
         } else {
             $response->code(403);
         }
     };
 }
开发者ID:samdubey,项目名称:ads2,代码行数:36,代码来源:stockctrl.php

示例3: time

<?php

require_once '../general.php';
$stocks = Stock::all()->as_array();
print_r($stocks);
echo time() . "\n";
echo Time::unixToDate(time()) . "\n";
echo date(DATE_RFC822, strtotime('thursday next week 10:30am', 1352710199)) . "\n";
echo date(DATE_RFC822, strtotime('next month', 1352710199)) . "\n";
开发者ID:samdubey,项目名称:ads2,代码行数:9,代码来源:stock_test.php

示例4: index

 /**
  * Display a listing of stocks
  *
  * @return Response
  */
 public function index()
 {
     $stocks = Stock::all();
     return View::make('stocks.index', compact('stocks'));
 }
开发者ID:kenkode,项目名称:xaraerp,代码行数:10,代码来源:StocksController.php

示例5: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $stocks = $this->stock->all();
     return View::make('stocks.index', compact('stocks'));
 }
开发者ID:maldewar,项目名称:jidou,代码行数:10,代码来源:StocksController.php


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