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


PHP models\Region类代码示例

本文整理汇总了PHP中app\models\Region的典型用法代码示例。如果您正苦于以下问题:PHP Region类的具体用法?PHP Region怎么用?PHP Region使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: createRegion

 public function createRegion($name, $attr = [])
 {
     if (!($model = $this->findRegion($name))) {
         $model = new Region();
         $model->name = $name;
         $model->setAttributes($attr);
         $model->save(false);
     }
     return $model;
 }
开发者ID:carono,项目名称:yii2-components,代码行数:10,代码来源:CityController.php

示例2: setup

 public function setup()
 {
     $options = ContractSearchCriteria::where('user_id', Auth::user()->id)->first();
     $criterias = $options ? json_decode($options->criterias, true) : [];
     $regions = Region::orderBy('name')->lists('name', 'id');
     return view('admin.contracts.setup', compact('criterias', 'regions'));
 }
开发者ID:6akcuk,项目名称:infotendermail,代码行数:7,代码来源:ContractsController.php

示例3: passData

 private function passData($id = null)
 {
     $people = new \App\Models\People();
     $address = new \App\Models\Addresses();
     $employee = new \App\Models\Employee();
     if (!is_null($id)) {
         $people = People::findOrNew($id);
         $universityHisttory = $people->universityHistory()->get();
         $careerHistory = $people->careerHistory()->get();
         $employee = $people->employee()->first();
         if ($people->address()->first()) {
             $address = $people->address()->get()->first();
         }
     } else {
         if (!Session::has('UniversityHistory')) {
             Session::set('UniversityHistory', $people->universityHistory()->get());
         }
         if (!Session::has('CareerHistory')) {
             Session::set('CareerHistory', $people->careerHistory()->get());
         }
         $universityHisttory = Session::get('UniversityHistory');
         $careerHistory = Session::get('CareerHistory');
     }
     $pTitle = PeopleTitle::all()->sortBy("Title_Name")->toArray();
     foreach ($pTitle as $peopTitle) {
         $peopleTitle[$peopTitle["id_People_Title"]] = $peopTitle["Title_Name"];
     }
     $employeeType = EmployeeType::getEmployeeTypeOptions();
     $countryModel = $address->getCountry();
     $regionsOptions = Region::getRegionsOptions();
     $countryOptions = Country::getCountriesOptionsByRegion($countryModel->id_Region);
     return compact("countryOptions", "regionsOptions", "employeeType", "people", "peopleTitle", "universityHisttory", "careerHistory", "employee", "address");
 }
开发者ID:rowanhwilliams,项目名称:ftm-php,代码行数:33,代码来源:EmployeeController.php

示例4: actionUpdate

 public function actionUpdate($region, $number)
 {
     $transaction = Yii::$app->db->beginTransaction();
     if (!($region = Region::findOne(['key' => $region]))) {
         printf("Unknown region: %s\n", $region);
         return 1;
     }
     if (!($fest = Splatfest::findOne(['region_id' => $region->id, '[[order]]' => $number]))) {
         printf("Unknown number: %s (region = %s)\n", $number, $region->key);
         return 1;
     }
     printf("Target #%d (Region=%s, Number=%d)\n", $fest->id, $region->key, $fest->order);
     $alpha = SplatfestTeam::findOne(['fest_id' => $fest->id, 'team_id' => 1]);
     $bravo = SplatfestTeam::findOne(['fest_id' => $fest->id, 'team_id' => 2]);
     if (!$alpha || !$bravo || $alpha->color_hue === null || $bravo->color_hue === null) {
         printf("    > Team information is not ready\n");
         return 1;
     }
     printf("    > cleanup ...\n");
     SplatfestBattleSummary::deleteAll(['fest_id' => $fest->id]);
     $this->createBattleSummaryTmpTimestamp($fest);
     $this->createBattleSummaryTmpTable('tmp_summary_a', $fest, $alpha->color_hue, $bravo->color_hue);
     $this->createBattleSummaryTmpTable('tmp_summary_b', $fest, $bravo->color_hue, $alpha->color_hue);
     $this->createBattleSummary($fest);
     $transaction->commit();
     return 0;
 }
开发者ID:frozenpandaman,项目名称:stat.ink,代码行数:27,代码来源:SplatfestController.php

示例5: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $regions = ['', '---', 'sev', 'simf', 'ubk', 'evp', 'feo'];
     foreach ($regions as $region) {
         Region::create(['id' => $region]);
     }
 }
开发者ID:mazhuravlev,项目名称:olx-grabber,代码行数:12,代码来源:RegionsSeeder.php

