function add(array $request, $lead_id) { DB::beginTransaction(); try { $application_id = Application::select('id')->where('ex_lead_id', $lead_id)->first()->id; /* For each applicant */ foreach ($request['title'] as $key => $title) { if (!isset($request['applicant_id'][$key])) { $applicant_id = $this->addApplicant($request, $key, $application_id); } else { $applicant_id = $request['applicant_id'][$key]; $this->editApplicant($request, $key, $applicant_id); } /* Contact Details */ $this->addPhoneDetails($request, $key, $applicant_id); /* Add code here for additional phones */ /* Address Details */ $this->addAddressDetails($request, $key, $applicant_id); } DB::commit(); return true; } catch (\Exception $e) { DB::rollback(); dd($e); return false; } }
function assign(array $request, $application_id) { DB::beginTransaction(); try { $application = Application::find($application_id); ApplicationLender::create(['description' => $request['description'], 'lender_id' => $request['lender_id'], 'application_id' => $application_id, 'status' => 0]); $application->submitted = 1; $application->save(); DB::commit(); return true; } catch (\Exception $e) { DB::rollback(); dd($e); return false; } }
function assign(array $request, $application_id) { DB::beginTransaction(); try { $application = Application::find($application_id); ApplicationAssign::create(['description' => $request['description'], 'assign_to' => $request['assign_to'], 'application_id' => $application_id, 'status' => 0, 'assigned_date' => get_today_datetime(), 'assigned_by' => \Auth::user()->id]); $application->submitted = 1; $application->save(); $this->changeStatus($application_id, 2); DB::commit(); return true; } catch (\Exception $e) { DB::rollback(); dd($e); return false; } }
function edit() { $application_id = $this->request->route('id'); $data['application'] = Application::where('id', $application_id)->with('loan')->first(); $users = User::select('id', 'email')->get()->toArray(); $data['users'][0] = 'Select user'; foreach ($users as $user) { $data['users'][$user['id']] = $user['email']; } $clients = Client::select('id', 'preferred_name', 'given_name', 'surname')->get(); $data['clients'][0] = 'Select Client'; foreach ($clients as $client) { $data['clients'][$client->id] = $client->preferred_name . ' ' . $client->given_name . ' ' . $client->surname; } return view('system.application.edit', $data); }