/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //
     $validator = Validator::make($request->all(), ['name' => array('required', 'regex:/^[\\d\\w\\.][\\d\\w\\s\\.]*[\\d\\w\\.]$/i')]);
     if ($validator->fails()) {
         return response()->json(["error" => "validator failed", "cause" => $validator->failed()], 400);
     } else {
         $subgroup = new Subgroup();
         $subgroup->name = $request->name;
         $subgroup->save();
         return response()->json($subgroup, 201);
     }
 }