/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store()
 {
     //only 4
     exit;
     // validate
     // read more on validation at http://laravel.com/docs/validation
     //name', 'image', 'alt_image', 'position'
     $rules = ['name' => 'required', 'image' => 'required|mimes:jpeg,png|max:1000', 'alt_image' => 'required', 'position' => 'integer'];
     $validator = Validator::make(Input::all(), $rules);
     // process the login
     if ($validator->fails()) {
         \Session::flash('message', 'We encountered the following errors:');
         \Session::flash('alert-class', 'alert-danger');
         return \Redirect::to('admin/services/create')->withErrors($validator)->withInput(Input::except('password'));
     } else {
         // store
         $service = new Service();
         $service->name = Input::get('name');
         $service->alt_image = Input::get('alt_image');
         $service->position = Input::get('position');
         // image save to uploades folder
         if (Input::file('image')->isValid()) {
             $root = 'public/';
             $destinationPath = 'uploades/service/';
             // upload path
             $extension = Input::file('image')->getClientOriginalExtension();
             // getting image extension
             $filename = rand(11111, 99999) . '.' . $extension;
             // renameing image
             Input::file('image')->move($root . $destinationPath, $filename);
             // uploading file to given path
             // sending back with message
             // Session::flash('success', 'Upload successfully');
             $service->image = $destinationPath . $filename;
         }
         // end. image save to uploades folder
         $service->save();
         // redirect
         \Session::flash('message', 'Successfully created service!');
         return \Redirect::to('admin/services');
     }
 }