0

I am trying to follow a tutorial found here :

http://wern-ancheta.com/blog/2014/08/10/using-datatables-with-laravel/ to incorporate datatables into my laravel but have encountered the following error

Undefined variable: table (View: C:\xampp\htdocs\laravel\awsconfig\app\views\search.blade.php

here is my controller :

<?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));





}
}

and my view :

<!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>

any help would be greatly appreciated

1 Answer 1

1

try using

View::make('search')->with('table', $table);
Sign up to request clarification or add additional context in comments.

Comments

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.