public function getEdit($id) { try { $plan = Plan::with('limit')->findOrFail($id); if ($plan->policy_type == 'PolicySchema') { $plan->schema_id = $plan->policy_id; unset($plan->policy_id); } if ($plan->plan_type == 1) { $limits = ['limit_type', 'time_limit', 'time_unit', 'data_limit', 'data_unit', 'aq_access', 'aq_policy']; foreach ($limits as $limit) { $plan->{$limit} = $plan->limit->{$limit}; } $plan->limit_id = $plan->limit->id; } $policies = Policy::lists('name', 'id'); $schemas = PolicySchema::lists('name', 'id'); return View::make('admin.plans.add-edit', ['policies' => $policies, 'schemas' => $schemas])->with('plan', $plan); } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) { App::abort(404); } }
public function getRecharge() { $plans = Plan::with('limit')->paginate(10); return View::make('user.prepaid.recharge')->with('plans', $plans); }