示例6: run

 public function run()
 {
     // Suppression de la table 'terrains' de la base de données
     DB::table('terrains')->delete();
     // Chargement de la liste des sports existants
     $sports = Sport::all();
     // Création d'une liste de valeurs par défaut
     $items = [["Football 1 Cégep de Drummondville", "960 Rue Saint-Georges", "Drummondville", [0, 1, 2]], ["Football 2 Cégep de Drummondville", "960 Rue Saint-Georges", "Drummondville", [0, 1, 2]], ["Football 3 Cégep de Drummondville", "960 Rue Saint-Georges", "Drummondville", [0, 1, 2]], ["Soccer 1 Cégep de Drummondville", "960 Rue Saint-Georges", "Drummondville", [0, 1, 2]], ["Soccer 2 Cégep de Drummondville", "960 Rue Saint-Georges", "Drummondville", [0, 1, 2]], ["Football 1 Marie-Rivier", "265 Rue Saint Félix", "Drummondville", [0, 1, 2]], ["Football 2 Marie-Rivier", "265 Rue Saint Félix", "Drummondville", [0, 1, 2]], ["Football 3 Marie-Rivier", "265 Rue Saint Félix", "Drummondville", [0, 1, 2]], ["Soccer 1 Marie-Rivier", "265 Rue Saint Félix", "Drummondville", [0, 1, 2]], ["Soccer 2 Marie-Rivier", "265 Rue Saint Félix", "Drummondville", [0, 1, 2]], ["Football 1 Jean-Raimbault", "175 Rue Pelletier", "Drummondville", [0, 1, 2]], ["Football 2 Jean-Raimbault", "175 Rue Pelletier", "Drummondville", [0, 1, 2]], ["Football 3 Jean-Raimbault", "175 Rue Pelletier", "Drummondville", [0, 1, 2]], ["Soccer 1 Jean-Raimbault", "175 Rue Pelletier", "Drummondville", [0, 1, 2]], ["Soccer 2 Jean-Raimbault", "177 Rue Pelletier", "Drummondville", [0, 1, 2]]];
     // Création d'objet 'terrain' et sauvegarde de ceux-ci dans la base de données
     foreach ($items as $item) {
         $terrain = new Terrain();
         $terrain->nom = $item[0];
         $terrain->adresse = $item[1];
         $terrain->ville = $item[2];
         $terrain->region_id = Region::where("nom_court", "=", "CDQ")->first()->id;
         //un peu de favoritisme pour le Centre du Québec.
         $terrain->save();
         // Ajout de l'association entre les terrains et les sports
         $index_sports = array();
         for ($x = 0; $x < count($item[3]); $x++) {
             array_push($index_sports, $sports[$x]->id);
         }
         $terrain->sports()->sync($index_sports);
     }
 }
开发者ID:BenoitDesrosiers,项目名称:GES2015,代码行数:25,代码来源:TerrainsSeeder.php

示例7: creerEquipes

 /**
  * Crée les entrées de la table Participants correspondant aux équipes
  */
 public function creerEquipes()
 {
     $entrees = [["Grizzlis effarouchés", 1, 1, 1, [1, 2, 3]], ["Opossums déchaînés", 2, 1, 2, [4, 5, 6]], ["Antilopes frustrées", 3, 1, 3, [7, 8, 9]], ["Nasiques offensés", 4, 2, 1, []], ["Renards désinhibés", 5, 2, 1, [13, 14, 15]], ["Escargots enragés", 6, 2, 3, [16, 18, 19]], ["Méduses surexcitées", 7, 3, 2, [20, 21, 22]], ["Gousses d'aïl en furie", 8, 3, 1, [24, 25, 26]], ["Levures passives-agressives", 9, 5, 3, [1, 2, 3]], ["Streptocoques désagréables", 10, 4, 3, [4, 5, 6]]];
     $sports = Sport::all();
     $regions = Region::all();
     $participants = Participant::all();
     Equipe::where('equipe', '=', 1)->delete();
     foreach ($entrees as $entree) {
         $equipe = new Equipe();
         $equipe->nom = $entree[0];
         $equipe->numero = $entree[1];
         $equipe->region_id = $regions[$entree[2]]->id;
         $equipe->prenom = "";
         $equipe->equipe = true;
         $equipe->sexe = $entree[1] % 2;
         $equipe->naissance = new DateTime();
         $equipe->save();
         $equipe->sports()->attach([$sports[$entree[3]]->id]);
         $index_membres = array();
         for ($x = 0; $x < count($entree[4]); $x++) {
             array_push($index_membres, $participants[$entree[4][$x] - 1]->id);
         }
         $equipe->membres()->sync($index_membres);
     }
 }
开发者ID:BenoitDesrosiers,项目名称:GES2015,代码行数:28,代码来源:EquipesSeeder.php

