alirezaeshaqi
1 year ago

pagination and search

Posted 1 year ago by alirezaeshaqi

Hi, I am using laravel 5.4 and bootstrap 3 , I want use pagination and search . but I the pagination and search not working well. Here is my script code: $(document).ready(function() { $('#example').DataTable({ "searching": true, "paging": true, }); });

and HTML Code:

@section('content')
<h1> All Information</h1>   
<table id="example" class="table table-striped table-bordered" style="width:100%">
      <thead>
         <tr>
                <th>First Name</th>
                <th>Username(Student Id)</th>
                <th>College</th>
                <th>Year Of Graduatuion</th>
                <th>Job Title</th>
                <th>Job Organization</th>
                <th>Job Province</th>
            </tr>
        </thead>
        @if(isset($jobs))
         @foreach($jobs as $job)
            <tbody>
                <tr>
                    <td>{{$job->user->first_name}}</td>
                    <td>{{$job->user->username}}</td>
                    <td>{{$job->user->college->college_name}}</td>
                    <td>{{$job->user->graduated_year}}</td>
                    <td>{{$job->job_title}}</td>
                    <td>{{$job->organization->name}}</td>
                    <td>{{$job->job_province}}</td>
                </tr>
            </tbody>
            @endforeach
        @endif
</table>

and Controller: public function index() { $jobs = Job::all(); return view('admin.jobs-information.index', compact('jobs')); }

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