/**
  * Show us the contacts filtered by customers and name
  */
 public function existContact()
 {
     $filterId = Input::get('customerId');
     $filter = Input::get('name');
     $filter = ['customer_id' => $filterId, 'name' => $filter];
     $result = Contact::where($filter)->limit(1)->get(['id']);
     return Response::json(array('exist' => $result->count() > 0));
 }
 /**
  * Show the application welcome screen to the user.
  *
  * @return Response
  */
 public function index()
 {
     $actif = 0;
     $preference = Preference::first();
     $notes = Note::where('etat', 1)->orderBy('created_at', 'desc')->paginate(5);
     $contacts = Contact::where('etat', 1)->orderBy('created_at', 'desc')->paginate(5);
     $societes = Societe::where('etat', 1)->orderBy('created_at', 'desc')->paginate(5);
     $devis = Devis::where('etat_devis', 1)->orderBy('created_at', 'desc')->paginate(5);
     return view('accueil', compact('actif', 'preference', 'notes', 'contacts', 'societes', 'devis'));
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $contact = Contact::find($id);
     if (is_null($contact)) {
         return response()->json(['error' => 'No contact found with ID ' . $id], 404);
     }
     $contact->fill($request->all());
     $contact->save();
     $contact = Contact::where('id', $contact->id)->with('files')->first();
     return $contact;
 }
 private function processBounces($bounces)
 {
     foreach ($bounces as $bounce) {
         $email = $bounce->address;
         $contact = Contact::where('email', '=', $email)->where('bounced', '=', 0)->first();
         if ($contact) {
             $contact->bounced = true;
             $contact->save();
             $this->count += 1;
         }
     }
 }
示例#5
0
 protected function editPassword() {
     
     $authUserId = \Auth::id();
     
     $authContact = Contact::where('userId','=',$authUserId)->first();
     
     $employeeData = [
         'contactId' => $authContact->id,
         'userId'    => $authUserId
     ];
     
     return view('customer_edit_pass', $employeeData);
 }
 /**
  * create Contact
  *
  * @param  Business            $business Business that holds the addressbook
  *                                       for Contact
  * @param  AlterContactRequest $request  Request for Altering Contact
  * @return Response                      Rendered form for Contact creation
  */
 public function create(Business $business, AlterContactRequest $request)
 {
     $this->log->info('BusinessContactController: create');
     $existing_contact = Contact::where(['email' => auth()->user()->email])->get()->first();
     if ($existing_contact !== null && !$existing_contact->isSubscribedTo($business)) {
         $this->log->info("BusinessContactController: create: [ADVICE] Found existing contact contactId:{$existing_contact->id}");
         $business->contacts()->attach($existing_contact);
         $business->save();
         Flash::success(trans('user.contacts.msg.store.associated_existing_contact'));
         return redirect()->route('user.business.contact.show', [$business, $existing_contact]);
     }
     return view('user.contacts.create', compact('business'));
 }
 private function updateContacts($user, $contacts, $upd)
 {
     if ($upd) {
         $deletedRows = Contact::where('user_id', $user->id)->delete();
     }
     if ($contacts != null) {
         $arr = array();
         foreach ($contacts as $contact) {
             $cntToAdd = new Contact();
             $cntToAdd->contact = $contact;
             array_push($arr, $cntToAdd);
         }
         $user->contacts()->saveMany($arr);
     }
 }
 public function edit()
 {
     $user = User::findOrFail(Auth::user()->id);
     $entity = Entity::where('user_id', Auth::user()->id)->firstOrFail();
     $about = About::where('user_id', Auth::user()->id)->firstOrFail();
     $contact = Contact::where('user_id', Auth::user()->id)->firstOrFail();
     $home = Home::where('user_id', Auth::user()->id)->firstOrFail();
     $quote = Quote::where('user_id', Auth::user()->id)->get();
     $quote_count = $quote->count();
     $skill = Skill::where('user_id', Auth::user()->id)->get();
     $skill_count = $skill->count();
     $skill_slider = SkillSlider::where('user_id', Auth::user()->id)->get();
     $skill_slider_count = $skill_slider->count();
     $portfolio_piece = PortfolioPiece::where('user_id', Auth::user()->id)->get();
     $portfolio_piece_count = $portfolio_piece->count();
     return view('edit')->with('user', $user)->with('home', $home)->with('entity', $entity)->with('contact', $contact)->with('about', $about)->with('skill', $skill)->with('skill_count', $skill_count)->with('quote', $quote)->with('quote_count', $quote_count)->with('skill_slider', $skill_slider)->with('skill_slider_count', $skill_slider_count)->with('portfolio_piece', $portfolio_piece)->with('portfolio_piece_count', $portfolio_piece_count);
 }
