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


PHP Profile::conferences方法代碼示例

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


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

示例1: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // ---------------------------------------------------------------------
     // CONFERENCE 1
     // ---------------------------------------------------------------------
     $faker = Faker::create();
     $user = Sentinel::findById(6);
     $conference = Conference::find(1);
     $countries = ['Canada', 'France', 'India', 'United States'];
     $genders = ['female', 'male'];
     for ($i = 0; $i < 100; ++$i) {
         $profile = ['first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'city' => $faker->city, 'country' => $countries[rand(0, 3)], 'birthdate' => $faker->date($format = 'Y-m-d', $max = 'now'), 'gender' => $genders[rand(0, 1)]];
         $profile = new Profile($profile);
         $profile->user()->associate($user);
         $profile->save();
         $profile->conferences()->attach($conference->id, ['birthdate' => $profile->birthdate, 'country' => $profile->country, 'gender' => $profile->gender, 'status' => 'approved']);
         $conference->increment('attendee_count');
     }
     // ---------------------------------------------------------------------
     // CONFERENCE 2
     // ---------------------------------------------------------------------
     $conference = Conference::find(2);
     $event = $conference->events()->first();
     $room = $conference->accommodations()->first()->rooms()->first();
     $conferenceVehicle = $conference->vehicles()->first();
     $eventVehicle = $event->vehicles()->first();
     for ($i = 1; $i <= 7; ++$i) {
         $profile = Profile::find($i);
         $attendee = ['email' => $profile->email, 'phone' => $profile->phone, 'first_name' => $profile->first_name, 'middle_name' => $profile->middle_name, 'last_name' => $profile->last_name, 'city' => $profile->city, 'country' => $profile->country, 'birthdate' => $profile->birthdate, 'gender' => $profile->gender, 'accommodation_req' => true, 'accommodation_pref' => 1, 'arrv_ride_req' => true, 'arrv_date' => '2016-04-08', 'arrv_time' => '21:30', 'arrv_airport' => 'DEL', 'arrv_flight' => 'AC2273', 'dept_ride_req' => false, 'status' => 'approved'];
         $profile->conferences()->attach($conference, $attendee);
         $conference->increment('attendee_count');
         $profile->events()->attach($event);
         $profile->rooms()->attach($room);
         $room->increment('guest_count');
         $profile->conferenceVehicles()->attach($conferenceVehicle);
         $conferenceVehicle->increment('passenger_count');
         $profile->eventVehicles()->attach($eventVehicle);
         $eventVehicle->increment('passenger_count');
     }
 }
開發者ID:vinlore,項目名稱:huddle,代碼行數:45,代碼來源:AttendeesSeeder.php


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