Ejemplo n.º 1
0
 public static function generateImageToken()
 {
     $factory = new \Faker\Factory();
     $faker = $factory->create();
     $base = Carbon::now('America/Sao_Paulo')->format('YmdHis') . '????';
     return $faker->lexify($base);
 }
Ejemplo n.º 2
0
 public function run()
 {
     $faker = Faker\Factory::create();
     for ($i = 0; $i < 5; $i++) {
         DB::table('training')->insert(['name' => $faker->unique()->word, 'created_at' => $faker->dateTime($max = 'now')]);
     }
 }
Ejemplo n.º 3
0
 public function setUp()
 {
     parent::setUp();
     // Don't forget this!
     $this->faker = Faker\Factory::create();
     //$this->prepareForTests();
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     //starte creating the ppmreport here
     Schema::create('cmreport', function (Blueprint $table) {
         $table->increments('id');
         $table->integer('jobId')->unique()->unsigned();
         $table->string('location');
         $table->date('dateStarted');
         $table->time('timeStarted');
         $table->string('jobDescription');
         $table->string('planner');
         $table->string('technician');
         $table->string('supervisor');
         $table->string('faultCode')->nullable();
         $table->string('repairCode')->nullable();
         $table->string('rootCauseCode')->nullable();
         $table->date('dateEnded')->nullable();
         $table->time('timeEnded')->nullable();
         $table->string('engrRemark')->nullable();
         $table->boolean('tag')->default(0);
         $table->timestamps();
     });
     $faker = Faker\Factory::create();
     $limit = 5;
     for ($i = 0; $i < $limit; $i++) {
         DB::table('cmreport')->insert(['job_id' => $faker->text(), 'location' => $faker->address(), 'main_type' => $faker->text(), 'date_done' => $faker->date(), 'time_started' => $faker->text(), 'job_description' => $faker->text(), 'planner' => $faker->text(), 'technician' => $faker->text, 'supervisor' => $faker->text(), 'report_code' => $faker->text(), 'fault_code' => $faker->text(), 'repair_code' => $faker->text(), 'root_cause_code' => $faker->text(), 'date_ended' => $faker->date(), 'engr_remark' => $faker->text()]);
     }
 }
Ejemplo n.º 5
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $fake = Faker\Factory::create();
     foreach (Outlet::all() as $outlet) {
         $customers = $outlet->company->customers;
         $employees = $outlet->users;
         $tax = $outlet->tax;
         $discounts = $outlet->company->discounts;
         $payments = $outlet->company->payments;
         //create order
         $orders = [];
         foreach (range(1, 100) as $i) {
             $orders[] = factory(Order::class)->create(['outlet_id' => $outlet->id, 'customer_id' => $customers->random()->id, 'user_id' => $employees->random()->id, 'payment_id' => $payments->random()->id, 'tax_id' => $tax->id, 'discount_id' => $discounts->random()->id]);
         }
         foreach ($orders as $order) {
             $variantIds = $outlet->variants->random(10)->lists('id')->toArray();
             $order->variants()->attach($variantIds, ['total' => $fake->numberBetween(10, 100), 'nego' => 0]);
         }
         //select random order to void by random employee
         foreach (range(1, 5) as $i) {
             factory(Void::class)->create(['user_id' => $employees->random()->id, 'order_id' => $orders[mt_rand(1, 99)]->id]);
         }
         //select random order to void by random employee
         foreach (range(1, 5) as $i) {
             factory(Debt::class)->create(['order_id' => $orders[mt_rand(1, 99)]->id]);
         }
     }
 }
Ejemplo n.º 6
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     foreach (range(1, 300) as $index) {
         Content::create(['title' => $faker->sentence, 'content' => $faker->paragraph(4), 'images' => '[]', 'thumb_images' => '[]', 'category_id' => '1', 'visitor_count' => '0', 'created_by' => '2', 'updated_by' => '2', 'status' => '1']);
     }
 }
Ejemplo n.º 7
0
 public function __construct()
 {
     $this->faker = Faker\Factory::create();
     $this->title = 'Weblink' . $this->faker->randomNumber();
     $this->url = $this->faker->url();
     $this->menuItem = 'Menu Item' . $this->faker->randomNumber();
 }
 public function run()
 {
     $faker = Faker\Factory::create();
     foreach (range(1, 30) as $index) {
         Joke::create(['body' => $faker->paragraph($nbSentences = 3), 'user_id' => $faker->numberBetween($min = 1, $max = 5)]);
     }
 }
