當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Contact::find方法代碼示例

本文整理匯總了PHP中app\Contact::find方法的典型用法代碼示例。如果您正苦於以下問題:PHP Contact::find方法的具體用法?PHP Contact::find怎麽用?PHP Contact::find使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Contact的用法示例。


在下文中一共展示了Contact::find方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: destroy

 public function destroy(Request $request, $id)
 {
     $contact = Contact::find($id);
     $contact->delete();
     $request->session()->flash('alert-success', 'Message has been deleted successfully !');
     return redirect('/message')->withInput();
 }
開發者ID:sopnopriyo,項目名稱:sopnopriyo,代碼行數:7,代碼來源:ContactController.php

示例2: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show(Contact $contact)
 {
     //
     $user = User::find($contact->id);
     if (!$user->types()->where('user_types.id', 1)->first()) {
         $user->types()->attach([1]);
     }
     $contact = Contact::find($user->id);
     // return $contact;
     $schedules = $this->schedules->contact($contact);
     //Gets any Scheduled Responses for the contact grouped by Template
     // $template_ids = '0,';
     $template_ids = [];
     $template_group_status = [];
     // dd($template_group_status);
     // $template_ids = rtrim($template_ids,',');
     if ($schedules) {
         foreach ($schedules as $s) {
             //If any response schedule is set to 'Paused' set a status for that templateid to paused.
             if ($s->status == 'paused') {
                 !isset($template_group_status[$s->template->id]) ? $template_group_status[$s->template->id] = ['template_id' => $s->template->id, 'status' => 'paused'] : null;
             }
             $template_ids[] = $s->template->id;
         }
         $response_templates = \App\ResponseTemplate::whereIn('id', $template_ids)->get();
     }
     // $schedules = new \App\ResponseSchedule;
     // $response_templates = new \App\ResponseTemplate;
     return view('contacts.show', ['title' => $contact->fullname, 'contact' => $contact, 'schedules' => $schedules, 'response_templates' => $response_templates, 'template_group_status' => $template_group_status]);
 }
開發者ID:skibradshaw,項目名稱:sailschoolos,代碼行數:36,代碼來源:ContactController.php

示例3: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $contact = Contact::find($id);
     if (is_null($contact)) {
         return response()->json(['error' => 'No contact found with ID ' . $id], 404);
     }
     $contact->delete();
     return $contact;
 }
開發者ID:reubenosborne,項目名稱:contact,代碼行數:15,代碼來源:ContactsController.php

示例4: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $contact = Contact::find($id);
     if ($contact) {
         $id = $contact['id'];
         $name = $contact['name'];
         $contact->delete();
         return redirect()->route('admin_contact')->with('message', 'تم حذف رسالة التواصل رقم ' . $id . ' باسم "' . $name . '" بنجاح!')->with('alert-class', 'alert-warning');
     }
 }
開發者ID:MostafaEllethy,項目名稱:alexsport,代碼行數:16,代碼來源:ContactController.php

示例5: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $user = User::find(1);
     $customer = Customer::find(1);
     $contact = Contact::find(1);
     $prod = Product::find(1);
     $iol_prod = Product::find(2);
     $briefing_owner = BriefingOwner::find(1);
     $briefing_source = BriefingSource::find(1);
     factory(App\Briefing::class)->create(['user_id' => $user->id, 'last_updated_user_id' => $user->id, 'customer_id' => $customer->id, 'customer_type_id' => $customer->customer_type_id, 'contact_id' => $contact->id, 'prod_id' => $prod->id, 'iol_prod_id' => $iol_prod->id, 'briefing_owner_id' => $briefing_owner->id, 'briefing_source_id' => $briefing_source->id]);
 }
開發者ID:programadorjff,項目名稱:ioltest,代碼行數:16,代碼來源:BriefingsTableSeeder.php

示例6: handle

 /**
  * Handle the command.
  *
  * @param  ContactCommand  $command
  * @return void
  */
 public function handle(ContactCommand $command)
 {
     $contact = Contact::find($command->id);
     $contact->title = $command->title;
     $contact->address = $command->address;
     $contact->city = $command->city;
     $contact->state = $command->state;
     $contact->zip = $command->zip;
     $contact->email = $command->email;
     $contact->phone = $command->phone;
     $contact->save();
 }
開發者ID:2dan-devs,項目名稱:williamnavasphoto,代碼行數:18,代碼來源:ContactCommandHandler.php

示例7: update

 public function update($id, $status)
 {
     if (empty($id)) {
         return redirect('/admin/contacts');
     }
     $contacts = Contact::find($id);
     if (empty($contacts)) {
         return redirect('/admin/contacts');
     }
     $contacts->status = $status;
     $contacts->save();
     return redirect('/admin/contacts');
 }
開發者ID:sonusindhu,項目名稱:Sample-Example,代碼行數:13,代碼來源:ContactsController.php

