PHP code example of benmajor / redseed

1. Go to this page and download the library: Download benmajor/redseed library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

benmajor / redseed example snippets





use RedBeanPHP\R;

, 10, [
  'forename' => 'word(3,10)',
  'surname' => 'word(5,15)',
  'email' => 'email()'
]);

R::unseed('user');

# Generate 10 user beans, all with the forename property of Ben:
R::seed('user', 10, [
  'forename' => function() { return 'Ben'; } 
]);

R::seed('user', 10, [
  'forename' => 'word(5,10)',
  'surname' => 'word(10,15)',
  'email' => 'email()',
  'login' => function() {
      return R::seed('login', 2, [
        'ipaddress' => 'ipaddress()',
        'date' => 'datetime()'
      ]);
  }
]);