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


PHP Contact::findOrFail方法代码示例

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


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

示例1: sendManualEmail

 public static function sendManualEmail($memberid, $contactid, $templateid)
 {
     $contact = Contact::findOrFail($contactid);
     $user = User::findOrFail($memberid);
     if (!$user || !$contact) {
         return false;
     }
     if (!$user->active || !$contact->active) {
         return false;
     }
     if (EmailSchedullerPool::sendmail($memberid, $contactid, $templateid)) {
         if ($contact->email_sent == "" || $contact->email_sent == 0) {
             $contact->email_sent = $templateid;
             $contact->last_follow_up = date('Y-m-d H:i:s');
             $contact->save();
         } else {
             if ($contact->templateExist($templateid)) {
                 //do nothing
             } else {
                 $contact->email_sent = $contact->email_sent . "," . $templateid;
                 $contact->save();
             }
         }
         $contact->saveHistory("success", $memberid, $templateid);
         return true;
     } else {
         return false;
     }
 }
开发者ID:arbuuuud,项目名称:gnt-aops,代码行数:29,代码来源:EmailSchedullerPool.php

示例2: storeProcess

 public function storeProcess($job, $data)
 {
     //Log::info(['STORE', $data]);
     $ac_contact = ['email' => $data['email'], 'first_name' => $data['name'], 'last_name' => $data['surname'], 'phone' => $data['phone'], 'orgname' => 'Acme, Inc.', 'tags' => 'api,test', 'field[1,0]' => $data['field1'], 'field[2,0]' => $data['field2'], 'field[3,0]' => $data['field3'], 'field[4,0]' => $data['field4'], 'field[5,0]' => $data['field5'], "p[1]" => 1, "status[1]" => 1];
     $result = $this->activeCampaignAPI('contact/add', $ac_contact);
     if ($result[0] == 'ok') {
         $contact = Contact::findOrFail($data['id']);
         $contact->ac_subscriber_id = $result[1];
         $contact->save();
     } else {
         // error, already logged.
     }
     $job->delete();
 }
开发者ID:sdbruder,项目名称:laravel42testapp,代码行数:14,代码来源:activeCampaignWorker.php

示例3: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $contact = Contact::findOrFail($id);
     if ($contact->user->id == Auth::User()->id) {
         $contact->delete();
         Queue::push('activeCampaignWorker@deleteProcess', $contact);
         return Response::json(["ok", ""]);
     } else {
         return Response::json(["error", "Contact doesn't exist or not from the authenticaded user."]);
     }
 }
开发者ID:sdbruder,项目名称:laravel42testapp,代码行数:17,代码来源:ContactsController.php

示例4: getDelete

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function getDelete($id)
 {
     if (Session::get('user_level') < Config::get('cms.deleteContacts')) {
         return Redirect::to(_l(URL::action('AdminHomeController@getIndex')))->with('message', Lang::get('admin.notPermitted'))->with('notif', 'warning');
     }
     try {
         $contact = Contact::findOrFail($id);
         $contact->marks()->delete();
         $contact->newsContacts()->delete();
         $contact->delete();
         return Redirect::to(_l(URL::action('ContactController@getIndex')))->with('message', Lang::get('admin.contactDeleted'))->with('notif', 'success');
     } catch (Exception $e) {
         return Redirect::to(_l(URL::action('ContactController@getIndex')))->with('message', Lang::get('admin.noSuchContact'))->with('notif', 'danger');
     }
 }
开发者ID:Puskice,项目名称:PuskiceCMS,代码行数:21,代码来源:ContactController.php

示例5: oceni

 /**
  * Update the specified resource in storage.
  * PUT /frontend/publiccontact/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function oceni($id)
 {
     try {
         if (!Session::get('id')) {
             return Redirect::to(Request::root() . '/login?ref=' . rawurlencode("ljudi/" . $id));
         } else {
             $contact = Contact::findOrFail($id);
             $update = false;
             try {
                 $mark = Mark::where('people_id', '=', $id)->where('user_id', '=', Session::get('id'))->firstOrFail();
                 $update = true;
             } catch (Exception $e) {
                 $mark = new Mark();
             }
             $mark->user_id = Session::get('id');
             $mark->people_id = $id;
             $mark->uskladjenost = Input::get('uskladjenost');
             $mark->jasnost = Input::get('jasnost');
             $mark->interakcija = Input::get('interakcija');
             $mark->komunikacija = Input::get('komunikacija');
             $mark->konflikt = Input::get('konflikt');
             $mark->inspiracija = Input::get('inspiracija');
             $mark->aktivnost = Input::get('aktivnost');
             $mark->kvalitet_literature = Input::get('literatura');
             $mark->student_relations = Input::get('odnos');
             $avg = ($mark->uskladjenost + $mark->jasnost + $mark->interakcija + $mark->komunikacija + (11 - $mark->konflikt) + $mark->inspiracija + $mark->aktivnost + $mark->kvalitet_literature + $mark->student_relations) / 9;
             $mark->total_impression = $avg;
             $mark->note = Input::get('komentar');
             $mark->save();
             $mark_count = Mark::where('people_id', '=', $id)->count();
             $contact->mark_count++;
             $contact->uskladjenost = ($contact->uskladjenost * ($mark_count - 1) + $mark->uskladjenost) / $mark_count;
             $contact->jasnost = ($contact->jasnost * ($mark_count - 1) + $mark->jasnost) / $mark_count;
             $contact->interakcija = ($contact->interakcija * ($mark_count - 1) + $mark->interakcija) / $mark_count;
             $contact->komunikacija = ($contact->komunikacija * ($mark_count - 1) + $mark->komunikacija) / $mark_count;
             $contact->konflikt = ($contact->konflikt * ($mark_count - 1) + $mark->konflikt) / $mark_count;
             $contact->inspiracija = ($contact->inspiracija * ($mark_count - 1) + $mark->inspiracija) / $mark_count;
             $contact->aktivnost = ($contact->aktivnost * ($mark_count - 1) + $mark->aktivnost) / $mark_count;
             $contact->kvalitet_literature = ($contact->kvalitet_literature * ($mark_count - 1) + $mark->kvalitet_literature) / $mark_count;
             $contact->student_relations = ($contact->student_relations * ($mark_count - 1) + $mark->student_relations) / $mark_count;
             $contact->total_impression = ($contact->total_impression * ($mark_count - 1) + $mark->total_impression) / $mark_count;
             $contact->save();
             if ($update) {
                 return Redirect::to(Request::root() . '/ljudi/' . $id)->with('notif', 'success')->with('message', __("Оцена предавача ажурирана"));
             }
             return Redirect::to(Request::root() . '/ljudi/' . $id)->with('notif', 'success')->with('message', __("Успешно сте оценили предавача"));
         }
     } catch (Exception $e) {
         return Redirect::to(Request::root() . '/ljudi/' . $id)->with('notif', 'danger')->with('message', __("Одабрани предавач не постоји"));
     }
 }
开发者ID:Puskice,项目名称:PuskiceCMS,代码行数:58,代码来源:PublicContactController.php

示例6: update

 /**
  * Update the specified Contact in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $contact = Contact::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Contact::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $contact->update($data);
     return Redirect::route(Auth::user()->roleString() . '.contacts.index')->with("message", "Data berhasil disimpan");
 }
开发者ID:arbuuuud,项目名称:gnt-aops,代码行数:16,代码来源:ContactsController.php


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