本文整理汇总了PHP中app\Contact::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Contact::where方法的具体用法?PHP Contact::where怎么用?PHP Contact::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Contact
的用法示例。
在下文中一共展示了Contact::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: existContact
/**
* 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));
}
示例2: index
/**
* 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'));
}
示例3: update
/**
* 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;
}
示例4: processBounces
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: editPassword
protected function editPassword() {
$authUserId = \Auth::id();
$authContact = Contact::where('userId','=',$authUserId)->first();
$employeeData = [
'contactId' => $authContact->id,
'userId' => $authUserId
];
return view('customer_edit_pass', $employeeData);
}
示例6: create
/**
* 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'));
}
示例7: updateContacts
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);
}
}
示例8: edit
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: getSetDefaultContact
/**
* 设置默认联系人
* @param int $id 客户公司id
* @param int $pid 联系人ID
* @return mixed
* @author AndyLee <root@lostman.org>
*/
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: store
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();
}
示例11: updateContact
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';
}
}
示例12: report
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');
}
示例13: send
/**
* 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('message@laravel-kamilsos.c9.io', '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);
}
}
}
示例14: traitementSubmitAvisEtudiant
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: getDefaultContact
public function getDefaultContact()
{
return Contact::where('company_id', $this->id)->where('is_default', 1)->first();
}