Laravel controller doesn’t pass the variables to view

I have watched a youtube tutorial about Laravel. This is the code. I started studying Laravel.


class Authors_Controller extends BaseController {

public $restful = true;
public function get_index(){

    $view = View::make('authors.index',array('name'=>'Jedi'))->with('age','18');
    $view['favorite'] = 'bacon';    
    return $view;

view code

 php echo $name;
 echo $age;
 echo $location;
 echo $favorite;

Once I ran the localhost, I get an error that states that the variables are undefined.

Source: oop

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.