试图在laravel项目未定义变量表中显示数据表


trying to display datatable in laravel project undefined variable table

我正在尝试遵循这里的教程:

http://wern-ancheta.com/blog/2014/08/10/using-datatables-with-laravel/将数据表合并到我的laravel中,但遇到了以下错误

未定义的变量:table(视图:C:''examplep''htdocs''laravel''awsconfig''app''views''searchblade.php)

这是我的控制器:

<?php
class HomeController extends BaseController {
    protected $layout = 'search'; 
 public function users(){
    $table = Datatable::table()
      ->addColumn('instanceId',
                        'imageId',
                        'privateDnsName',
                        'publicDnsName',
                        'keyName',
                        'instanceType',
                        'launchTime',
                        'kernelId',
                        'subnetId',
                        'vpcId',
                        'privateIpAddress',
                        'publicIpAddress',
                        'architecture',
                        'rootDeviceType',
                        'rootDeviceName',
                        'virtualizationType',
                        'sourceDestCheck')
      ->setUrl(route('instance.search'))
      ->noScript();

    $this ->layout->content = View::make('search', array('table' => $table));


}
}

以及我的观点:

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">

    <title>AWS Config Search</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.9.4/js/jquery.dataTables.min.js"></script>
         <link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/datatables/1.9.4/css/jquery.dataTables.min.css">

    <style>

        @import url(//fonts.googleapis.com/css?family=Raleway:700);

        body {
            margin:0;
            font-family:'Raleway', sans-serif;
            text-align:center;
            color: #3a3a3d;
        }
        .welcome {
            width: 300px;
            height: 200px;
            position: absolute;
            left: 50%;
            top: 50%;
            margin-left: -150px;
            margin-top: -100px;
        }
        a, a:visited {
            text-decoration:none;
        }
        h1 {
            font-size: 32px;
            margin: 16px 0 0 0;
        }
    </style>

</head>
<body>


<div class="row">
  <div class="col-md-12">
  <h3>AWS Configuration</h3>
  {{ $table->render() }}
  {{ $table->script() }}
  </div>
</div>
@stop




</body>
</html>

任何帮助都将不胜感激

尝试使用

View::make('search')->with('table', $table);