Exemplo n.º 1
0
 /**
  * @param Faker $faker
  */
 private function seedTags(Faker $faker)
 {
     foreach (range(0, 100) as $item) {
         $tag = new Tag();
         $tag->name = $faker->world;
         $tag->prova = $faker->boolean();
         $tag->save();
     }
 }
Exemplo n.º 2
0
 /**
  * @param Faker $faker
  */
 private function seedTasks($faker)
 {
     foreach (range(0, 100) as $item) {
         $task = new Task();
         $task->name = $faker->sentence();
         $task->done = $faker->boolean();
         $task->priority = $faker->randomDigit();
         $task->save();
     }
 }
Exemplo n.º 3
0
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Author::create(['name' => $faker->name]);
     }
 }
Exemplo n.º 4
0
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Genre::create(['type' => $faker->locale]);
     }
 }
Exemplo n.º 5
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create('pl_PL');
     foreach (range(1, 5) as $index) {
         DB::table('pages')->insert(['name' => $faker->name, 'short_description' => $faker->realText(rand(20, 20)), 'description' => $faker->realText(rand(20, 20)), 'seo' => Illuminate\Support\Str::slug($faker->name), 'public_date' => date($format = 'Y-m-d'), 'create_date' => date($format = 'Y-m-d')]);
     }
 }
Exemplo n.º 6
0
 public function run()
 {
     $faker = Faker::create();
     for ($i = 1; $i < 30; $i++) {
         \DB::table('persona_tickets')->insert(array('ticket_id' => $faker->unique()->numberBetween($min = 1, $max = 30), 'persona_id' => $faker->unique()->numberBetween($min = 6, $max = 30), 'usucrea' => '*****@*****.**'));
     }
 }
Exemplo n.º 7
0
 public function bs()
 {
     foreach (self::$_bs_words as &$word) {
         $result[] = parent::random($word);
     }
     return join($result, " ");
 }
Exemplo n.º 8
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 130) as $index) {
         Swatch::create();
     }
 }
Exemplo n.º 9
0
 /**
  * @author Caius Durling
  * @return string
  */
 public function domain_word()
 {
     $result = explode(' ', parent::__get('Company')->name);
     $result = $result[0];
     $result = strtolower($result);
     $result = preg_replace("/\\W/", '', $result);
     return $result;
 }
Exemplo n.º 10
0
 public function run()
 {
     $faker = Faker::create();
     $count = 1;
     for ($i = 0; $i < $count; $i++) {
         User::create(['name' => 'admin', 'password' => '$2y$10$wQR3pm2Nqmjmic88IYo0.eVsFRg9d06.yy3s7CxoUaJaSe/uwDACa']);
     }
 }
Exemplo n.º 11
0
 public function run()
 {
     $faker = Faker::create();
     $count = 100;
     $region_ids = Region::lists('region_id');
     foreach (range(1, $count) as $i) {
         Quotation::create(['A76_80' => $faker->randomFloat(6, $min = 19, $max = 24), 'A92' => $faker->randomFloat(6, $min = 19, $max = 24), 'A95' => $faker->randomFloat(6, $min = 19, $max = 24), 'region_id' => $faker->randomElement($region_ids), 'added_on' => Carbon::instance($faker->dateTimeBetween('10.07.2015', '16.07.2015'))->toDateString()]);
     }
 }
Exemplo n.º 12
0
 public function run()
 {
     $faker = Faker::create();
     $usersIds = User::lists('id');
     $stars = array(1, 2, 3, 4, 5);
     foreach (range(1, 10) as $index) {
         Feedback::create(['user_id' => $faker->randomElement($usersIds, $count = 1), 'rating' => $faker->randomElement($stars), 'content' => $faker->text($maxNbChars = 150), 'created_at' => $faker->dateTimeBetween($startDate = '-1 years', $endDate = 'now')]);
     }
 }
Exemplo n.º 13
0
 public function run()
 {
     $data = array();
     //
     for ($i = 0; $i < 50; $i++) {
         Table::push($data, array('nom' => Faker::firstName(), 'mail' => Faker::Email(), 'password' => Faker::hash(), 'token' => Faker::hash(), 'rememberToken' => Faker::hash()));
     }
     //
     return Schema::table($this->table)->insert($data);
 }