Ejemplo n.º 9
0
 public function run()
 {
     $faker = Faker\Factory::create();
     for ($i = 0; $i < 10; $i++) {
         DB::table('userdetails')->insert(['job_id' => rand(1, 5), 'right_id' => rand(1, 5), 'user_id' => rand(1, 10), 'ip' => $faker->ipv4, 'training_id' => rand(1, 5), 'firstname' => $faker->firstName, 'lastname' => $faker->lastName, 'address' => $faker->address, 'city' => $faker->city, 'country' => $faker->country, 'birthday' => $faker->date($format = 'd-m-Y', $max = '31-12-2010'), 'avatar' => $faker->word, 'visibility' => rand(0, 1), 'bio' => $faker->paragraph($nbSentences = 3, $variableNbSentences = true), 'asso' => rand(0, 1), 'created_at' => $faker->dateTime($max = 'now'), 'website' => $faker->url]);
     }
 }
Ejemplo n.º 10
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     for ($i = 1; $i < 11; $i++) {
         DB::table('blog_post_tags')->insert(['post_id' => $i, 'tag_id' => $faker->numberBetween($min = 1, $max = 2)]);
     }
 }
Ejemplo n.º 11
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     DB::table('forum_groups')->insert(['title' => 'Site news']);
     DB::table('forum_groups')->insert(['title' => 'General']);
     DB::table('forum_groups')->insert(['title' => 'Media']);
 }
Ejemplo n.º 12
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $admin = new User();
     $admin->name = 'Henry Leon Gomez';
     $admin->email = '*****@*****.**';
     $admin->password = bcrypt("henry");
     $admin->perfil = 'root';
     $admin->save();
     $accesos = new Accesos();
     $accesos->user_id = $admin->id;
     $accesos->create = 1;
     $accesos->read = 1;
     $accesos->update = 1;
     $accesos->delete = 1;
     for ($i = 0; $i < 25; $i++) {
         $usuario = new User();
         $faker = Faker\Factory::create();
         $usuario->name = $faker->name;
         $usuario->email = $faker->email;
         $usuario->password = bcrypt($faker->name);
         $usuario->perfil = 'usuario';
         $usuario->save();
         $accesos = new Accesos();
         $accesos->user_id = $usuario->id;
         $accesos->create = 0;
         $accesos->read = 0;
         $accesos->update = 0;
         $accesos->delete = 0;
     }
 }
Ejemplo n.º 13
0
 public function run()
 {
     $films = [];
     $faker = Faker\Factory::create('es_MX');
     for ($i = 0; $i < self::AMOUNT; $i++) {
         $film = array();
         $film['title'] = implode(' ', $faker->words(rand(3, 6)));
         $film['slug'] = \Illuminate\Support\Str::slug($film['title']) . '-' . rand(0, 4);
         $film['original_title'] = 'Original' . $film['title'];
         $film['years'] = self::getListOfYears();
         $film['duration'] = $faker->time();
         $film['genre_id'] = rand(0, 10);
         $film['director'] = self::getListOfNames($faker);
         $film['script'] = self::getListOfNames($faker);
         $film['photographic'] = self::getListOfNames($faker);
         $film['music'] = self::getListOfNames($faker);
         $film['edition'] = self::getListOfNames($faker);
         $film['production'] = self::getListOfNames($faker);
         $film['cast'] = self::getListOfNames($faker);
         $film['synopsis'] = $faker->paragraphs(rand(1, 5), true);
         $film['notes'] = $faker->paragraphs(rand(0, 6), true);
         $film['trailer'] = '<iframe width="560" height="315" src="https://www.youtube.com/embed/Gjg_Mi0zLlg" frameborder="0" allowfullscreen></iframe>';
         $film['created_at'] = new DateTime();
         $film['updated_at'] = new DateTime();
         array_push($films, $film);
     }
     DB::table('films')->truncate();
     DB::table('films')->insert($films);
 }
Ejemplo n.º 14
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     for ($i = 1; $i <= 20; $i++) {
         DB::table('author')->insert(['id' => $i, 'name' => $faker->name]);
     }
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     foreach (range(1, 10) as $index) {
         Badge::create(['title' => $faker->colorName, 'icon' => $faker->imageUrl(80, 80, 'abstract')]);
     }
 }
Ejemplo n.º 16
0
 public function run()
 {
     $faker = Faker\Factory::create();
     for ($i = 0; $i < 200; $i++) {
         $new = TopicAnswer::create(array('tid' => $faker->randomDigitNotNull, 'author' => $faker->name, 'message' => $faker->paragraphs(5, true), 'place' => $faker->randomElement(array('web', 'api')), 'updated_at' => $faker->dateTime('now'), 'created_at' => $faker->dateTime('now')));
     }
 }
