/** * Remove item from billing */ public function removeItemFromBilling($item_id) { $production_id = Session::get('production_id'); $remove = ProductionItem::where('production_id', '=', $production_id)->where('item_id', '=', $item_id)->delete(); return Response::json(['response' => '200', 'msg' => 'Success']); }
use Carbon\Carbon; /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the Closure to execute when that URI is requested. | */ /* Sample routes */ Route::get('f**k', function () { return (new ProductionItem())->getUnsoldItems(); return Carbon::now()->addDays(2); return $item = ProductionItem::where('production_id', '=', '215')->where('item_id', '=', '10037')->where('status', '=', "pending")->first()->id; return ReportsController::generateSalesByRange(); return View::make('hello'); return Auth::user()->username; return PDF::loadView('items.barcodes')->setPaper('a6')->setOrientation('landscape')->setWarnings(false)->stream('barcodes.pdf'); }); Route::get('tt', function () { return Session::get('REGISTER'); $item = Item::all(); return PDF::loadView('items.barcodes')->setPaper('a6')->setOrientation('landscape')->setWarnings(false)->stream('barcodes.pdf'); $prod = new ProductionItem(); $pending = $prod->getPendingItems(); $prod_items = $prod->getCurrentProductionsItemId(); // return $pending[0]->remaining; foreach ($pending as $item) { print $item->item_id . " ";
Route::filter('isProductionOpen', function () { if (Session::has('REGISTER') && Session::get('PRODUCTION') == 'CLOSE') { return "Production is closed for this moment."; } }); Route::filter('checkProductionsList', function () { //check if there are existing items to be baked $count = ProductionItem::where('status', '=', 'pending')->count(); if ($count > 0) { //redirect to the baking stage return Redirect::route('productions.billing')->with('flash_message', 'You have a pending items to be processed.')->with('flash_type', 'alert alert-info'); } }); Route::filter('isThereItemToBeCooked', function () { //check if there are pending items to be cooked $count = ProductionItem::where('status', '=', 'pending')->count(); if ($count < 1) { //no items to be cooked, so back to productions return Redirect::route('productions.produce')->with('flash_message', 'There are no items to be cooked. Please select here.')->with('flash_type', 'alert alert-info'); } }); /* |-------------------------------------------------------------------------- | Guest Filter |-------------------------------------------------------------------------- | | The "guest" filter is the counterpart of the authentication filters as | it simply checks that the current user is not logged in. A redirect | response will be issued if they are, which you may freely change. | */