public function previewContract($loan_id)
 {
     //  Is what I did last night?  I hope so, else I'm lost.
     $id = Auth::user()->id;
     $usermail = Auth::user()->email;
     $profile = UserProfile::where('id', '=', $id)->first();
     // Retreive from the DB details about loan, where loanid = input for function and user_id = id of person logged in.
     // This should return object.
     $loan = DB::table('loan_app')->select('amount', 'term', 'pref_rate', 'purpose', 'progress', 'loan_id', 'match_date')->where('user_id', '=', $id)->where('loan_id', '=', $loan_id)->orderBy('match_date', 'DESC')->first();
     // Run the getLenders function and store the returned value as $lenders.
     $lenders = $this->getLenders($loan_id);
     // If there is no value for lenders...
     if (empty($lenders)) {
         // fail and redirect somewhere else
         return Redirect::route('mytransaction')->with('message', 'Could not find lenders for this loan request');
     }
     $contract = Contract::firstOrNew(array('offer_id' => Input::get('offer_id', $loan_id)));
     if (!$contract->getAttribute('offer_id')) {
         return Redirect::to('mytransaction')->with('message', 'No dice!');
     }
     $success = null;
     $errors = array();
     if (Request::isMethod('post')) {
         // update contract record with new status
         if (Input::get('i_agree') !== null) {
             $contract->setAttribute('status', 'complete');
             if ($contract->save()) {
                 $success = 'Your contract was finalised';
             } else {
                 $errors[] = 'Your contract was not finalised';
             }
         }
     }
     $backurl = route('createContract', array($loan_id));
     return View::make('previewContract', compact('loan', 'profile', 'success', 'errors', 'contract', 'lenders', 'backurl'));
 }