/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Location $location, Request $request)
 {
     //
     $data = $request->all();
     $data['created_by'] = \Auth::user()->id;
     $data['updated_by'] = \Auth::user()->id;
     $data['is_active'] = 1;
     $location->fill($data)->save();
     return Redirect::route('locations.index');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function getStore($id = null)
 {
     if ($id) {
         $location = Location::find($id);
         if (!$location) {
             return response()->json(JSend::fail(['Data not found'])->encode());
         }
     } else {
         $location = new Location();
     }
     //
     $location->fill(Input::all());
     if ($location->save()) {
         return response()->json(JSend::success($location->toArray())->encode());
     } else {
         return response()->json(JSend::fail($location->getErrors()->toArray())->encode());
     }
 }