1 year ago

Laravel Datatable

Posted 1 year ago by amk

can't show data in view when come from controller..... I have been test my work well... this is from blade..

<link href="" rel="stylesheet">
<script src=""></script>
<script type="text/javascript">
$(document).ready(function() {
    processing: true,
    serverSide: true,
    ajax: '{!!route('')!!}',
    columns: [
        {data: 'id', name: 'id'},
        {data: 'name', name: 'name'},
        {data: 'phone', name: 'phone'},
        {data: 'created_at', name: 'created_at'},
        {data: 'updated_at', name: 'updated_at'}
<section class="content">
        <a href="{{route('teacher.create')}}" class="btn btn-info">Add Teacher</a>
        <div class="row">
            <div class="col-md-12">
                <table class="table table-bordered table-hover table-striped" id="users-table">

and controller

public function data(){
      $teacher = Teacher::select(['id', 'name', 'phone','created_at', 'updated_at']);
      return Datatables::of($teacher)

Please sign in or create an account to participate in this conversation.