/**
  * Store a newly created account in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function register(Request $request)
 {
     $token = rand(0, 1000) . uniqid();
     $exist = Contributor::whereUsername($request->input('username'))->orWhere('email', '=', $request->input('email'))->first();
     if (count($exist)) {
         return response()->json(['request_id' => uniqid(), 'status' => 'exist', 'message' => 'Username or Email is already exist', 'timestamp' => Carbon::now()], 400);
     } else {
         $contributor = Contributor::create(['name' => $request->input('name'), 'username' => $request->input('username'), 'email' => $request->input('email'), 'password' => bcrypt($request->input('password')), 'token' => $token, 'api_token' => str_random(60), 'vendor' => 'mobile']);
         Activity::create(['contributor_id' => $contributor->id, 'activity' => Activity::registerActivity($contributor->username, 'mobile')]);
         $this->sendingActivationEmail($contributor);
         $this->sendAdminContributorNotification($contributor);
         return response()->json(['request_id' => uniqid(), 'status' => 'success', 'message' => 'Registering user is success', 'timestamp' => Carbon::now()], 200);
     }
 }
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array $data
  * @param $token
  * @return User
  */
 protected function create(array $data, $token)
 {
     return Contributor::create(['name' => $data['username'], 'username' => $data['username'], 'email' => $data['email'], 'password' => bcrypt($data['password']), 'token' => $token, 'api_token' => str_random(60), 'vendor' => 'web']);
 }