当前位置: 首页>>代码示例>>PHP>>正文


PHP Contact::findOrFail方法代码示例

本文整理汇总了PHP中app\Contact::findOrFail方法的典型用法代码示例。如果您正苦于以下问题:PHP Contact::findOrFail方法的具体用法?PHP Contact::findOrFail怎么用?PHP Contact::findOrFail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Contact的用法示例。


在下文中一共展示了Contact::findOrFail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  *
  * @return Response
  */
 public function update($id, Request $request)
 {
     $contact = Contact::findOrFail($id);
     $contact->update($request->all());
     Session::flash('flash_message', 'Contact updated!');
     return redirect('admin/contact');
 }
开发者ID:thibaultvanc,项目名称:organit,代码行数:14,代码来源:ContactController.php

示例2: noteContact

 public function noteContact($id, $back)
 {
     $notes = Note::where('etat', '1')->where('contact_id', $id)->orderBy('updated_at', 'desc')->paginate(15);
     $actif = 'notes';
     $contact = Contact::findOrFail($id);
     return view('notes.list-notes', compact('notes', 'back', 'actif', 'contact'));
 }
开发者ID:blackdavinci,项目名称:crm-ftz,代码行数:7,代码来源:NotesController.php

示例3: update

 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(ContactRequest $request, $id)
 {
     //
     $contact = Contact::findOrFail($id);
     $contact->update($request->all());
     return redirect('contacts');
 }
开发者ID:seahouse,项目名称:hxerp,代码行数:14,代码来源:ContactsController.php

示例4: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $contact = Contact::findOrFail($id);
     $contact->delete();
     Session::flash('message', 'Successfully Deleted your Data!');
     return redirect()->back();
 }
开发者ID:minhajCSE,项目名称:teleaus-dev,代码行数:13,代码来源:FeedbackController.php

示例5: update

 /**
  * 更新联系人使用频率
  *
  * @param $request
  * @param $id
  * @return mixed
  */
 public function update(Request $request, $id)
 {
     $contact = Contact::findOrFail($id);
     $contact->use_count += 1;
     if ($contact->save()) {
         return response()->json(['success' => true]);
     } else {
         return response()->json(['success' => false]);
     }
 }
开发者ID:supermason,项目名称:homestreward,代码行数:17,代码来源:ContactController.php