Ejemplo n.º 17
0
 /**
  * A basic functional test example.
  *
  * @return void
  */
 public function testViewingPopularPuzzles()
 {
     $faker = Faker\Factory::create();
     $user = factory(User::class)->create(['username' => 'johndoe1']);
     $name = $faker->sentence;
     $width = 10;
     $height = 10;
     $blackSquares = array();
     $args = array('name' => $name, 'width' => $width, 'height' => $height, 'blackSquares' => $blackSquares, 'user_id' => $user->id);
     $puzzleTemplate = PuzzleTemplate::create($args);
     $puzzleSquares = array();
     $clues = array();
     $args = array('name' => 'My first puzzle', 'puzzle_template_id' => $puzzleTemplate->id, 'puzzle_squares' => $puzzleSquares, 'clues' => $clues, 'user_id' => $user->id);
     $puzzle1 = Puzzle::create($args);
     $args = array('name' => 'My second puzzle', 'puzzle_template_id' => $puzzleTemplate->id, 'puzzle_squares' => $puzzleSquares, 'clues' => $clues, 'user_id' => $user->id);
     $puzzle2 = Puzzle::create($args);
     $args = array('name' => 'My third puzzle', 'puzzle_template_id' => $puzzleTemplate->id, 'puzzle_squares' => $puzzleSquares, 'clues' => $clues, 'user_id' => $user->id);
     $puzzle3 = Puzzle::create($args);
     $args = array('name' => 'My fourth puzzle', 'puzzle_template_id' => $puzzleTemplate->id, 'puzzle_squares' => $puzzleSquares, 'clues' => $clues, 'user_id' => $user->id);
     $puzzle4 = Puzzle::create($args);
     $args = array('name' => 'My fifth puzzle', 'puzzle_template_id' => $puzzleTemplate->id, 'puzzle_squares' => $puzzleSquares, 'clues' => $clues, 'user_id' => $user->id);
     $puzzle5 = Puzzle::create($args);
     /*
     //sqlite doesn't like from_unixtime()
     $this->visit('/puzzles/list')->see('My first puzzle');
     $this->visit('/puzzles/list')->see('My second puzzle');
     $this->visit('/puzzles/list')->see('My third puzzle');
     $this->visit('/puzzles/list')->see('My fourth puzzle');
     $this->visit('/puzzles/list')->see('My fifth puzzle');
     */
 }
Ejemplo n.º 18
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Eloquent::unguard();
     DB::table('tags')->truncate();
     //DB::table('pastes')->truncate();
     $faker = Faker\Factory::create();
     $paste_count = 10;
     $tags = array('php', 'javascript', 'ruby', 'js', 'cpp', 'c++', 'c#', 'go', 'html', 'css');
     for ($i = 0; $i < $paste_count; $i++) {
         $tags_per_paste = rand(1, 3);
         // Generate the paste
         $examplePaste = new Paste();
         $examplePaste->paste = $faker->paragraph;
         $examplePaste->title = $faker->realText(46);
         $examplePaste->expire = $faker->dateTime($max = 'now');
         $examplePaste->token = Str::random(40);
         $examplePaste->private = rand(0, 1);
         $examplePaste->delete_token = Str::random(40);
         $examplePaste->save();
         // Attach some tags to the new paste
         for ($i = 0; $i < $tags_per_paste; ++$i) {
             $exampleTag = new Tag();
             $exampleTag->tag = $tags[rand(0, sizeof($tags) - 1)];
             $exampleTag->paste_id = $examplePaste->id;
             $examplePaste->tags()->save($exampleTag);
         }
         print "Seeded paste with ID of " . $examplePaste->id . "\n";
     }
 }
Ejemplo n.º 19
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     for ($i = 0; $i < 20; $i++) {
         Account::create(['id' => null, 'user_id' => $faker->numberBetween(1, 30), 'date_opened' => $faker->dateTimeBetween('-10 years'), 'name' => $faker->creditCardType(), 'balance' => $faker->randomFloat(2, 0, 1000), 'interest' => $faker->randomFloat(2, 0, 1), 'interest_period' => $faker->numberBetween(1, 12)]);
     }
 }
Ejemplo n.º 20
0
 public function run()
 {
     $faker = Faker\Factory::create();
     for ($i = 0; $i < 5; $i++) {
         DB::table('tags')->insert(['name' => $faker->unique()->word]);
     }
 }
 public function run()
 {
     $faker = Faker\Factory::create();
     for ($i = 0; $i < 20; $i++) {
         DB::table('product_tags')->insert(['product_id' => $faker->numberBetween(1, 10), 'tag_id' => $faker->numberBetween(1, 10)]);
     }
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create('pt_BR');
     foreach (range(1, 90) as $index) {
         DB::table('eventos_participantes')->insert(['evento_id' => 1, 'usuario_id' => $faker->unique()->numberBetween($min = 1, $max = 155), 'created_at' => $faker->dateTimeThisMonth($max = 'now'), 'updated_at' => $faker->dateTimeThisMonth($max = 'now')]);
     }
 }
