my code stock.com

Snippet options

Download: Download snippet as homecontroller.php.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

<?php namespace App\Http\Controllers;

use Khill\Lavacharts\Lavacharts;

class HomeController extends Controller {

	/*
	|--------------------------------------------------------------------------
	| Home Controller
	|--------------------------------------------------------------------------
	|
	| This controller renders your application's "dashboard" for users that
	| are authenticated. Of course, you are free to change or remove the
	| controller as you wish. It is just here to get your app started!
	|
	*/

	/**
	 * Create a new controller instance.
	 *
	 * @return void
	 */
	public function __construct()
	{
		$this->middleware('auth');
	}
	public function getGraphPie()
	{
		$lava = new Lavacharts; // See note below for Laravel

		$reasons = $lava->DataTable();

		$reasons->addStringColumn('Reasons')
			->addNumberColumn('Percen')
			->addRow(['Check Reviews', 15])
			->addRow(['Watch Trailers', 5])
			->addRow(['See Actors Other Work', 25])
			->addRow(['Settle Argument', 55]);

		$lava->PieChart('IMDB', $reasons, [
			'title' => 'Titulo de la grafica',
			'is3D' => true
		]);
		return $lava;
	}
	public function getGraphBar()
	{
		$lava = new Lavacharts; // See note below for Laravel

		$votes  = $lava->DataTable();

		$votes->addStringColumn('Food Poll')
			->addNumberColumn('Votes')
			->addRow(['Tacos',  rand(1000,5000)])
			->addRow(['Salad',  rand(1000,5000)])
			->addRow(['Pizza',  rand(1000,5000)])
			->addRow(['Apples', rand(1000,5000)])
			->addRow(['Fish',   rand(1000,5000)]);

		$lava->BarChart('Votes', $votes);

		return $lava;
	}
	/**
	 * Show the application dashboard to the user.
	 *
	 * @return Response
	 */
	public function index()
	{

		$graphBar = self::getGraphBar();
		$graphPie = self::getGraphPie();
		return view('home',compact('graphPie','graphBar'));
	}

}

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.