/** * Responds to requests to POST /lorem */ public function postGenerate(Request $request) { // Validate the request data // quantity refers to how many paragraphs/sentences/or words to generate $this->validate($request, ['quantity' => 'required|integer|min:1|max:99']); $quantity = $request->input('quantity'); $lorem_type = $request->input('lorem_type'); //instantiate a new Generator object using the Badcow LoremIpsum pkg $generator = new \Badcow\LoremIpsum\Generator(); //lorem type is a numeric value 1-3 that corresponds with paragraph, //sentences, or words switch ($lorem_type) { case 1: $text = $generator->getParagraphs($quantity); break; case 2: $text = $generator->getSentences($quantity); break; case 3: $text = $generator->getRandomWords($quantity); break; default: $text = $generator->getParagraphs($quantity); break; } return view('lorem.generate')->with('quantity', $quantity)->with('lorem_type', $lorem_type)->with('text', $text); //return $request; //$generator = new Generator(); //$paragraphs = $generator->getParagraphs($title); //echo implode('<p>', $paragraphs); //$sentences = $generator->getSentences($title); //echo implode('<p>', $sentences); //$words = $generator->getRandomWords($title); //echo implode('<p>', $words); }
public function setText() { $generator = new Badcow\LoremIpsum\Generator(); switch ($lorem_type) { case 1: $text = $generator->getParagraphs($quantity); break; case 2: $text = $generator->getSentences($quantity); break; case 3: $text = $generator->getRandomWords($quantity); break; default: $paragraphs = $generator->getParagraphs($quantity); break; } }
src='/images/friendly_dog_2.jpg' style='' alt='Friendly Dog'> Developer's Best Friend </label> </header> <section> <?php $generator = new Badcow\LoremIpsum\Generator(); $paragraphs = $generator->getParagraphs(5); echo implode('<p>', $paragraphs); $sentences = $generator->getSentences(5); echo implode('<p>', $sentences); $words = $generator->getRandomWords(5); echo implode('<p>', $words); ?> </section> <footer> © {{ date('Y') }} </footer> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> {{-- Yield any page specific JS files or anything else you might want at the end of the body --}} @yield('body') </body> </html>