Ejemplo n.º 23
0
 public function run()
 {
     DB::statement('SET FOREIGN_KEY_CHECKS = 0');
     // disable foreign key constraints
     // Reset table
     DB::table('users')->truncate();
     // Reset table
     DB::table('user_details')->truncate();
     $admin_account = Config::get('cms::settings.admin_account');
     $admin_settings = array('role_id' => 1, 'lang' => Config::get('cms::settings.language'), 'editor' => 0, 'is_active' => 1);
     $admin_user = array_merge($admin_account, $admin_settings);
     $admin_user['password'] = Hash::make($admin_user['password']);
     $admin = User::create($admin_user);
     UserDetail::create(array('user_id' => $admin->id));
     // RANDOM 50 USERS
     // Faker data
     $faker = Faker\Factory::create();
     for ($i = 1; $i <= 50; $i++) {
         $user_settings = array('role_id' => 4, 'username' => $faker->username, 'email' => $faker->email, 'password' => Hash::make($faker->word), 'lang' => Config::get('cms::settings.language'), 'editor' => 0, 'is_active' => 1);
         $user = User::create($user_settings);
         $details = array('firstname' => $faker->firstname, 'lastname' => $faker->lastname, 'gender' => $faker->randomElement(array('m', 'f')), 'city' => $faker->city, 'bio' => $faker->text, 'birth_date' => $faker->date('Y-m-d', '-18 years'));
         $user->details()->create($details);
     }
     DB::statement('SET FOREIGN_KEY_CHECKS = 1');
     // enable foreign key constraints
 }
 public function run()
 {
     $faker = Faker\Factory::create();
     foreach (range(1, 5) as $index) {
         User::create(['name' => $faker->userName, 'email' => $faker->email, 'password' => bcrypt('secret')]);
     }
 }
Ejemplo n.º 25
0
 /**
  * Run the database seeds.
  */
 public function run()
 {
     $faker = Faker\Factory::create('id_ID');
     App\Guru::create(['nip' => '000', 'nama' => $faker->name, 'username' => '000', 'password' => bcrypt('000'), 'staf' => 1]);
     App\Guru::create(['nip' => '111', 'nama' => $faker->name, 'username' => '111', 'password' => bcrypt('111'), 'staf' => 2]);
     App\Guru::create(['nip' => '555', 'nama' => $faker->name, 'username' => '555', 'password' => bcrypt('555'), 'staf' => 0]);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     for ($i = 0; $i < 100; $i++) {
         DB::table('Todo')->insert(['text' => $faker->text(), 'status' => $faker->boolean()]);
     }
 }
Ejemplo n.º 27
0
 public function run()
 {
     $faker = Faker\Factory::create();
     for ($i = 0; $i < 10; $i++) {
         $user = User::create(array('email' => $faker->email, 'username' => $faker->unique->username, 'password' => $faker->word, 'remember_token' => str_random(50)));
     }
 }
Ejemplo n.º 28
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     for ($i = 0; $i < 10; $i++) {
         DB::table('posts')->insert(['url' => $faker->unique()->word, 'title' => $faker->unique()->sentence($nbWords = 6), 'description' => $faker->paragraph($nbSentences = 3), 'content' => $faker->text, 'image' => $faker->randomElement($array = array('blog-one.jpg', 'blog-two.jpg', 'blog-three.jpg')), 'blog' => '1', 'category_id' => $faker->numberBetween($min = 1, $max = 3), 'created_at' => $faker->dateTime($max = 'now')]);
     }
 }
Ejemplo n.º 29
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     foreach (range(1, 200) as $index) {
         DB::table('parts')->insert(['description' => $faker->realText(100), 'cost' => $faker->randomFloat(2, 1, 1000)]);
     }
 }
Ejemplo n.º 30
0
 public function improvedInsert($numberToAdd = 10)
 {
     $app = $this->getApp();
     $fakerFactory = new \Faker\Factory();
     $generator = $fakerFactory->create('pl_PL');
     $insert = $app->query->newInsert('user');
     $added = 0;
     for ($i = 0; $i < $numberToAdd; ++$i) {
         $user = ['user_name' => $generator->firstName, 'user_surname' => $generator->lastName, 'user_city' => $generator->city, 'user_birthdate' => $generator->date('Y-m-d')];
         // wykonaj przygotowane zapytanie dla podanych danych
         $added += $insert->bindValues($user)->execute() ? 1 : 0;
     }
     $segment = $app->session->getSegment(__CLASS__);
     $segment->setFlash('info', 'Dodano ' . $added . ' nowych wpisów.');
     $app->redirect($app->urlFor('faker'));
 }