本文整理汇总了PHP中Stock::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Stock::find方法的具体用法?PHP Stock::find怎么用?PHP Stock::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stock
的用法示例。
在下文中一共展示了Stock::find方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: destroy
public function destroy($id_articulo)
{
try {
DB::beginTransaction();
$articulo = Articulo::find($id_articulo);
$articulo_stock = Stock::find($id_articulo);
if (is_null($articulo)) {
App::abort(404);
}
$articulo_stock->delete();
$articulo->delete();
DB::commit();
$articulos = DB::table('articulos')->join('rubros', 'articulos.id_rubro', '=', 'rubros.id_rubro')->join('proveedores', 'articulos.id_proveedor', '=', 'proveedores.id_proveedor')->join('stock', 'articulos.id_articulo', '=', 'stock.id_articulo')->join('sucursales', 'stock.id_sucursal', '=', 'sucursales.id_sucursal')->select('articulos.id_articulo', 'rubros.rubro', 'articulos.nombre', 'articulos.descripcion', 'articulos.alto', 'articulos.largo', 'articulos.ancho_prof', 'articulos.precio_compra', 'rubros.id_rubro', 'proveedores.nom_raz', 'stock.cantidad', 'sucursales.nombre as sucursal')->orderby('articulos.nombre', 'asc')->paginate(100);
return View::make('lista_articulos')->with('articulos', $articulos);
} catch (Exception $ex) {
DB::rollBack();
echo $ex->getMessage();
}
}
示例2: getVentareposicion
public function getVentareposicion($id)
{
$stock_r = VistaStock::find($id);
//actualiza el stock
$update_stock = Stock::find($id);
$update_stock->activo = 0;
$update_stock->save();
//actualiza tipo de baja
$update_material_baja = MaterialBaja::find($stock_r->material_baja_id);
$update_material_baja->reposicion = 1;
$update_material_baja->stock = 0;
$update_material_baja->save();
//registra la venta en tabla reposicion
$reposicion = new Reposicion();
$reposicion->motivos = 'Pieza de stock ' . $stock_r->folio;
$reposicion->material_baja_id = $stock_r->material_baja_id;
$reposicion->captura_usuario_id = Auth::user()->id;
$reposicion->precio_reposicion = $stock_r->precio_venta;
$reposicion->save();
return Redirect::back();
}
示例3: post_stocksave
public function post_stocksave()
{
$sparepart = Sparepart::where('part_number', '=', Input::get('part_number'))->first();
$msg = 'Part Number tidak ada di database pusat';
if ($sparepart) {
if (Input::get('id') == '') {
$stock = new Stock();
$stock->pool_id = Auth::user()->pool_id;
$stock->sparepart_id = $sparepart->id;
$stock->min_qty = Input::get('min_qty');
$stock->sale_price = Input::get('sale_price');
$stock->discount = 0;
$stock->sale_on = 0;
$stock->qty = Input::get('qty');
$stock->user_id = Auth::user()->id;
$stock->note = Input::get('note');
$stock->save();
$msg = 'Stock berhasil di tambahkan di gudang pool';
} else {
$stock = Stock::find(Input::get('id'));
$stock->pool_id = Auth::user()->pool_id;
$stock->sparepart_id = $sparepart->id;
$stock->min_qty = Input::get('min_qty');
$stock->sale_price = Input::get('sale_price');
$stock->discount = 0;
$stock->sale_on = 0;
//$stock->qty = $stock->qty + Input::get('new_qty');
$stock->user_id = Auth::user()->id;
$stock->note = Input::get('note');
$stock->save();
$msg = 'Stock berhasil di update';
Trackinginventory::create(array('pool_id' => Auth::user()->pool_id, 'sparepart_id' => $sparepart->id, 'qty' => Input::get('new_qty'), 'user_id' => Auth::user()->id, 'note' => 'Part Ajustment oleh ' . Auth::user()->fullname));
}
}
return Redirect::to('warehouses/stock')->with('status', $msg);
}
示例4: edit
/**
* Show the form for editing the specified stock.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$stock = Stock::find($id);
return View::make('stocks.edit', compact('stock'));
}
示例5: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$this->stock->find($id)->delete();
return Redirect::route('stocks.index');
}
示例6: foreach
}
$stock->save();
$subscribers = Subscription::subscribers($stock);
foreach ($subscribers as $sub) {
$msg = "Stock Update\n{$stock->company}: {$stock->price}";
$sub->send($msg);
}
echo json_encode($stock);
break;
case 'stocks':
$stocks = Stock::findAll();
echo json_encode($stocks);
break;
case 'delete':
$company = Request::any('company');
$stock = Stock::find($company);
$stock->delete();
echo json_encode($stock);
break;
case 'subscribers':
$subscribers = Subscriber::findAll();
echo json_encode($subscribers);
break;
case 'send':
$msg = Request::any('message');
$recs = Subscriber::findAll();
foreach ($recs as $r) {
SMS::send($r->phone, $msg);
}
echo json_encode(["success" => true]);
break;