/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     // Get request inputs
     $txtBackgroundName = $request->input('txtBackgroundName');
     $hexBackgroundColor = $request->input('hexBackgroundColor');
     $data = array('txtBackgroundName' => $txtBackgroundName);
     $rules = array('txtBackgroundName' => 'required|min:1|max:40|unique:background,name');
     // Validate inputs
     $reponse = Helper::validator($data, $rules, 'dashboard.settings.backgrounds.index');
     if (isset($reponse)) {
         return $reponse;
     }
     // Create new background
     $background = new Background();
     $background->name = $txtBackgroundName;
     // Upload image 1
     $imageInput = Input::file('filBackgroundImage');
     if ($imageInput != null) {
         $imagePath = Media::processMedia($imageInput, 'advert_backgrounds/');
         // If we have a valid image then set the path in the database
         if ($imagePath != null) {
             $background->image_path = $imagePath;
         }
     }
     $background->hex_colour = $hexBackgroundColor;
     $background->save();
     // Update
     return redirect()->route('dashboard.settings.backgrounds.index')->with('message', 'Background created successfully');
 }