示例6: store

 /**
  * Добавить коммент
  *
  * @param  \Illuminate\Http\Request $request
  * @param                           $id
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request, $id)
 {
     $contact = \App\Contact::findOrFail($id);
     $data = $request->input();
     $validator = \Validator::make($data, $rules = self::getValidatorRules());
     if (!$validator->fails()) {
         $model = new ContactLog($request->input());
         $model->user_id = \Auth::getUser()->id;
         $model->contact_id = $contact->id;
         $model->save();
     }
     return redirect(route('contact.show', $contact));
 }
开发者ID:errogaht,项目名称:bv-table,代码行数:20,代码来源:ContactLogController.php

示例7: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $contact = Contact::findOrFail($id);
     return view('admin.contacts.edit', ['contact' => $contact]);
 }
开发者ID:phantsang,项目名称:1u0U39rjwJO4Vmnt99uk9j6,代码行数:11,代码来源:ContactsController.php

示例8: destroy

 public function destroy(Request $request, $id)
 {
     Contact::findOrFail($id)->delete();
     return response(null, 204);
 }
开发者ID:vestd,项目名称:ProcessMonitor,代码行数:5,代码来源:ContactController.php

示例9: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, Request $request)
 {
     //$this->validate($request, ['name' => 'required']); // Uncomment and modify if needed.
     $contact = Contact::findOrFail($id);
     $update = $request->all();
     // is new image uploaded?
     if ($file = Input::file('image')) {
         $fileName = $file->getClientOriginalName();
         $extension = $file->getClientOriginalExtension() ?: 'png';
         $folderName = '/uploads/';
         $destinationPath = Config::get('app.path') . $folderName;
         $safeName = time() . "_" . str_random(10) . '.' . $extension;
         $file->move($destinationPath, $safeName);
         //delete old pic if exists
         if (File::exists(Config::get('app.path') . $contact->image)) {
             File::delete(Config::get('app.path') . $contact->image);
         }
         $update['image'] = $safeName ? $folderName . $safeName : '';
     }
     if (isset(Contact::$boolean)) {
         foreach (Contact::$boolean as $field) {
             if (isset($update[$field]) && $update[$field] == "on") {
                 $update[$field] = 1;
             } else {
                 $update[$field] = 0;
             }
         }
     }
     $contact->update($update);
     return redirect('admin/contacts')->with('success', Lang::get('message.success.update'));
 }
开发者ID:nirlewin,项目名称:test,代码行数:37,代码来源:ContactsController.php

示例10: DeleteCheckedDocs

 public function DeleteCheckedDocs(Request $request)
 {
     $i = 1;
     $data = $request->all();
     if ($request->input('supp')) {
         if ($data['type'] == 0 || $data['type'] == 3) {
             foreach ($data as $key => $value) {
                 if (substr($key, 0, 1) == 'c') {
                     $profil = Societe::findOrFail($value);
                     $profil->update(['etat' => 0]);
                 }
             }
         } elseif ($data['type'] == 1) {
             foreach ($data as $key => $value) {
                 if (substr($key, 0, 1) == 'c') {
                     $profil = Contact::findOrFail($value);
                     $profil->update(['etat' => 0]);
                 }
             }
         } elseif ($data['type'] == 2) {
             foreach ($data as $key => $value) {
                 if (substr($key, 0, 1) == 'c') {
                     $profil = Groupe::findOrFail($value);
                     $profil->update(['etat' => 0]);
                 }
             }
         }
     }
     // Import de contacts
     if ($request->input('export')) {
         Excel::create('ExportContact', function ($excel) {
             $excel->sheet('Sheetname', function ($sheet) {
                 $donnees = Input::all();
                 $j = 0;
                 if ($donnees['type'] == 0 || $donnees['type'] == 3) {
                     foreach ($donnees as $key => $value) {
                         if (substr($key, 0, 1) == 'c') {
                             $profil = Societe::findOrFail($value);
                             $export[$key] = $profil;
                         }
                     }
                     foreach ($export as $donnees) {
                         $extract[$j] = ['Nom de la société' => $donnees->nom_clt, 'Effectif' => $donnees->effectif_clt, 'Chiffre d\'affaire' => $donnees->ca_clt, 'N° TVA' => $donnees->num_tva_clt, 'URL' => $donnees->url_clt, 'Téléphone' => $donnees->tel_siege_clt, 'Fax' => $donnees->fax_siege_clt, 'E-mail' => $donnees->email_siege_clt, 'Pays' => $donnees->pays_clt, 'Ville' => $donnees->ville_siege_clt, 'Adresse' => $donnees->adresse_siege_clt, 'Commentaire' => $donnees->comment_clt];
                         $j++;
                     }
                 } elseif ($donnees['type'] == 1) {
                     foreach ($donnees as $key => $value) {
                         if (substr($key, 0, 1) == 'c') {
                             $profil = Contact::with(['societe' => function ($query) {
                                 $query->with(['groupe'])->select('nom_clt', 'id', 'groupe_id');
                             }])->findOrFail($value);
                             $export[$key] = $profil;
                         }
                     }
                     foreach ($export as $donnees) {
                         $extract[$j] = ['Civilité' => $donnees->genre_contact, 'Nom' => $donnees->nom_contact, 'Prénom' => $donnees->prenoms_contact, 'Société' => isset($donnees->societe->nom_clt) ? $donnees->societe->nom_clt : NULL, 'Groupe' => isset($donnees->societe->groupe->nom_groupe) ? $donnees->societe->groupe->nom_groupe . ' ' . $donnees->societe->groupe->date_groupe : NULL, 'Fonction' => $donnees->fonction_contact, 'Service' => $donnees->service_contact, 'Description' => $donnees->description_contact, 'Téléphone' => $donnees->tel_contact, 'E-mail' => $donnees->email_contact, 'Adresse' => $donnees->adresse_contact];
                         $j++;
                     }
                 } elseif ($donnees['type'] == 2) {
                     foreach ($donnees as $key => $value) {
                         if (substr($key, 0, 1) == 'c') {
                             $profil = Groupe::findOrFail($value)->societe()->where('etat', 1)->get();
                             foreach ($profil as $pkey => $pvalue) {
                                 $export[$key] = $pvalue;
                             }
                         }
                     }
                     var_dump($export);
                     dd();
                     foreach ($export as $donnees) {
                         $extract[$j] = ['Civilité' => $donnees->genre_contact, 'Nom' => $donnees->nom_contact, 'Prénom' => $donnees->prenoms_contact, 'Société' => isset($donnees->societe->nom_clt) ? $donnees->societe->nom_clt : NULL, 'Groupe' => isset($donnees->societe->groupe->nom_groupe) ? $donnees->societe->groupe->nom_groupe . ' ' . $donnees->societe->groupe->date_groupe : NULL, 'Fonction' => $donnees->fonction_contact, 'Service' => $donnees->service_contact, 'Description' => $donnees->description_contact, 'Téléphone' => $donnees->tel_contact, 'E-mail' => $donnees->email_contact, 'Adresse' => $donnees->adresse_contact];
                         $j++;
                     }
                 }
                 $sheet->fromArray($extract);
             });
         })->export('xls');
     }
     // Import des contacts à partir du Groupe CRM
     if ($request->input('export')) {
         Excel::create('ExportContact', function ($excel) {
             $excel->sheet('Sheetname', function ($sheet) {
                 $donnees = Input::all();
                 $j = 0;
                 if ($donnees['type'] == 0) {
                     foreach ($donnees as $key => $value) {
                         if (substr($key, 0, 1) == 'c') {
                             $profil = Societe::findOrFail($value);
                             $export[$key] = $profil;
                         }
                     }
                     foreach ($export as $donnees) {
                         $extract[$j] = ['Nom de la société' => $donnees->nom_clt, 'Effectif' => $donnees->effectif_clt, 'Chiffre d\'affaire' => $donnees->ca_clt, 'N° TVA' => $donnees->num_tva_clt, 'URL' => $donnees->url_clt, 'Téléphone' => $donnees->tel_siege_clt, 'Fax' => $donnees->fax_siege_clt, 'E-mail' => $donnees->email_siege_clt, 'Pays' => $donnees->pays_clt, 'Ville' => $donnees->ville_siege_clt, 'Adresse' => $donnees->adresse_siege_clt, 'Commentaire' => $donnees->comment_clt];
                         $j++;
                     }
                 } else {
                     foreach ($donnees as $key => $value) {
                         if (substr($key, 0, 1) == 'c') {
                             $profil = Contact::with(['societe' => function ($query) {
                                 $query->with(['groupe'])->select('nom_clt', 'id', 'groupe_id');
//.........这里部分代码省略.........
开发者ID:blackdavinci,项目名称:crm-ftz,代码行数:101,代码来源:ActionController.php

示例11: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, Request $request)
 {
     $contact = Contact::findOrFail($id);
     $input = $request->all();
     $contact->fill($input)->save();
 }
开发者ID:PavelSobchenko,项目名称:study_backbone,代码行数:12,代码来源:ContactsController.php

示例12: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //
     $contacts = Societe::findOrFail($id)->contacts()->select('id')->where('etat', 1)->get();
     if (!empty($contacts->id)) {
         foreach ($contacts as $value) {
             $contact = Contact::findOrFail($value->id);
             $contact->update(['etat' => 0]);
         }
         foreach ($contact as $value) {
             $contact->update(['etat' => 0]);
         }
     }
     $profil = Societe::findOrFail($id);
     $profil->update(['etat' => 0]);
     return redirect(route('societe.index'));
 }
开发者ID:blackdavinci,项目名称:crm-ftz,代码行数:23,代码来源:SocieteController.php

示例13: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //
     $contact = Contact::findOrFail($id);
     $contact->update(['etat' => 0]);
     $id = $contact->societe_id;
     return redirect(route('societe.show', $id));
 }
开发者ID:blackdavinci,项目名称:crm-ftz,代码行数:14,代码来源:ContactController2.php

示例14: status

 /**
  * Изменить Статус
  *
  * @param \Illuminate\Http\Request $request
  * @param                          $id
  * @param                          $status
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function status(Request $request, $id, $status)
 {
     /** @var Contact $contact */
     $contact = Contact::findOrFail($id);
     // TODO: проверка, что пользователю разрешен перевод в выбранный статус
     if ($contact->status != $status) {
         $contact->status = $status;
         $contact->change_status_comment = $request->get('comment');
         switch ($status) {
             case \App\Contact::STATUS_WORK:
             case \App\Contact::STATUS_SUCCESS:
                 $contact->taken_by = \Auth::getUser()->id;
                 $contact->taken_at = new \DateTime();
                 break;
             case \App\Contact::STATUS_FAIL:
                 if (!$contact->change_status_comment) {
                     Flash::error('Укажите причину отказа');
                     goto redirect;
                 }
                 //break;
             //break;
             case \App\Contact::STATUS_NEW:
                 $contact->taken_by = null;
                 $contact->taken_at = null;
                 break;
             default:
                 goto redirect;
         }
         $contact->save();
     }
     redirect:
     return redirect(route('contact.show', $contact));
 }
开发者ID:errogaht,项目名称:bv-table,代码行数:41,代码来源:ContactController.php

示例15: sendEmail

 /**
  * Fungsi untuk Send mail yang admin kirim
  * @param int $id 
  */
 public function sendEmail($id)
 {
     $user = Auth::user();
     $data = Contact::findOrFail($id);
     return view('admin.sendEmail', compact('user', 'data'));
 }
开发者ID:semmiverian,项目名称:webJok,代码行数:10,代码来源:adminController.php


注:本文中的app\Contact::findOrFail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。