function changeStatus($application_id, $status) { ApplicationStatus::create(['status_id' => $status, 'date_created' => get_today_datetime(), 'application_id' => $application_id, 'updated_by' => current_user_id()]); }
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]); } }