/**
  * Insert a new project
  * Return projects
  * @param Request $request
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function store(CreateProjectRequest $request)
 {
     $payer_email = $request->get('payer_email');
     //Check if the email is for a new payer, rather than a previous payer of the payee.
     //If it is, add the row to the payee_payer pivot table before creating the project.
     //Todo: If it is a new payer, do the appropriate validation errors
     //todo: (different for if the new payer email field is blank vs the previous payer input)
     if ($request->get('new_payer')) {
         Payee::addPayer($payer_email);
     }
     //Create the project
     return $this->projectsRepository->createProject($payer_email, $request->get('description'), $request->get('rate'));
 }
 /**
  * Add a new payer for the user (payee)
  * so that the user can create a project with that person as payer.
  * Return the user's payers
  *
  * Actually I've moved the method to the Payee model so I may not need it here at all.
  *
  * // @TODO Should be a PUT request to /users/{user}/payers/{payer} and return the payer object.
  *
  * @param Request $request
  * @return mixed
  */
 public function addPayer(Request $request)
 {
     $payer_email = $request->get('payer_email');
     return Payee::addPayer($payer_email);
 }