Exemplo n.º 1
0
 function delete()
 {
     $lender_id = $this->request->route('id');
     ApplicationLender::where('lender_id', $lender_id)->delete();
     Lender::find($lender_id)->delete();
     return $this->success(['message' => 'Lender deleted Successfully']);
 }
Exemplo n.º 2
0
 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;
     }
 }
Exemplo n.º 3
0
 function dataAcceptedTablePagination(Request $request, $user_id)
 {
     $take = $request->input('length') > 0 ? $request->input('length') : 10;
     $start = $request->input('start') > 0 ? $request->input('start') : 0;
     $search = $request->input('search');
     $search = $search['value'];
     $order = $request->input('order');
     $column_id = $order[0]['column'];
     $columns = $request->input('columns');
     $orderColumn = $columns[$column_id]['data'];
     $orderdir = $order[0]['dir'];
     $lead = array();
     $adminquery = DB::table('applications as app')->join('ex_leads as leads', 'leads.id', '=', 'app.ex_lead_id')->join('ex_clients as clients', 'leads.ex_clients_id', '=', 'clients.id')->join('loans', 'loans.ex_leads_id', '=', 'leads.id')->join('application_assign as assign', 'assign.application_id', '=', 'app.id')->select('app.id', 'clients.given_name', 'clients.surname', 'clients.email', 'loans.amount', 'loans.loan_type', 'app.ex_lead_id as leadId')->where('app.submitted', 1)->where('assign.status', 1)->where('assign.assign_to', $user_id);
     $lead['total'] = $adminquery->count();
     $adminquery->skip($start)->take($take);
     $data = $adminquery->get();
     foreach ($data as $key => &$value) {
         $assigned_lender = ApplicationLender::where('application_id', $value->id)->first();
         if (empty($assigned_lender)) {
             $value->isAssigned = false;
             $value->assigned = "Not Assigned";
         } else {
             $value->isAssigned = false;
             $lender = Lender::select('company_name')->find($assigned_lender->lender_id);
             $value->assigned = $lender->company_name;
         }
         $value->client_name = $value->given_name . " " . $value->surname;
         $value->type = $value->loan_type;
     }
     $lead['data'] = $data;
     $json = new \stdClass();
     $json->draw = $request->input('draw') > 0 ? $request->input('draw') : 1;
     $json->recordsTotal = $lead['total'];
     $json->recordsFiltered = $lead['total'];
     $json->data = $lead['data'];
     return $json;
 }