/**
  * Store a newly created resource in storage.
  *
  * @param Request $request
  * @return Response
  */
 public function store(Request $request)
 {
     $option = new Option();
     $option->default_expiry_date_for_featured = $request->input("default_expiry_date_for_featured");
     $option->hero_text = $request->input("hero_text");
     $option->hero_img_id = $request->input("hero_img_id");
     $option->default_mortgage_amount = $request->input("default_mortgage_amount");
     $option->default_mortgage_rate = $request->input("default_mortgage_rate");
     $option->save();
     return redirect()->route('options.index')->with('message', 'Item created successfully.');
 }
Esempio n. 2
0
 public function set($module, $name, $value)
 {
     $option = Option::where('module', $module)->where('option', $name)->first();
     if ($option != null) {
         $option->value = $value;
         $option->save();
     } else {
         $option = new Option();
         $option->module = $module;
         $option->option = $name;
         $option->value = $value;
         $option->save();
     }
 }
 public function addOpCat(Request $request)
 {
     $n = intval($request->nb_option);
     $tab = array();
     for ($i = 0; $i < $n; $i++) {
         $name = "name_option_" . $i;
         $desc = "description_option_" . $i;
         $option = new Option();
         $option->name = $request->{$name};
         $option->description = $request->{$desc};
         $option->category_id = $request->category_id;
         $option->save();
         $tab[$i] = $option->id;
     }
     return json_encode($tab);
     //$option->attachCategory($request->category_id);
 }