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


PHP Contact::with方法代码示例

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


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

示例1: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $contact = Contact::with(['societe' => function ($query) {
         $query->select('nom_clt', 'id');
     }])->where('etat', 1)->orderBy('nom_contact', 'asc')->get();
     $actif = 'contact';
     $type = 1;
     return view('contact.contact', compact('actif', 'contact', 'type'));
 }
开发者ID:blackdavinci,项目名称:crm-ftz,代码行数:14,代码来源:ContactController2.php

示例2: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $contacts = new Contact();
     $actif = 'contact';
     $type = 1;
     if (isset($_GET['sort'])) {
         if ($_GET['sort'] == 'pays_clt') {
             $contact = DB::table('contacts')->leftjoin('societes', 'contacts.societe_id', '=', 'societes.id')->orderBy('societes.pays_clt', $_GET['order'])->where('contacts.etat', 1)->get();
             $tri = 'pays';
         } elseif ($_GET['sort'] == 'statut') {
             $contact = DB::table('contacts')->leftjoin('societes', 'contacts.societe_id', '=', 'societes.id')->orderBy('societes.statut', $_GET['order'])->where('contacts.etat', 1)->get();
             $tri = 'client';
         } elseif ($_GET['sort'] == 'created_at') {
             $tri = 'ajout';
             $contact = $contacts->with('societe')->where('etat', 1)->sortable()->get();
         } elseif ($_GET['sort'] == 'updated_at') {
             $tri = 'modif';
             $contact = $contacts->with('societe')->where('etat', 1)->sortable()->get();
         } elseif ($_GET['sort'] == 'nom_contact') {
             $tri = 'alpha';
             $contact = $contacts->with('societe')->where('etat', 1)->sortable()->get();
         } elseif ($_GET['sort'] == 'societe_id') {
             $contact = DB::table('contacts')->leftjoin('societes', 'contacts.societe_id', '=', 'societes.id')->orderBy('societes.nom_clt', $_GET['order'])->where('contacts.etat', 1)->get();
             $tri = 'societe';
         } elseif ($_GET['sort'] == 'ville_siege_clt') {
             $contact = DB::table('contacts')->leftjoin('societes', 'contacts.societe_id', '=', 'societes.id')->orderBy('societes.ville_siege_clt', $_GET['order'])->where('contacts.etat', 1)->get();
             $tri = 'ville';
         } elseif ($_GET['sort'] == 'notes') {
             $contact = $contacts->with('notes')->where('etat', 1)->orderBy('nom_contact', $_GET['sort'])->get();
             $tri = 'notes';
         }
     } else {
         $tri = 'alpha';
         $contact = $contacts->with('societe')->where('etat', 1)->orderBy('nom_contact', 'asc')->get();
     }
     return view('contact.contact', compact('actif', 'contact', 'type', 'tri'));
 }
开发者ID:blackdavinci,项目名称:crm-ftz,代码行数:42,代码来源:ContactController.php

示例3: 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

示例4: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     // Get all the files associated with the retrieved contact
     $contacts = Contact::with('files')->get();
     return $contacts;
 }
开发者ID:reubenosborne,项目名称:contact,代码行数:11,代码来源:ContactsController.php

示例5: function

| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
use App\User;
Route::get('/', ['middleware' => 'auth', function () {
    if (Entrust::hasRole('admin')) {
        $users = \App\Role::where('name', '=', 'user')->firstOrFail()->users;
        return View('admin/admin_home')->with('users', $users);
    } elseif (Entrust::hasRole('user')) {
        $current_user = Auth::user();
        $contacts = \App\Contact::with('emails', 'phoneNumbers')->where('user_id', '=', $current_user->id)->get();
        return View('contacts/user_home')->with('contacts', $contacts);
    }
    return view('welcome');
}]);
// Authentication routes...
Route::get('auth/login', 'Auth\\AuthController@getLogin');
Route::post('auth/login', 'Auth\\AuthController@postLogin');
Route::get('auth/logout', 'Auth\\AuthController@getLogout');
// Admin routes
Route::group(['middleware' => 'auth'], function () {
    // only users with roles that have the 'edit-users' permission will be able to access any route within admin/post
    Entrust::routeNeedsPermission('admin/*', 'edit-users', Redirect::to('errors/403'));
    Route::get('admin/create_user', 'Admin\\AdminController@getCreateUser');
    Route::post('admin/create_user', 'Admin\\AdminController@postCreateUser');
    Route::get('admin/delete_user/{id}', 'Admin\\AdminController@getDeleteUser');
开发者ID:jsrc1115,项目名称:VOIQTest,代码行数:31,代码来源:routes.php


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