/** * Run the database seeds. * * @return void */ public function run() { DB::table('books')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'title' => 'The Great Gatsby', 'author' => 'F. Scott Fitzgerald', 'published' => 1925, 'cover' => 'http://img2.imagesbn.com/p/9780743273565_p0_v4_s114x166.JPG', 'purchase_link' => 'http://www.barnesandnoble.com/w/the-great-gatsby-francis-scott-fitzgerald/1116668135?ean=9780743273565']); DB::table('books')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'title' => 'The Bell Jar', 'author' => 'Sylvia Plath', 'published' => 1963, 'cover' => 'http://img1.imagesbn.com/p/9780061148514_p0_v2_s114x166.JPG', 'purchase_link' => 'http://www.barnesandnoble.com/w/bell-jar-sylvia-plath/1100550703?ean=9780061148514']); DB::table('books')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'title' => 'I Know Why the Caged Bird Sings', 'author' => 'Maya Angelou', 'published' => 1969, 'cover' => 'http://img1.imagesbn.com/p/9780345514400_p0_v1_s114x166.JPG', 'purchase_link' => 'http://www.barnesandnoble.com/w/i-know-why-the-caged-bird-sings-maya-angelou/1100392955?ean=9780345514400']); $lipsum = new LoremIpsum(); $title = $lipsum->words(3); $faker = \Faker\Factory::create(); $author = $faker->name; DB::table('books')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'title' => $title, 'author' => $author, 'published' => 1969, 'cover' => 'http://img1.imagesbn.com/p/9780345514400_p0_v1_s114x166.JPG', 'purchase_link' => 'http://www.barnesandnoble.com/w/i-know-why-the-caged-bird-sings-maya-angelou/1100392955?ean=9780345514400']); }
/** * generatelorim function evaluate the conditions selected by the user and generate the text. * */ public static function generatelorim($howMany, $generate, $ckArticle, $ckItalic, $ckBold) { $lipsum = new joshtronic\LoremIpsum(); if ($generate == 'Words') { if ($ckArticle == 1 && $ckItalic == 1 && $ckBold == 1) { $result1 = $lipsum->words($howMany, ['article', 'p', 'i', 'b']); } if ($ckArticle == 1 && $ckItalic == 1 && $ckBold == 0) { $result1 = $lipsum->words($howMany, ['article', 'p', 'i']); } if ($ckArticle == 1 && $ckItalic == 0 && $ckBold == 0) { $result1 = $lipsum->words($howMany, ['article', 'p']); } if ($ckArticle == 0 && $ckItalic == 1 && $ckBold == 1) { $result1 = $lipsum->words($howMany, ['i', 'b']); } if ($ckArticle == 0 && $ckItalic == 1 && $ckBold == 0) { $result1 = $lipsum->words($howMany, ['i']); } if ($ckArticle == 0 && $ckItalic == 0 && $ckBold == 1) { $result1 = $lipsum->words($howMany, ['b']); } if ($ckArticle == 0 && $ckItalic == 0 && $ckBold == 0) { $result1 = $lipsum->words($howMany); } } elseif ($generate == 'Sentences') { if ($ckArticle == 1 && $ckItalic == 1 && $ckBold == 1) { $result1 = $lipsum->sentences($howMany, ['article', 'p', 'i', 'b']); } if ($ckArticle == 1 && $ckItalic == 1 && $ckBold == 0) { $result1 = $lipsum->sentences($howMany, ['article', 'p', 'i']); } if ($ckArticle == 1 && $ckItalic == 0 && $ckBold == 0) { $result1 = $lipsum->sentences($howMany, ['article', 'p']); } if ($ckArticle == 0 && $ckItalic == 1 && $ckBold == 1) { $result1 = $lipsum->sentences($howMany, ['i', 'b']); } if ($ckArticle == 0 && $ckItalic == 1 && $ckBold == 0) { $result1 = $lipsum->sentences($howMany, ['i']); } if ($ckArticle == 0 && $ckItalic == 0 && $ckBold == 1) { $result1 = $lipsum->sentences($howMany, ['b']); } if ($ckArticle == 0 && $ckItalic == 0 && $ckBold == 0) { $result1 = $lipsum->sentences($howMany); } } elseif ($generate == 'Paragraphs') { if ($ckArticle == 1 && $ckItalic == 1 && $ckBold == 1) { $result1 = $lipsum->paragraphs($howMany, ['article', 'p', 'i', 'b']); } if ($ckArticle == 1 && $ckItalic == 1 && $ckBold == 0) { $result1 = $lipsum->paragraphs($howMany, ['article', 'p', 'i']); } if ($ckArticle == 1 && $ckItalic == 0 && $ckBold == 0) { $result1 = $lipsum->paragraphs($howMany, ['article', 'p']); } if ($ckArticle == 0 && $ckItalic == 1 && $ckBold == 1) { $result1 = $lipsum->paragraphs($howMany, ['i', 'b']); } if ($ckArticle == 0 && $ckItalic == 1 && $ckBold == 0) { $result1 = $lipsum->paragraphs($howMany, ['i']); } if ($ckArticle == 0 && $ckItalic == 0 && $ckBold == 1) { $result1 = $lipsum->paragraphs($howMany, ['b']); } if ($ckArticle == 0 && $ckItalic == 0 && $ckBold == 0) { $result1 = $lipsum->paragraphs($howMany); } } else { $result1 = $lipsum->words($howMany, '<li><a href="$1">$1</a></li>'); } return $result1; }