i'm using metronic in laravel and i'm getting this error that is
'Uncaught TypeError: $(...).DataTable is not a function'
after making everything exactly like yarja documentation like
this is the data table
<pre lang="php"></pre>
<?php
namespace App\DataTables;
use App\Models\Proprties;
use Yajra\DataTables\Html\Button;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Services\DataTable;
use Yajra\DataTables\Html\Editor\Fields;
use Yajra\DataTables\Html\Editor\Editor;
class ProprtiesDataTable extends DataTable
{
/**
* Build DataTable class.
*
* @param mixed $query Results from query() method.
* @return \Yajra\DataTables\DataTableAbstract
*/
public function dataTable($query)
{
return datatables()
->eloquent($query)
->addColumn("action", "proprties.action");
}
/**
* Get query source of dataTable.
*
* @param \App\Models\Proprty $model
* @return \Illuminate\Database\Eloquent\Builder
*/
public function query(Proprty $model)
{
return $model->newQuery();
}
/**
* Optional method if you want to use html builder.
*
* @return \Yajra\DataTables\Html\Builder
*/
public function html()
{
return $this->builder()
->setTableId("proprties-table")
->columns($this->getColumns())
->minifiedAjax()
->dom("Bfrtip")
->orderBy(1)
->buttons(
Button::make("create"),
Button::make("export"),
Button::make("print"),
Button::make("reset"),
Button::make("reload")
);
}
/**
* Get columns.
*
* @return array
*/
protected function getColumns()
{
return [
Column::make("id")->title("Log ID"),
Column::make("owneruser"),
Column::make("name"),
Column::make("refnumber"),
Column::make("refnumber"),
];
}
/**
* Get filename for export.
*
* @return string
*/
protected function filename()
{
return "Proprties_" . date("YmdHis");
}
}
<x-base-layout>
<!--begin::Card-->
<div class="card">
<!--begin::Card body-->
<div class="card-body pt-6">
<!--begin::Table-->
{{ $dataTable->table() }}
<!--end::Table-->
{{-- Inject Scripts --}}
@section("scripts")
{{ $dataTable->scripts() }}
@endsection
</div>
<!--end::Card body-->
</div>
<!--end::Card-->
</x-base-layout>