示例8: run

 /**
  * Création d'arbitres dans la base de données
  */
 public function run()
 {
     DB::table('arbitre_epreuve')->delete();
     DB::table("arbitres")->delete();
     $epreuves = Epreuve::all();
     $entrees = [["Benoit", "Desrosiers", "1", "AQSFR", "819-578-6489", 0], ["Guy", "Bernard", "1", "OSQ", "450-715-6915", 0], ["Jonathan", "Gareau", "1", "ASSQ", "514-763-2485", 0], ["Stéphane", "Janvier", "2", "ASAQ", "450-571-1203", 0]];
     $regions = Region::all();
     foreach ($entrees as $entree) {
         $arbitre = new Arbitre();
         $arbitre->prenom = $entree[0];
         $arbitre->nom = $entree[1];
         $arbitre->region_id = $regions->random()->id;
         $arbitre->numero_accreditation = $entree[2];
         $arbitre->association = $entree[3];
         $arbitre->numero_telephone = $entree[4];
         $arbitre->sexe = $entree[5];
         $date_temp = new DateTime();
         $date_temp->setDate(1994, 1, 1);
         $arbitre->date_naissance = $date_temp;
         $arbitre->save();
         for ($j = 0; $j < rand(1, 4); $j++) {
             $epreuves->random()->arbitres()->attach($arbitre->id);
         }
     }
 }
开发者ID:BenoitDesrosiers,项目名称:GES2015,代码行数:28,代码来源:ArbitresSeeder.php

示例9: passData

 private function passData($id = null)
 {
     $jobs = new \App\Models\Jobs();
     if (!is_null($id)) {
         $jobs = Jobs::findOrNew($id);
     }
     $companyPreference = $jobs->getCompanyPreference() ? $jobs->getCompanyPreference() : new \App\Models\CompanyPreference();
     $address = $jobs->address()->first() ? $jobs->address()->first() : new \App\Models\Addresses();
     $commOrBon = CommisionOrBonus::all()->sortBy("Commission_Or_Bonus")->toArray();
     $lns = SupportedLanguages::all()->sortBy("Language_Name")->toArray();
     if (sizeof($commOrBon) == 0) {
         $commOrBon = new \App\Models\CommisionOrBonus();
     }
     $tEndUser = TargetEndUser::all()->sortBy("Target_End_User")->toArray();
     foreach ($commOrBon as $commisionOrBonusVal) {
         $commisionOrBonus[$commisionOrBonusVal["id_Commission_Or_Bonus"]] = $commisionOrBonusVal["Commission_Or_Bonus"];
     }
     foreach ($tEndUser as $tgEndUser) {
         $targetEndUser[$tgEndUser["id_Target_End_User"]] = $tgEndUser["Target_End_User"];
     }
     foreach ($lns as $langs) {
         $languages[$langs["id_Language"]] = $langs["Language_Name"];
     }
     $companies = Companies::SelectOptionsModel();
     $jobType = $jobs->getJobType();
     $jobFamilyOptions = JobFamily::getJobsFamilyOptions();
     $jobTypesOptions = JobType::getJobsTypesByJobFamilyOptions($jobType->id_Job_Family);
     $countryModel = $address->getCountry();
     $regionsOptions = Region::getRegionsOptions();
     $countryOptions = Country::getCountriesOptionsByRegion($countryModel->id_Region);
     return compact("companies", "commisionOrBonus", "targetEndUser", "jobFamilyOptions", "regionsOptions", "countryOptions", "languages", "jobs", "companyPreference", "address", "jobTypesOptions");
 }
开发者ID:rowanhwilliams,项目名称:ftm-php,代码行数:32,代码来源:JobsController.php

示例10: up

 public function up()
 {
     $this->createTable('splatfest', ['id' => $this->primaryKey(), 'region_id' => $this->integer()->notNull(), 'name' => $this->string(64)->notNull(), 'start_at' => 'TIMESTAMP(0) WITH TIME ZONE NOT NULL', 'end_at' => 'TIMESTAMP(0) WITH TIME ZONE NOT NULL']);
     $this->addForeignKey('fk_splatfest_1', 'splatfest', 'region_id', 'region', 'id');
     $jp = Region::findOne(['key' => 'jp'])->id;
     $this->batchInsert('splatfest', ['region_id', 'name', 'start_at', 'end_at'], [[$jp, 'ごはん vs パン', '2015-06-13 18:00:00+09', '2015-06-14 18:00:00+09'], [$jp, '赤いきつね vs 緑のたぬき', '2015-07-03 15:00:00+09', '2015-07-04 15:00:00+09'], [$jp, 'レモンティー vs ミルクティー', '2015-07-25 15:00:00+09', '2015-07-26 15:00:00+09'], [$jp, 'キリギリス vs アリ', '2015-08-22 12:00:00+09', '2015-08-23 12:00:00+09'], [$jp, 'ボケ vs ツッコミ', '2015-09-12 12:00:00+09', '2015-09-13 12:00:00+09'], [$jp, 'イカ vs タコ', '2015-10-10 09:00:00+09', '2015-10-11 09:00:00+09'], [$jp, '愛 vs おカネ', '2015-10-31 09:00:00+09', '2015-11-01 09:00:00+09'], [$jp, '山の幸 vs 海の幸', '2015-11-21 12:00:00+09', '2015-11-22 12:00:00+09'], [$jp, '赤いきつね vs 緑のたぬき', '2015-12-26 09:00:00+09', '2015-12-27 09:00:00+09']]);
 }