示例#9
0
 /**
  * 设置默认联系人
  * @param int $id 客户公司id
  * @param int $pid 联系人ID
  * @return mixed
  * @author AndyLee <*****@*****.**>
  */
 public function getSetDefaultContact($id, $pid)
 {
     $map = ['id' => $pid, 'company_id' => Session::get('customer_id')];
     try {
         $record = Contact::where($map)->findOrFail($pid);
     } catch (ModelNotFoundException $e) {
         Session::flash('error', '记录不存在');
         return redirect()->back();
     }
     $contacts = Contact::where('company_id', Session::get('customer_id'))->get();
     foreach ($contacts as $contact) {
         $contact->is_default = 0;
         $contact->save();
     }
     $record->is_default = 1;
     $record->save();
     Session::flash('success', '设置默认联系人成功');
     return redirect()->back();
 }
示例#10
0
 public function store(Request $request)
 {
     $iletisim = Contact::where('user_id', Auth::user()->id)->first();
     if ($iletisim) {
     } else {
         $iletisim = new Contact();
     }
     $iletisim->adres = $request->adres;
     $iletisim->telefon = $request->telefon;
     $iletisim->fax = $request->fax;
     $iletisim->location = $request->location;
     $iletisim->facebook = $request->facebook;
     $iletisim->email = $request->email;
     $iletisim->twitter = $request->twitter;
     $iletisim->youtube = $request->youtube;
     $iletisim->user_id = Auth::user()->id;
     $iletisim->save();
     flash('Güncelleme işlemi başarıyla gercekleşti.', 'info');
     return redirect()->back();
 }
 public function updateContact()
 {
     $user = User::find(Auth::user()->id);
     $contact = Contact::where('user_id', Auth::user()->id)->firstOrFail();
     $entity = Entity::where('user_id', Auth::user()->id)->firstOrFail();
     if (isset($user) && $contact != NULL) {
         if (Input::get('first_title') != '') {
             $contact->first_title = Input::get('first_title');
         }
         if (Input::get('first_caption') != '') {
             $contact->first_caption = Input::get('first_caption');
         }
         if (Input::get('second_title') != '') {
             $contact->second_title = Input::get('second_title');
         }
         if (Input::get('second_caption') != '') {
             $contact->second_caption = Input::get('second_caption');
         }
         if (Input::get('email') != '') {
             $entity->email = Input::get('email');
         }
         if (Input::get('phone') != '') {
             $contact->phone = Input::get('phone');
         }
         if (Input::get('address') != '') {
             $contact->address = Input::get('address');
         }
         if (Input::get('extra_1') != '') {
             $contact->extra_1 = Input::get('extra_1');
         }
         if (Input::get('extra_2') != '') {
             $contact->extra_2 = Input::get('extra_2');
         }
         $entity->save();
         $contact->save();
         return redirect('home')->with('status', 'success');
     } else {
         return 'An error has occured';
     }
 }
 public function report($id)
 {
     $campaign = Campaign::find($id);
     $summary = [];
     $actions = Action::with('contact')->forCampaign($campaign)->orderBy('contact_id')->get();
     $summary['total_sent'] = $campaign->emails->count();
     $summary['opened'] = $actions->filter(function ($action) {
         return $action->action === 'opened';
     })->count();
     $summary['more info'] = $actions->filter(function ($action) {
         return $action->action === 'more info';
     })->count();
     $summary['website_visits'] = $actions->filter(function ($action) {
         return $action->action === 'website';
     })->count();
     $summary['skipped_video'] = $actions->filter(function ($action) {
         return $action->action === 'skipped';
     })->count();
     $summary['emailed_bill'] = $actions->filter(function ($action) {
         return $action->action === 'email';
     })->count();
     $summary['youtube_channel'] = $actions->filter(function ($action) {
         return $action->action === 'youtube';
     })->count();
     $summary['unsubscribed'] = Contact::where('unsubscribe', '=', 1)->count();
     \Excel::create('Report', function ($excel) use($actions, $summary, $campaign) {
         $excel->setTitle("eMail Report for {$campaign->name}")->setCreator('Exhibit Partners Mailer Service')->setCompany('Exhibit Partners')->setDescription("A detailed report of email recipients for the {$campaign->name} email campaign");
         $excel->sheet('Summary', function ($sheet) use($summary) {
             $sheet->row(1, ['Total', 'Opened', 'Went To Page 2', 'Website Visits', 'Skipped The Video', 'Emailed Bill', 'YouTube Channel', 'Unsubscribed']);
             $sheet->row(2, [$summary['total_sent'], $summary['opened'], $summary['more info'], $summary['website_visits'], $summary['skipped_video'], $summary['emailed_bill'], $summary['youtube_channel'], $summary['unsubscribed']]);
         });
         $excel->sheet('Recipient Actions', function ($sheet) use($actions) {
             $sheet->row(1, ['Contact', 'Email', 'Action']);
             foreach ($actions as $key => $action) {
                 $sheet->row($key + 2, [$action->contact->name, $action->contact->email, $action->action]);
             }
         });
     })->download('xlsx');
 }
 /**
  * Send email message to the specified contact.
  *
  * @param  Request  $request
  * @return Response
  */
 public function send(Request $request)
 {
     //get user input
     $messageContent = $request->input('message');
     $contactId = $request->input('contactId');
     //validate user input
     $v = $this->validateInput($request);
     //if validation fails redirect user to page with validation errors
     if ($v->fails()) {
         return redirect()->back()->withErrors($v->errors());
     } else {
         //find contact by id
         $contact = Contact::where('user_id', '=', Auth::user()->id)->find($contactId);
         // check if contact exists
         /*security measure from POST injection attacks
           regular user is unable to generate such request without POST form injection
           unless other person logged in as the same user deleted contact while first user was composing message
           this shows error message in such case*/
         if ($contact == null) {
             //if it doesnt exist goto contact list with not found error
             return redirect()->action('ContactsController@index')->with('error', 'Podany kontakt nie istnieje');
         } else {
             //send welcome email message to user mailbox
             // Mail::send('emails.message', ['message' => $message], function ($m) use ($message) {
             //     $m->to($contact->email)->subject('Wiadomość prywatna');
             // });
             $user = Auth::user();
             $data = array('contactFirstName' => $contact->first_name, 'contactLastName' => $contact->first_name, 'contactEmail' => $contact->email, 'userFirstName' => $user->first_name, 'userLastName' => $user->last_name, 'userEmail' => $user->email, 'message' => $messageContent);
             //queue message to shorten application response time
             Mail::queue('emails.message', ['data' => $data], function ($m) use($data) {
                 $m->to($data['contactEmail'])->from('*****@*****.**', 'Zespół Contacto')->subject('Prywatna wiadomość od ' . $data['userEmail']);
             });
             //return to contacts view
             return redirect()->action('ContactsController@index')->with('status', 'Wysłano wiadomość do ' . $contact->email);
         }
     }
 }
 public function traitementSubmitAvisEtudiant($id)
 {
     // Viens de la vue choix du stagiaire
     if (Request::get('idStagiaire') != null) {
         session(['idEtudiantFocus' => Request::get('idStagiaire')]);
         return view('tuteurEntreprise.fiche')->with(['id' => $id, 'data' => $this->dataToAvisStagiaire()]);
     } else {
         $stage = Stage::where('idEtudiant', session('idEtudiantFocus'))->first();
         $stage->niveauConnaissance = Request::get('niveauConnaissance');
         $stage->niveauOrganisation = Request::get('niveauOrganisation');
         $stage->niveauInitiative = Request::get('niveauInitiative');
         $stage->niveauPerseverance = Request::get('niveauPerseverance');
         $stage->niveauEfficacite = Request::get('niveauEfficacite');
         $stage->niveauInteret = Request::get('niveauInteret');
         $stage->niveauPresentation = Request::get('niveauPresentation');
         $stage->niveauPonctualite = Request::get('niveauPonctualite');
         $stage->niveauAssiduite = Request::get('niveauAssiduite');
         $stage->niveauExpression = Request::get('niveauExpression');
         $stage->niveauSociabilite = Request::get('niveauSociabilite');
         $stage->niveauCommunication = Request::get('niveauCommunication');
         $stage->embaucheEtudiant = Request::get('embaucheEtudiant');
         $stage->embauchePourquoi = Request::get('embauchePourquoi');
         $stage->tuteurPresentSoutenance = Request::get('presentSoutenance');
         $stage->save();
         $tuteur = Tuteur::where('idUtilisateur', $stage->idTuteur)->first();
         $contactRH = Contact::where('idEntreprise', $tuteur->idEntreprise)->where('type', 1);
         if ($contactRH->count() == 0) {
             $contactRH = new Contact(['idEntreprise' => $tuteur->idEntreprise, 'type' => 1, 'nom' => Request::get('nomRH'), 'email' => Request::get('emailRH'), 'telephone' => Request::get('telRH')]);
         } else {
             $contactRH = $contactRH->first();
             $contactRH->nom = Request::get('nomRH');
             $contactRH->email = Request::get('emailRH');
             $contactRH->telephone = Request::get('telRH');
         }
         $contactTA = Contact::where('idEntreprise', $tuteur->idEntreprise)->where('type', 2);
         if ($contactTA->count() == 0) {
             $contactTA = new Contact(['idEntreprise' => $tuteur->idEntreprise, 'type' => 2, 'nom' => Request::get('nomTA'), 'email' => Request::get('emailTA'), 'telephone' => Request::get('telTA')]);
         } else {
             $contactTA = $contactTA->first();
             $contactTA->nom = Request::get('nomTA');
             $contactTA->email = Request::get('emailTA');
             $contactTA->telephone = Request::get('telTA');
         }
         $contactRE = Contact::where('idEntreprise', $tuteur->idEntreprise)->where('type', 3);
         if ($contactRE->count() == 0) {
             $contactRE = new Contact(['idEntreprise' => $tuteur->idEntreprise, 'type' => 3, 'nom' => Request::get('nomRE'), 'email' => Request::get('emailRE'), 'telephone' => Request::get('telRE')]);
         } else {
             $contactRE = $contactRE->first();
             $contactRE->nom = Request::get('nomRE');
             $contactRE->email = Request::get('emailRE');
             $contactRE->telephone = Request::get('telRE');
         }
         $contactRH->save();
         $contactTA->save();
         $contactRE->save();
         session()->forget('idEtudiantFocus');
         session()->flash('success', 'success');
         return redirect()->route('ficheTuteurEntre', ['id' => $id]);
     }
 }
