当前位置: 首页>>代码示例>>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;未经允许,请勿转载。