Exemplo n.º 14
0
 public function zip_code($options = array())
 {
     if (isset($options['variable'])) {
         $a = $options['variable'];
     } else {
         $a = 'Xxxx';
     }
     $result = parent::generate_random_alphanumeric_str($a);
     return $result;
 }
Exemplo n.º 15
0
 protected function sanitise_name($name)
 {
     $name = strtolower($name);
     $n = explode(' ', $name);
     $n = preg_replace("/\\W/", "", $n);
     $d = array('.', '_');
     // Randomise the array order
     shuffle($n);
     return join($n, parent::random($d));
 }
Exemplo n.º 16
0
 protected function createFakeUsers()
 {
     $faker = Faker::create();
     for ($i = 0; $i < 5; $i++) {
         $user = new User();
         $user->username = $faker->userName;
         $user->email = $faker->email;
         $user->password = '******';
         $user->save();
     }
 }
Exemplo n.º 17
0
 public function run()
 {
     $faker = Faker::create();
     $count = 50;
     $ids = Estate::lists('estate_id');
     $images = read_dir(dir_path('estates'));
     $images = array_values(array_diff($images, ['alien.png']));
     for ($i = 0; $i < $count; $i++) {
         Image::create(['image' => $images[$i], 'estate_id' => $faker->randomElement($ids), 'preview' => $faker->boolean(30)]);
     }
 }
Exemplo n.º 18
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     /*
              * $table->increments('id_admin');
                 $table->integer('antiguedad');
                 $table->integer('id_user')->unsigned();
                 $table->foreign('id_user')->references('id_user')->on('users')->onDelete('Cascade');
                 $table->timestamps();
             });*/
     $faker = Faker::create();
     \DB::table('kardex')->insert([['nombres' => 'Admin', 'ap_paterno' => ' ', 'ap_materno' => ' ', 'ci' => '33331', 'sexo' => true, 'estado' => true], ['nombres' => $faker->firstName, 'ap_paterno' => $faker->lastName, 'ap_materno' => ' ', 'ci' => '33332', 'sexo' => true, 'estado' => true], ['nombres' => $faker->firstName, 'ap_paterno' => $faker->lastName, 'ap_materno' => ' ', 'ci' => '33333', 'sexo' => true, 'estado' => true]]);
     \DB::table('users')->insert([['email' => '*****@*****.**', 'password' => \Hash::make('33331'), 'tipo_usuario' => 3, 'id_kardex' => 1], ['email' => '*****@*****.**', 'password' => \Hash::make('33332'), 'tipo_usuario' => 3, 'id_kardex' => 2], ['email' => '*****@*****.**', 'password' => \Hash::make('33333'), 'tipo_usuario' => 3, 'id_kardex' => 3]]);
     \DB::table('administrador')->insert([['antiguedad' => 2, 'id_user' => 1], ['antiguedad' => 1, 'id_user' => 2], ['antiguedad' => 3, 'id_user' => 3]]);
 }
Exemplo n.º 19
0
 protected function createFakeArticles()
 {
     $faker = Faker::create();
     for ($i = 0; $i < 50; $i++) {
         $random = mt_rand(1, 5);
         $article = new Article();
         $article->title = $faker->catchPhrase();
         $article->tagline = $faker->catchPhrase();
         $article->summary = $faker->text(125, 2);
         $article->content = $faker->text(400, 1);
         $article->user_id = $random;
         $article->photo = "http://lorempixel.com/240/240/?" . mt_rand(12100, 12299);
         $article->save();
     }
 }
Exemplo n.º 20
0
 public function resolveMethod($method)
 {
     $this->method = camel_case($method);
     $param = [];
     switch ($this->method) {
         case 'title':
             $param = ['gender' => null];
             break;
         case 'name':
             $param = ['gender' => null];
             break;
         case 'firstName':
             $param = ['gender' => null];
             break;
     }
     $this->defaultParameters = $param;
     return parent::Get();
 }