示例#15
0
 public function getDefaultContact()
 {
     return Contact::where('company_id', $this->id)->where('is_default', 1)->first();
 }
示例#16
0
 /**
  * Список моих контактов
  */
 public function userList($user_id)
 {
     $user = \App\User::findOrFail($user_id);
     return view('contact/index')->with(['page_title' => 'Контакты - ' . $user->name, 'contacts' => \App\Contact::where('taken_by', '=', intval($user_id))->orderBy('status')->get()]);
 }
示例#17
0
    protected function editPassword() {
        
        if ( \Auth::user() ) {
            
            $userTypeID = \Auth::user()->userTypeId;
            
            if ( $userTypeID == 3 ) {
            
                $authUserId = \Auth::id();
        
                $authContact = Contact::where('userId','=',$authUserId)->first();

                $employeeData = [
                    'contactId' => $authContact->id,
                    'userId'    => $authUserId
                ];

                return view('customer_edit_pass', $employeeData);

            } else {

                return Redirect::to('/portal-settings');

            }
            
        } else {
            
            return Redirect::to('/');
            
        }
        
    }
示例#18
0
 /**
  * Return Contact Sort to View.
  *
  * @param  int  $id
  * @return Response
  */
 public function TriContact($tripar)
 {
     //
     $actif = 'contact';
     $type = 1;
     if ($tripar == 'pays') {
         $contact = DB::table('contacts')->leftjoin('societes', 'contacts.societe_id', '=', 'societes.id')->orderBy('societes.pays_clt', 'asc')->where('contacts.etat', 1)->get();
         $tri = 'pays';
     } elseif ($tripar == 'notes') {
         $contact = Contact::where('etat', 1)->orderBy('pays_clt', 'asc')->get();
         $tri = 'notes';
     } elseif ($tripar == 'groupe') {
         $contact = DB::table('contacts')->leftjoin('groupes', 'contacts.groupe_id', '=', 'groupes.id')->leftjoin('societes', 'contacts.societe_id', '=', 'societes.id')->orderBy('groupes.nom_groupe', 'asc')->where('contacts.etat', 1)->get();
         $tri = 'groupe';
         dd($contact);
     } elseif ($tripar == 'ajout') {
         $contact = Contact::where('etat', 1)->orderBy('created_at', 'desc')->get();
         $tri = 'ajout';
     } elseif ($tripar == 'modification') {
         $contact = Contact::where('etat', 1)->orderBy('updated_at', 'desc')->get();
         $tri = 'modif';
     } elseif ($tripar == 'alpha') {
         $contact = Contact::where('etat', 1)->orderBy('nom_contact', 'desc')->get();
         $tri = 'alpha';
     } elseif ($tripar == 'client') {
         $contact = Contact::where('etat', 1)->orderBy('nom_contact', 'asc')->get();
         $tri = 'client';
     }
     return view('contact.contact', compact('actif', 'contact', 'type', 'tri'));
 }
