title: Laravel app.js Conflicts with Datatables
body: <p>I am using datatables on a laravel project. But seems like laravels' app.js is conflicting with datatables.min.js I get this error in console.</p>
  
  <p><code>Uncaught TypeError: $(...).DataTable is not a function</code></p>
  
  <p>If I remove app.js from head everything works relation to datatables but then bootstraps menu dropdowns and some other js related stuff stops working obviously because I remove app.js How can I resolve this by including both in <code>head</code> section?</p>
  
  <p><strong>UPDATE:</strong> Here is head section of my laravel app. Laravel version is latest 5.6</p>
  
  <pre><code>&lt;html lang="en"&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
  &lt;meta name="csrf-token" content="Yhn7OFsFoV2qKhwsF7URC9GzjwNIb8muUT2u5kkD"&gt;
  &lt;title&gt;Application&lt;/title&gt;
  &lt;script src="http://127.0.0.1:8000/js/app.js" defer&gt;&lt;/script&gt;
  &lt;script src="http://127.0.0.1:8000/js/datatables.min.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  $(document).ready(function(){
  $('#users').DataTable({
    processing: true,
    serverSide: true,
    searching: true,
    filter: true,
    ajax: 'http://127.0.0.1:8000/api/users/data',
    columnDefs: {
      targets: [-1],
      visible: false,
      searchable: true,
    },
    columns: [
        {data: 'id', name: 'id'},
        {data: 'name', name: 'name', sortable: false},
        {data: 'email', name: 'email', sortable: false},
        {data: 'role', name: 'role'},
        {data: 'created_at', name: 'created_at'},
    ],
    initComplete: function() {
      this.api().columns([2]).every(function () {
        var column = this;
        var input = document.createElement("input");
        input.classList.add('form-control');
        input.setAttribute('placeholder', 'search by email..');
        input.setAttribute('name', 'search-email');
  
        $(input).appendTo($(column.header()).empty())
            .on('change', function () {
              column.search($(this).val(), false, false, true).draw();
            });
  
      });
      $('.dataTables_filter input[type="search"]').addClass('form-control');
    }
   });
  });
  &lt;/script&gt;
  </code></pre>