/**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit(Dataset $dataset)
 {
     $datasources = Datasource::lists('name', 'id');
     $categories = DatasetCategory::all()->lists('name', 'id');
     $subcategories = DatasetSubcategory::all()->lists('name', 'id');
     return view('datasets.edit', compact('dataset', 'categories', 'subcategories', 'datasources'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $datasets = Dataset::all();
     $datasources = Datasource::all();
     $variables = Variable::all();
     $categories = DatasetCategory::all();
     $subcategories = DatasetSubcategory::all();
     $varTypes = VariableType::all();
     $sourceTemplate = Setting::where('meta_name', 'sourceTemplate')->first();
     $data = ['datasets' => $datasets, 'datasources' => $datasources, 'variables' => $variables, 'categories' => $categories, 'subcategories' => $subcategories, 'varTypes' => $varTypes, 'sourceTemplate' => $sourceTemplate];
     $response = view('import.index')->with('data', $data);
     return $response;
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     /*$variable = Variable::find( 1 );
     		$data = [
     			new DataValue( [ 'value' => 'fads', 'description' => 'Description 1', 'fk_input_files_id' => 1 ] ),
     			new DataValue( [ 'value' => 'adsf', 'description' => 'Description 2', 'fk_input_files_id' => 1 ] ) 
     		];
     		$variable->saveData( $data );*/
     $datasets = Dataset::all();
     $datasources = Datasource::all();
     $variables = Variable::all();
     $categories = DatasetCategory::all();
     $subcategories = DatasetSubcategory::all();
     $varTypes = VariableType::all();
     $data = ['datasets' => $datasets, 'datasources' => $datasources, 'variables' => $variables, 'categories' => $categories, 'subcategories' => $subcategories, 'varTypes' => $varTypes];
     return view('import.index')->with('data', $data);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy(DatasetSubcategory $subcategory)
 {
     //delete itself
     $subcategory->delete();
     return redirect()->route('categories.show', $subcategory->fk_dst_cat_id)->with('message', 'Subcategory deleted.');
 }
 /**
  * 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);
     }
 }