开发者ID:frozenpandaman,项目名称:stat.ink,代码行数:7,代码来源:m151219_093250_splatfest.php

示例11: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(Region $region, TrainRoad $trainRoad, Stantion $stantion)
 {
     $regionsCount = $region->count();
     $tRoadsCount = $trainRoad->count();
     $stationsCount = $stantion->count();
     $condCount = Condition::count();
     $productsCount = Product::count();
     $servicesCount = Service::count();
     $catCount = Category::count();
     $statusesCount = Status::count();
     $serviceStatusesCount = ServiceStatus::count();
     $newOrdersCount = Order::where('is_new', 1)->count();
     $newServiceOrdersCount = ServiceOrder::where('is_new', 1)->count();
     $customers = Firm::where('accountant_fio', null)->get();
     return view('admin.adminArea', ['regionsCount' => $regionsCount, 'tRoadsCount' => $tRoadsCount, 'stationsCount' => $stationsCount, 'condCount' => $condCount, 'catCount' => $catCount, 'productsCount' => $productsCount, 'servicesCount' => $servicesCount, 'statusesCount' => $statusesCount, 'newOrdersCount' => $newOrdersCount, 'serviceStatusesCount' => $serviceStatusesCount, 'newServiceOrdersCount' => $newServiceOrdersCount, 'customers' => $customers]);
 }
开发者ID:kostik34,项目名称:trains.shop,代码行数:21,代码来源:AdminController.php

示例12: run

 public function run()
 {
     DB::table('regions')->delete();
     $regions = $this->api('database.getRegions', ['country_id' => 2]);
     foreach ($regions['response'] as $region) {
         Region::create(['name' => $region['title']]);
     }
 }
开发者ID:Retsediv,项目名称:edu,代码行数:8,代码来源:RegionTableSeeder.php

示例13: getOfficeOrRegion

 public function getOfficeOrRegion(Request $request)
 {
     if ($request->input('id') == 'reg') {
         $office_region = Region::select(\DB::raw("CONCAT(code,'-',name) AS full_name, id"))->lists('full_name', 'id');
     } else {
         $office_region = Office::select(\DB::raw("CONCAT(code,'-',name) AS full_name, id"))->lists('full_name', 'id');
     }
     return Response::json($office_region);
 }
开发者ID:thesaputra,项目名称:xyz-prx,代码行数:9,代码来源:UserController.php

示例14: actionDeleteRegion

 public function actionDeleteRegion($region_id, $user_id)
 {
     $user = User::findOne($user_id);
     $region = Region::findOne($region_id);
     if (!$user) {
         throw new NotFoundHttpException('Данный пользователь не существует.');
     }
     $user->unlinkRegion($region_id);
     $user->save();
 }
开发者ID:igribov,项目名称:question-list,代码行数:10,代码来源:UserLinkedOfficesRegionsController.php

示例15: safeUp

 public function safeUp()
 {
     $regionNA = Region::findOne(['key' => 'na'])->id;
     $this->batchInsert('timezone', ['identifier', 'name', 'order', 'region_id'], [['America/St_Johns', 'North America (Newfoundland)', 10001, $regionNA], ['America/Halifax', 'North America (AT)', 10002, $regionNA], ['America/Regina', 'North America (Saskatchewan)', 10003, $regionNA]]);
     $newOrder = ['America/St_Johns', 'America/Halifax', 'America/New_York', 'America/Chicago', 'America/Regina', 'America/Denver', 'America/Phoenix', 'America/Los_Angeles', 'America/Anchorage', 'America/Adak', 'Pacific/Honolulu'];
     $order = 20 + count($newOrder);
     foreach (array_reverse($newOrder) as $ident) {
         $this->update('timezone', ['order' => $order--], ['identifier' => $ident]);
     }
 }
开发者ID:frozenpandaman,项目名称:stat.ink,代码行数:10,代码来源:m160108_135055_tz.php


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