/**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit(Chart $chart, Request $request)
 {
     $config = json_decode($chart->config);
     if ($request->ajax()) {
         return response()->json($config);
     } else {
         $data = new \StdClass();
         $data->variables = Variable::with('Dataset')->get();
         $data->categories = DatasetCategory::all();
         $data->subcategories = DatasetSubcategory::all();
         $data->chartTypes = ChartType::lists('name', 'id');
         $logoUrl = Setting::where('meta_name', 'logoUrl')->first();
         $data->logoUrl = !empty($logoUrl) ? url('/') . '/' . $logoUrl->meta_value : '';
         return view('charts.edit', compact('chart'))->with('data', $data);
     }
 }