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