本文整理汇总了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);
}
};
}
示例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);
}
};
}
示例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";
示例4: index
/**
* Display a listing of stocks
*
* @return Response
*/
public function index()
{
$stocks = Stock::all();
return View::make('stocks.index', compact('stocks'));
}
示例5: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$stocks = $this->stock->all();
return View::make('stocks.index', compact('stocks'));
}