/**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $input = Request::all();
     $input['user_id'] = Auth::User()->id;
     $validation = Project::validate($input);
     if ($validation->fails()) {
         $message = $validation->messages()->first();
         return Response()->json(ResponseManager::getError('', 10, $message));
     }
     $project = Project::create($input);
     if ($project) {
         //            if (array_key_exists('users', $input)) {
         //                foreach ($input['users'] as $user) {
         //                    $data = ['project_id' => $project['id'], 'user_id' => $user['id'], 'email' => $user['email']];
         //                    ProjectUser::create($data);
         //                    $email['email'] = $user['email'];
         //                    $email['user'] = $user['name'];
         //                    $email['msg'] = $input['message'];
         //                    $email['pname'] = $project['name'];
         //                    $email['code'] = base64_encode($email['email'] . '-' . $project['id']);
         //                    Mail::send('emails.invite', $email, function( $message ) use ($email) {
         //                        $message->to($email['email'])->subject(Auth::User()->name . ' want to add you to ' . $email['pname']);
         //                    });
         //                }
         //            }
         $message = 'Added Successfully.';
         return Response()->json(ResponseManager::getResult($project, 10, $message));
     } else {
         $message = 'Something went wrong. Please try again.';
         return Response()->json(ResponseManager::getError('', 10, $message));
     }
 }