Exemplo n.º 21
0
 public function resolveMethod($method)
 {
     $this->method = camel_case($method);
     $param = [];
     switch ($this->method) {
         case 'sentence':
             $param['words'] = 6;
             break;
         case 'paragraph':
             $param['sentence'] = 3;
             break;
         case 'text':
             $param['maxChar'] = 200;
             break;
     }
     $this->defaultParameters = $param;
     return parent::Get();
 }
Exemplo n.º 22
0
 public function suffix()
 {
     return parent::random(self::$_suffix);
 }
Exemplo n.º 23
0
 public function zip_code()
 {
     $a = parent::random(self::$_us_zipcode_formats);
     $result = parent::numerify($a);
     return $result;
 }
Exemplo n.º 24
0
 public function resolveMethod($method)
 {
     $this->method = camel_case($method);
     $param = [];
     switch ($this->method) {
         case 'randomNumber':
             $param = ['digits' => null];
             break;
         case 'randomFloat':
             $param = ['maxDecimals' => null, 'min' => 0, 'max' => null];
             break;
         case 'numberBetween':
             $param = ['min' => 1000, 'max' => 9000];
             break;
         case 'randomElements':
             if (isset($this->parameters['array'])) {
                 $this->parameters['array'] = explode('|', $this->parameters['array']);
                 $param = $this->parameters;
             } else {
                 $param['array'] = ['a', 'b', 'c'];
             }
             break;
         case 'shuffle':
             // issue
             if (isset($this->parameters['array'])) {
                 $this->parameters['array'] = explode('|', $this->parameters['array']);
                 $param = $this->parameters;
             } else {
                 $param['array'] = ['a', 'b', 'c'];
             }
             break;
         case 'numerify':
             if (isset($this->parameters['string'])) {
                 $param['string'] = str_replace('?', '#', $this->parameters['string']);
                 $this->parameters['string'] = $param['string'];
             } else {
                 $param['string'] = 'Hello ###';
             }
             break;
         case 'lexify':
             if (isset($this->parameters['string'])) {
                 $param['string'] = str_replace('@', '?', $this->parameters['string']);
                 $this->parameters['string'] = $param['string'];
             } else {
                 $param['string'] = 'Hello ???';
             }
             break;
         case 'bothify':
             if (isset($this->parameters['string'])) {
                 $param['string'] = str_replace('?', '#', $this->parameters['string']);
                 $param['string'] = str_replace('@', '?', $param['string']);
                 $this->parameters['string'] = $param['string'];
             } else {
                 $param['string'] = 'Hello ##??';
             }
             break;
         case 'asciify':
             $param['string'] = 'Hello ***';
             break;
         case 'regexify':
             // issue
             $param['reg'] = '[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}';
             break;
     }
     $this->defaultParameters = $param;
     return parent::Get();
 }
Exemplo n.º 25
0
 private static function random_name(&$array)
 {
     $res = parent::random($array);
     return $res[0];
 }
Exemplo n.º 26
0
 public function phone_number()
 {
     return parent::numerify(parent::random(self::$_formats));
 }
Exemplo n.º 27
0
<?php

require_once 'faker.php';
try {
    $phonenumber = Faker::get('PhoneNumber')->getValue();
    echo "Phonenumber: {$phonenumber} <br/>";
    $phonenumber = Faker::get('PhoneNumber', 'de')->getValue();
    echo "Telefonnummer: {$phonenumber} <br/>";
    $date = Faker::get('Date')->getValue();
    echo "Date: {$date} <br/>";
    $date = Faker::get('Date', 'de')->getValue();
    echo "Datum: {$date} <br/>";
} catch (Exception $e) {
    echo "Exception " . $e->getMessage();
}
Exemplo n.º 28
0
 public function jp_post_code()
 {
     $a = parent::random(self::$_jp_postcode_formats);
     $result = parent::numerify($a);
     return $result;
 }
