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


PHP Role::updateOrCreate方法代码示例

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


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

示例1: runBoards

 public function runBoards()
 {
     $this->command->comment("\tInserting board owner roles.");
     $boardRole = $this->slugs()[Role::ID_OWNER];
     foreach (Board::get() as $board) {
         $roleModel = Role::updateOrCreate(['role' => $boardRole['role'], 'board_uri' => $board->board_uri, 'caste' => $boardRole['caste']], ['name' => $boardRole['name'], 'capcode' => $boardRole['capcode'], 'inherit_id' => Role::ID_OWNER, 'system' => false, 'weight' => $boardRole['weight'] + 5]);
     }
 }
开发者ID:GodOfConquest,项目名称:infinity-next,代码行数:8,代码来源:RoleSeeder.php

示例2: run

 public function run()
 {
     $this->command->info('Seeding roles.');
     foreach ($this->slugs() as $slug) {
         Role::updateOrCreate(['role_id' => $slug['role_id']], $slug);
     }
     foreach (Board::get() as $board) {
         $boardRole = $this->slugs()[Role::ID_OWNER];
         $roleModel = Role::updateOrCreate(['role' => $boardRole['role'], 'board_uri' => $board->board_uri, 'caste' => $boardRole['caste']], ['name' => $boardRole['name'], 'capcode' => $boardRole['capcode'], 'inherit_id' => Role::ID_OWNER, 'system' => false, 'weight' => $boardRole['weight'] + 5]);
     }
 }
开发者ID:JEWSbreaking8chan,项目名称:infinity-next,代码行数:11,代码来源:RoleSeeder.php

示例3: run

 public function run()
 {
     $this->command->info('Seeding roles.');
     foreach ($this->slugs() as $slug) {
         Role::updateOrCreate(['role_id' => $slug['role_id']], $slug);
     }
     foreach (Board::get() as $board) {
         $boardRole = $this->slugs()[Role::ID_OWNER];
         $boardRole['board_uri'] = $board->board_uri;
         $boardRole['system'] = $board->board_uri;
         $boardRole['inherit_id'] = Role::ID_OWNER;
         $boardRole['weight'] += 5;
         unset($boardRole['role_id']);
         Role::updateOrCreate(['role' => $boardRole['role'], 'board_uri' => $boardRole['board_uri'], 'caste' => $boardRole['caste']], $boardRole);
     }
 }
开发者ID:Cipherwraith,项目名称:infinity-next,代码行数:16,代码来源:RoleSeeder.php

示例4: run

 public function run()
 {
     $this->command->info('Seeding roles.');
     foreach ($this->slugs() as $slug) {
         Role::updateOrCreate(['role_id' => $slug['role_id'], 'role' => $slug['role'], 'board_uri' => $slug['board_uri'], 'caste' => $slug['caste']], $slug);
     }
     foreach (Board::get() as $board) {
         $boardRole = ['role' => "owner", 'board_uri' => $board->board_uri, 'caste' => NULL, 'inherit_id' => Role::$ROLE_OWNER, 'name' => "Board Owner", 'capcode' => "Board Owner", 'system' => false];
         Role::updateOrCreate(['role' => $boardRole['role'], 'board_uri' => $boardRole['board_uri'], 'caste' => $boardRole['caste']], $boardRole);
     }
 }
开发者ID:ee-ee,项目名称:infinity-next,代码行数:11,代码来源:DatabaseSeeder.php


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