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