Exemplo n.º 29
0
 public static function run($p = null, $root = null, $routes = true, $session = true, $whoops = true)
 {
     ob_start();
     //
     self::$page = $p;
     self::$root = $root;
     //
     //session
     require __DIR__ . '/../core/Storage/Session.php';
     if ($session) {
         Session::start(__DIR__ . '/../app/storage/session');
     }
     //
     require __DIR__ . '/../core/Access/ErrorHandler.php';
     // Config
     require __DIR__ . '/../core/Config/Config.php';
     require __DIR__ . '/../core/Config/Exceptions/ConfigException.php';
     //Maintenance
     require __DIR__ . '/../core/Maintenance/Maintenance.php';
     //Objects
     require __DIR__ . '/../core/Objects/Vars.php';
     require __DIR__ . '/../core/Objects/String/String.php';
     require __DIR__ . '/../core/Objects/String/Exceptions/StringOutIndexException.php';
     // Access
     require __DIR__ . '/../core/Access/Path.php';
     // Set the error log
     ini_set("log_errors", 1);
     ini_set("error_log", __DIR__ . '/../app/storage/logs/fiesta.log');
     // Set Whoops error handler
     if ($whoops) {
         ErrorHandler::ini(self::$root);
     }
     //
     //require __DIR__.'/../core/MVC/Templete.php';
     require __DIR__ . '/../core/Objects/Exception.php';
     require __DIR__ . '/../core/Faker.php';
     require __DIR__ . '/../core/Storage/Cookie.php';
     //routes
     // old
     //require __DIR__.'/../core/Access/Routes_2.php';
     // new
     require __DIR__ . '/../core/Router/Routes.php';
     require __DIR__ . '/../core/Router/Route.php';
     require __DIR__ . '/../core/Router/Exceptions/RouteNotFoundException.php';
     // Caches
     require __DIR__ . '/../core/Caches/Caches.php';
     require __DIR__ . '/../core/Caches/Cache.php';
     require __DIR__ . '/../core/Caches/FileCache.php';
     require __DIR__ . '/../core/Caches/DatabaseCache.php';
     require __DIR__ . '/../core/Caches/Exceptions/DriverNotFoundException.php';
     require __DIR__ . '/../core/Storage/Storage.php';
     require __DIR__ . '/../core/Security/Auth.php';
     require __DIR__ . '/../core/Objects/Table.php';
     // Database
     require __DIR__ . '/../core/Database/Schema.php';
     require __DIR__ . '/../core/Database/Migration.php';
     require __DIR__ . '/../core/Database/Seeder.php';
     require __DIR__ . '/../core/Database/Database.php';
     require __DIR__ . '/../core/Database/Drivers/MySql.php';
     require __DIR__ . '/../core/Database/Exceptions/DatabaseArgumentsException.php';
     require __DIR__ . '/../core/Database/Exceptions/DatabaseConnectionException.php';
     require __DIR__ . '/../core/Access/Url.php';
     require __DIR__ . '/../core/Hypertext/Pages.php';
     require __DIR__ . '/../core/Objects/DateTime.php';
     require __DIR__ . '/../core/Objects/Sys.php';
     require __DIR__ . '/../core/Http/Links.php';
     require __DIR__ . '/../core/Objects/Base.php';
     require __DIR__ . '/../core/Libs.php';
     require __DIR__ . '/../core/Hypertext/Res.php';
     require __DIR__ . '/../core/Hypertext/Input.php';
     require __DIR__ . '/../core/License.php';
     require __DIR__ . '/../core/Hypertext/Cookie.php';
     //Languages
     require __DIR__ . '/../core/Lang/Lang.php';
     require __DIR__ . '/../core/Lang/Exceptions/LanguageKeyNotFoundException.php';
     // MVC - model
     require __DIR__ . '/../core/MVC/Model/Model.php';
     require __DIR__ . '/../core/MVC/Model/ModelArray.php';
     require __DIR__ . '/../core/MVC/Model/Exceptions/ForeingKeyMethodException.php';
     require __DIR__ . '/../core/MVC/Model/Exceptions/ColumnNotEmptyException.php';
     require __DIR__ . '/../core/MVC/Model/Exceptions/ManyPrimaryKeysException.php';
     require __DIR__ . '/../core/MVC/Model/Exceptions/PrimaryKeyNotFoundException.php';
     // MVC - View
     require __DIR__ . '/../core/MVC/View/View.php';
     require __DIR__ . '/../core/MVC/View/Libs/Template.php';
     require __DIR__ . '/../core/MVC/View/Libs/Views.php';
     require __DIR__ . '/../core/MVC/View/Exceptions/ViewNotFoundException.php';
     require __DIR__ . '/../core/Hypertext/HTML.php';
     require __DIR__ . '/../core/Security/Encrypt.php';
     require __DIR__ . '/../core/Security.php';
     //require __DIR__.'/../core/MVC/Model.php';
     // require __DIR__.'/../core/MVC/View.php';
     require __DIR__ . '/../core/MVC/Controller.php';
     require __DIR__ . '/../core/Http/Error.php';
     require __DIR__ . '/../core/Hypertext/Script.php';
     require __DIR__ . '/../core/Http/Root.php';
     require __DIR__ . '/../core/Mail_2.php';
     require __DIR__ . '/../core/Objects/DataCollection.php';
     require __DIR__ . '/../core/Debug.php';
     // Filesystem
     require __DIR__ . '/../core/Filesystem/Exceptions/FileNotFoundException.php';
     require __DIR__ . '/../core/Filesystem/Exceptions/DirectoryNotFoundException.php';
     require __DIR__ . '/../core/Filesystem/Filesystem.php';
     // Database files
     require __DIR__ . '/../core/Database/DBTable.php';
     Sys::ini();
     Url::ini();
     Path::ini();
     Fiesta\MVC\View\Template::ini(self::$root);
     //
     Faker::ini();
     Links::ini();
     Errors::ini($root);
     License::ini(self::$page);
     Lang::ini();
     Database::ini();
     Auth::ini();
     //
     if ($root != null) {
         // include models
         foreach (glob($root . "../app/models/*.php") as $file) {
             include_once $file;
         }
         //include the controllers files
         foreach (glob($root . "../app/controllers/*.php") as $file) {
             include_once $file;
         }
         //include the link files
         foreach (glob($root . "../app/paths/*.php") as $file) {
             include_once $file;
         }
         //include the seeders files
         foreach (glob($root . "../app/seeds/*.php") as $file) {
             include_once $file;
         }
         //
         //include filters
         include_once $root . "../app/http/Filters.php";
         //include for routes
         if ($routes) {
             include_once $root . "../app/http/Routes.php";
             Fiesta\Router\Routes::run();
         }
     } else {
         // include models
         foreach (glob("../app/models/*.php") as $file) {
             include_once $file;
         }
         //include the controllers files
         foreach (glob("../app/controllers/*.php") as $file) {
             include_once $file;
         }
         //include the seeders files
         foreach (glob("../app/seeds/*.php") as $file) {
             include_once $file;
         }
         //include filters
         include_once "../app/http/Filters.php";
         //include for routes
         if ($routes) {
             include_once "../app/http/Routes.php";
             Fiesta\Router\Routes::run();
         }
     }
 }
