public function show($memberId, $postingId)
 {
     /* 
      * This method is totally redundant (as it's a lookup by postingpromo id) 
      */
     $postingRecord = Promtion::findOrFail($postingId);
     return response()->json(['posting_promo' => $postingRecord]);
 }
Example #2
0
 public function reductionsFilter($types, $id)
 {
     $reductable_type = $types;
     $reduction_id = $id;
     $reductions = Reduction::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('reductable_type', '=', $reductable_type)->where('reductable_id', '=', $reduction_id)->get();
     switch ($reductable_type) {
         case 'Promotion':
             $discounts = Promotion::where('project_id', '=', Auth::user()->curr_project_id)->get();
             $discount = Promotion::find($reduction_id);
             break;
         case 'Voucher':
             $discounts = Voucher::where('project_id', '=', Auth::user()->curr_project_id)->get();
             $discount = Voucher::find($reduction_id);
             break;
         case 'Discount':
             $discounts = Discount::all();
             $discount = Discount::find($reduction_id);
             break;
         case 'Charge':
             $discounts = Charge::where('project_id', '=', Auth::user()->curr_project_id)->get();
             $discount = Charge::find($reduction_id);
             break;
         default:
             $discounts = Promotion::where('project_id', '=', Auth::user()->curr_project_id)->get();
             $discount = Promtion::find($reduction_id);
             break;
     }
     $menu = 'report';
     return View::make('reports.reductions', compact('reductable_type', 'reduction_id', 'reductions', 'discounts', 'discount', 'menu'));
 }