infotechnohelp/cakephp-seeds

Plugin for CakePHP 3

Installs: 809

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Forks: 0

Type:cakephp-plugin

dev-master 2019-07-28 07:54 UTC

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