當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。