示例#19
0
 public function getContact($id)
 {
     return Contact::where('id', $id)->with('addresses.phones')->get();
 }
示例#20
0
 public function getView(Request $request)
 {
     $contact = Contact::where('id', $request->id)->first();
     return response()->json($contact);
 }
 public function dataToCompteRenduVisite()
 {
     $data = [];
     $stage = Stage::where('idEtudiant', session('idEtudiantFocus'))->first();
     $entreprise = [];
     $contact = [];
     if (count($stage) > 0) {
         $tuteur = Tuteur::where('idUtilisateur', $stage->idTuteur)->first();
         if (count($tuteur) > 0) {
             $entreprise = Entreprise::where('id', $tuteur->idEntreprise)->first();
             if (count($entreprise) > 0) {
                 $contact = Contact::where('idEntreprise', $entreprise->id)->where('type', 1)->first();
             }
         }
     }
     if (count($entreprise) == 0) {
         $entreprise = new Entreprise();
     }
     $data['entreprise'] = $entreprise;
     if (count($stage) == 0) {
         $stage = new Stage();
     }
     $data['stage'] = $stage;
     if (count($contact) == 0) {
         $contact = new Contact();
     }
     $data['contact'] = $contact;
     // dd($entreprise);
     return $data;
 }
 public function addCustomer()
 {
     try {
         $user = Auth::User();
         //check if contact already exist or not
         $contact = Contact::where('network_id', Input::get('network_id'))->where('network', Input::get('network'))->first();
         if (empty($contact->id)) {
             $contact = new Contact();
         }
         $contact->network_id = Input::get('network_id');
         $contact->network = Input::get('network');
         $contact->name = Input::get('name');
         $contact->screen_name = Input::get('screen_name');
         $contact->image = Input::get('image');
         $contact->save();
         $contact->user()->attach($user->id);
         echo "success";
     } catch (Exception $e) {
         echo "error";
     }
     die;
 }
