Ejemplo n.º 1
0
 function view()
 {
     $application_id = $this->request->route('id');
     $data['application_details'] = $application_details = $this->application->getApplicationViewDetails($application_id);
     $data['attachment'] = Attachment::where('lead_id', $data['application_details']->lead->id)->first();
     $data['statuses'] = Status::lists('name', 'id');
     $completed = array();
     foreach ($application_details->statuses as $key => $completed_stat) {
         $completed[$completed_stat->status_id]['id'] = $completed_stat->status_id;
         $completed[$completed_stat->status_id]['date_created'] = readable_date($completed_stat->date_created);
         $completed[$completed_stat->status_id]['updated_by'] = get_user_name($completed_stat->updated_by);
     }
     $data['completed'] = $completed;
     return view('system.application.overview.show', $data);
 }
Ejemplo n.º 2
0
 function downloadAttachment($id)
 {
     $attachment = Attachment::find($id);
     if (empty($attachment)) {
         abort(404);
     }
     $filename = $attachment->filename;
     $file = public_path() . "/resources/uploads/attachments/" . $filename;
     $headers = array('Content-Type: application/pdf');
     return Response::download($file);
 }
Ejemplo n.º 3
0
 function uploadAttachment($lead_id, $fileName)
 {
     //check if other attachment still exists
     $attachment = Attachment::where('lead_id', $lead_id)->first();
     if (!empty($attachment)) {
         //delete file if exists
         $destinationPath = 'resources/uploads/attachments/';
         // upload path
         unlink($destinationPath . $attachment->filename);
         $attachment->filename = $fileName;
         $attachment->uploaded_date = get_today_datetime();
         $attachment->added_by_users_id = \Auth::user()->id;
         $attachment->save();
     } else {
         Attachment::create(['filename' => $fileName, 'lead_id' => $lead_id, 'uploaded_date' => get_today_datetime(), 'added_by_users_id' => \Auth::user()->id]);
     }
 }