本文整理汇总了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]);
}
}
示例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]);
}
}
示例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);
}
}
示例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);
}
}