示例#23
0
 public static function contact($idEntreprise)
 {
     $contact = Contact::where('idEntreprise', $idEntreprise)->orderBy('type')->get();
     return $contact;
 }
示例#24
0
 protected function insertFromExcel($worksheet, $authenticated_user)
 {
     foreach ($worksheet as $row) {
         $data = array();
         $data['first_name'] = $row[0];
         $data['last_name'] = $row[1];
         $data['email'] = $row[2];
         $data['primary'] = $row[3] == 'true';
         $data['phone_number'] = $row[4];
         $contact = Contact::where(['first_name' => $data['first_name'], 'last_name' => $data['last_name'], 'user_id' => $authenticated_user->id]);
         if ($contact->exists()) {
             $contact = $contact->first();
         } else {
             $contact = Contact::create(['first_name' => $data['first_name'], 'last_name' => $data['last_name'], 'user_id' => $authenticated_user->id]);
         }
         if (isset($data['email']) && trim($data['email']) !== '') {
             ContactEmail::create(['contact_id' => $contact->id, 'email' => $data['email'], 'primary' => $data['primary']]);
         }
         if (isset($data['phone_number']) && trim($data['phone_number']) !== '') {
             ContactNumber::create(['contact_id' => $contact->id, 'phone_number' => $data['phone_number']]);
         }
     }
 }
