Setting up first route,view,controller and sending data to view laravel 5

Example Route

Route::get('home','HomeController@index');  // you tell if url has /home then home controller index function handles that

Then Controller will be

namespace App\Http\Controllers;
class HomeController extends Controller
	//this is the funtion handling the /home
	public function index(){
		$data = "abc"; // here is sample data
	    return View::make('home/myhome', array('data' => $data));  // this is html file will be saved in views/home/myhome.blade.php



{{ $data }} 

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s