infotechnohelp / cakephp-seeds
Plugin for CakePHP 3
dev-master
2019-07-28 07:54 UTC
Requires
- cakephp/cakephp: ^3.4
- vlucas/phpdotenv: ^2.4
Requires (Dev)
- doctrine/instantiator: 1.0.*
- phpunit/phpunit: ^5.7|^6.0
- squizlabs/php_codesniffer: ^3.2
This package is auto-updated.
Last update: 2024-10-28 19:29:23 UTC
README
composer require infotechnohelp/cakephp-seeds
Terminal
bin/cake plugin load Seeds
bin/cake migrations migrate --plugin Seeds
config/TrackedSeeds/_Queue.php
<?php
return [
'UserRoles',
'Users',
];
config/TrackedSeeds/UserRoles.php
<?php
$tableAlias = "AuthApi.UserRoles";
$data = [
[
'title' => 'User',
],
[
'title' => 'Admin',
],
[
'title' => 'Moderator',
],
];
config/TrackedSeeds/Users.php
<?php
$tableAlias = "AuthApi.Users";
$data = [
[
'username' => 'Username',
'email' => 'email1@email.com',
'password' => '1234',
'user_role_id' => 1,
],
[
'username' => 'Username 2',
'email' => 'email2@email.com',
'password' => '1234',
'user_role_id' => 2,
],
[
'username' => 'Username 3',
'email' => 'email3@email.com',
'password' => '1234',
'user_role_id' => 3,
],
];
Execute
bin/cake seeds