示例#25
0
 /**
  * All messages from one user.
  *
  * @param  int  $id
  * @return Response
  */
 public function contact($id)
 {
     $contact = Contact::where('id', $id)->first();
     $contact->read = 1;
     $contact->save();
     return view('admin.contact', compact('contact'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $user = Auth::user();
     return Contact::where('user_id', $user->id)->get();
 }
示例#27
0
 /**
  * TODO: Review the logic of this method.
  *       The method may return true even when no Contacts were found
  *       Should return the Contact Collection that were associated
  * 
  * Link to Contacts
  * 
  * @return boolean The User was linked to at least one Contact
  */
 public function linkToContacts()
 {
     if (trim($this->email) == '') {
         return false;
     }
     $contacts = Contact::where(['email' => $this->email])->whereNotNull('email')->whereNull('user_id')->get();
     foreach ($contacts as $contact) {
         $contact->user()->associate($this)->save();
     }
     return true;
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $contact = Contact::where('user_id', '=', Auth::user()->id)->where('id', '=', $id)->firstOrFail();
     if ($this->deleteActiveContact($contact->active_id)) {
         $contact->delete();
         return response()->json(['responseText' => 'Success!'], 200);
     } else {
         return response()->json(['responseText' => 'Failure.'], 422);
     }
 }
 private function updateContactsCount()
 {
     //Store number of contacts in session so its accessible across the site, in every view (my invention)
     //Need to call this every time contact is added or deleted
     $contactCount = Contact::where('user_id', Auth::user()->id)->count();
     Session::put('contactCount', $contactCount);
 }
示例#30
0
 /**
  * 列出客户公司信息
  * @param integer $id
  * @return mixed
  * @author AndyLee <*****@*****.**>
  */
 public function getCustomerCompanyInfo($id)
 {
     //       dd( action('PartnerController@getPartner' , 12));
     $contact = Contact::where(['company_id' => Session::get('customer_id'), 'is_default' => 1])->first();
     $type = Config::get('customer.certificate');
     $result = [];
     /**
      * 查询不同的证件上传情况
      */
     foreach ($type as $k => $v) {
         $record = Certificate::where(['company_id' => Session::get('customer_id'), 'certificate_type' => $k])->first();
         if ($record) {
             $result[$k] = 'exist';
         } else {
             $result[$k] = 'empty';
         }
     }
     /**
      * 获取代办事项
      */
     $todo = App\Task::where(['company_id' => Session::get('customer_id'), 'is_finish' => 0])->take(10)->get();
     $company = Company::find(Session::get('customer_id'));
     return view('customer.index.detail')->with('contact', $contact)->with('result', $result)->with('todo', $todo)->with('company', $company);
 }