Some checks are pending
Module sub-split / Sub-split (push) Waiting to run
- Base: wintercms/winter branch 1.2 (full framework) - Theme vivespos: Canvas 7 + Bootstrap 5 CDN, custom CSS - Layout: deferred GTM/GA4 tracking, JSON-LD SoftwareApplication - Partials: hero (offline-first), features, modes (offline/nube toggle), screenshots, pricing (3 planes), comparison, FAQ, CTA - Plugin VivesPOS.Site with ContactForm - Dockerfile: PHP 8.2 Apache, port 80, healthcheck - Added winter/wn-pages, blog, sitemap, seo plugins - Active theme set to vivespos
63 lines
1.8 KiB
PHP
63 lines
1.8 KiB
PHP
<?php namespace Backend\Database\Seeds;
|
|
|
|
use Seeder;
|
|
use Backend\Models\User;
|
|
use Backend\Models\UserRole;
|
|
use Backend\Models\UserGroup;
|
|
|
|
class SeedSetupAdmin extends Seeder
|
|
{
|
|
public static $email = 'admin@example.com';
|
|
public static $login = 'admin';
|
|
public static $password = '';
|
|
public static $firstName = 'Admin';
|
|
public static $lastName = 'Person';
|
|
|
|
public function setDefaults($values)
|
|
{
|
|
if (!is_array($values)) {
|
|
return;
|
|
}
|
|
foreach ($values as $attribute => $value) {
|
|
static::$$attribute = $value;
|
|
}
|
|
}
|
|
|
|
public function run()
|
|
{
|
|
UserRole::create([
|
|
'name' => 'Publisher',
|
|
'code' => UserRole::CODE_PUBLISHER,
|
|
'description' => 'Site editor with access to publishing tools.',
|
|
]);
|
|
|
|
$role = UserRole::create([
|
|
'name' => 'Developer',
|
|
'code' => UserRole::CODE_DEVELOPER,
|
|
'description' => 'Site administrator with access to developer tools.',
|
|
]);
|
|
|
|
$group = UserGroup::create([
|
|
'name' => 'Owners',
|
|
'code' => UserGroup::CODE_OWNERS,
|
|
'description' => 'Default group for website owners.',
|
|
'is_new_user_default' => false
|
|
]);
|
|
|
|
$user = User::create([
|
|
'email' => static::$email,
|
|
'login' => static::$login,
|
|
'password' => static::$password,
|
|
'password_confirmation' => static::$password,
|
|
'first_name' => static::$firstName,
|
|
'last_name' => static::$lastName,
|
|
'permissions' => [],
|
|
'is_superuser' => true,
|
|
'is_activated' => true,
|
|
'role_id' => $role->id
|
|
]);
|
|
|
|
$user->addGroup($group);
|
|
}
|
|
}
|