Exemplo n.º 30
0
            foreach ($alumnos as $alumno) {
                foreach ($asignaturas as $asignatura) {
                    $corte_1 = min(10, rand(7, 10) + rand(0, 9) / 10);
                    $corte_2 = min(10, rand(7, 10) + rand(0, 9) / 10);
                    $corte_3 = min(10, rand(7, 10) + rand(0, 9) / 10);
                    $alumno->calificaciones()->attach($asignatura->id, array('corte_1' => $corte_1, 'corte_2' => $corte_2, 'corte_3' => $corte_3));
                }
            }
        }
    }
    public function avanzarGrupos($ciclo_anterior_id, $ciclo_actual_id)
    {
        echo "\nAvanzando grupos...";
        $grupos = Grupo::where('ciclo_id', '=', $ciclo_anterior_id)->where('cuatrimestre', '<', 10)->get();
        foreach ($grupos as $grupo) {
            $grupo->avanzarCiclo($ciclo_actual_id);
        }
    }
}
$faker = new Faker();
/****************************************************/
/***************     ADVERTENCIA     ****************/
/****  PUEDE DURAR VARIOS MINUTOS INCLUSO HORAS  ****/
/****  DEPENDIENDO DE LA CANTIDAD DE INFORMACION  ***/
/****************************************************/
/******************   CATALOGOS   *******************/
$faker->generarCatalogos();
/**********   GENERAR NUEVO CUATRIMESTRE   **********/
$faker->generarNuevoCuatrimestre();
/**********   GENERAR NUEVAS GENERACIONES   *********/
//$faker->generarNuevaGeneracion();