0

I have a question about simple laravel code which is not working.

This is how the route looks:

Route::get('/', function()
{ 
    $chill = array(
            'heading' => 'Hello Laravel', 
            'body'    => 'This is totally awesome'
    );
    return View::make('test', $chill);
});

This is how the view looks in test.php:

{{ $heading }}

{{ $body }}

I don't understand why this is not working.

1 Answer 1

1

First of all you have to name your view

test.blade.php

if you want to use blade in your view.

Then try this code here:

Route::get('/', function()
{ 
$chill = array(
'heading' => 'Hello Laravel', 
'body' => 'This is totally awesome'
 );
 return View::make('test')->with('chill', $chill);
 });

Then use this in your view:

 {{ $chill['heading'] }}

 {{ $chill['body'] }}

I hope that I don't have any minor errors but this should work now :)

Sign up to request clarification or add additional context in comments.

3 Comments

Hello! Thank you for your help, but not working.. Here is what is get out: dropbox.com/s/2sr3ksjwlj0x8nx/laravel.png
@user3270211 You are visiting the wrong url just visit localhost/laravel or localhost/laravel/public and check the results.
Bhai jaan! bohot chukrya! thank you, its working. Salam from Norway.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.