/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //
     $resturant = new Resturant();
     $request_data = $request->input('request');
     $parsed_object = json_decode($request_data, true);
     $resturant->name = $parsed_object['name'];
     $resturant->address = $parsed_object['address'];
     $resturant->phone = $parsed_object['phone'];
     $resturant->email = $parsed_object['email'];
     $resturant->subscription_plan_id = $parsed_object['plan'];
     $resturant->save();
     $user = new User();
     $user->email = $parsed_object['email'];
     $hashed_password = Hash::make($parsed_object['password']);
     $user->password = $hashed_password;
     $user->resturant_id = $resturant->id;
     $user->role_id = 1;
     $user->active = 0;
     $user->activation_token = str_random(32);
     $user->fullname = $parsed_object['name'];
     $user->phone = $parsed_object['phone'];
     $user->save();
     \Event::fire(new registrationEmail($user));
     return response()->json(["Response" => "success"]);
 }