示例8: handle

 /**
  * Handle the event.
  *
  * @param  ScheduleResponse  $event
  * @return void
  */
 public function handle(ScheduleResponse $event)
 {
     //
     // if(!$response_templates = ResponseTemplate::where('trigger_event',1)->orderBy('created_at','desc')->get())
     // {
     //     return false;
     // }
     $response_templates = ResponseTemplate::where('trigger_event', 1)->orderBy('created_at', 'desc')->get();
     $contact = Contact::find($event->inquiry->user_id);
     foreach ($response_templates as $t) {
         $this->schedule->create($t, $contact);
     }
     \Mail::raw('Scheduled Responses were created for ' . $contact->fullname, function ($m) {
         $m->to('tim@alltrips.com', 'Tim Bradshaw')->from('info@ltdsailing.com', 'LTD Sailing')->subject('The Prospect Inquiry Event Handler Fired to Create Scheduled Responses');
     });
 }
開發者ID:skibradshaw,項目名稱:sailschoolos,代碼行數:22,代碼來源:ProspectInquiryListener.php

示例9: create

 /**
  * When a trigger event fires, this method creates all response_schedule entries
  * @param  ResponseTemplate $template Pass in a Response Template
  * @param  Contact          $contact  Pass in a Contact Model
  * @return ResponseSchedule Returns a response schedule object for this Contact and Template.
  */
 public function create(ResponseTemplate $template, Contact $contact)
 {
     //Create the Response Schedule events
     // return $template;
     !isset($contact->id) ? $contact = Contact::find(1) : ($contact = $contact);
     foreach ($template->details as $d) {
         $sched = new ResponseSchedule();
         $sched->user_id = $contact->id;
         $sched->scheduled_date = Carbon::now()->addDays($d->number_of_days);
         $sched->response_template_detail_id = $d->id;
         $sched->most_recent_note_id = 0;
         $sched->save();
     }
     $fullsched = ResponseSchedule::where('user_id', $contact->id)->whereHas('detail', function ($q) use($template) {
         $q->where('response_template_details.response_template_id', $template->id);
     })->get();
     return $fullsched;
 }
開發者ID:skibradshaw,項目名稱:sailschoolos,代碼行數:24,代碼來源:ResponseScheduleController.php

示例10: changeContactInfo

 public function changeContactInfo(Request $request)
 {
     if ($request->type == 'contact') {
         $item = Contact::find($request->entity);
         if ($request->name == 'first_name') {
             $item->first_name = $request->value;
         } elseif ($request->name == 'last_name') {
             $item->last_name = $request->value;
         } elseif ($request->name == 'email') {
             $item->email = $request->value;
         } elseif ($request->name == 'title') {
             $item->title = $request->value;
         } else {
         }
         $item->save();
     } elseif ($request->type == 'address') {
         $item = Address::find($request->entity);
         $item->full_string = $request->value;
         $item->save();
         return $request->all();
     } elseif ($request->type == 'phone') {
         $item = Phone::find($request->entity);
         if ($request->name == 'type') {
             $item->type = $request->value;
         } elseif ($request->name == 'number') {
             $item->number = $request->value;
         } elseif ($request->name == 'from') {
             $item->available_from = $request->value;
         } elseif ($request->name == 'to') {
             $item->available_to = $request->value;
         } else {
         }
         $item->save();
         return $request->all();
     } else {
     }
 }
開發者ID:bunsha,項目名稱:gazingle,代碼行數:37,代碼來源:ContactsController.php

示例11: messages

 public function messages(Request $request)
 {
     //
     if ($request->action == 'create') {
         return view('admin.pages.contact.create');
     }
     if ($request->action == 'edit' && isset($request->id)) {
         $contact = \App\Contact::find($request->id);
         return view('admin.pages.contact.edit', compact('contact'));
     }
     $request = json_encode($request->all());
     $request = json_decode($request, true);
     $api_url = route('api.message.index', $request);
     return view('admin.pages.contact.listing', compact('api_url'));
 }
開發者ID:borislemke,項目名稱:kbr,代碼行數:15,代碼來源:AdminController.php

示例12: removeContact

 public function removeContact($campaign_id, $contact_id)
 {
     $campaign = Campaign::find($campaign_id);
     $contact = Contact::find($contact_id);
     $campaign->contacts()->detach($contact->id);
     return redirect()->back()->with('message', "{$contact->email} has been removed from the Campaign");
 }
開發者ID:sethphillips,項目名稱:event_mailer,代碼行數:7,代碼來源:CampaignController.php

示例13: getContact

 /**
  * returns Contact information
  */
 public function getContact()
 {
     return response()->json(Contact::find(1));
 }
開發者ID:2dan-devs,項目名稱:williamnavasphoto,代碼行數:7,代碼來源:FrontEndController.php

示例14: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     //
     $contact = Contact::find($id);
     $contact->delete();
     return response()->json($contact);
 }
開發者ID:piyushchauhan2011,項目名稱:clickview-test,代碼行數:13,代碼來源:ContactController.php

示例15: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $contact = Contact::find($id);
     if ($contact != null) {
         $deleted = $contact->delete();
         if ($deleted) {
             $returnValue['status'] = 200;
             $returnValue['message'] = "Contact was successfully deleted.";
             return Response::json($returnValue, 200);
         }
         $returnValue['status'] = 400;
         $returnValue['error_message'] = 'An error occurred while trying to delete the selected contact.';
         return Response::json($returnValue, 400);
     }
     $returnValue['status'] = 404;
     $returnValue['error_message'] = 'Contact not found.';
     return Response::json($returnValue, 404);
 }
開發者ID:kvaljeva,項目名稱:voiperinho,代碼行數:24,代碼來源:ContactController.php


注:本文中的app\Contact::find方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。