Created
January 26, 2021 06:45
-
-
Save sajjadanwar0/2e7d6ae53862071e98e70bd4937bb412 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function index(Request $request) | |
{ | |
$subscribes = Subscribe::all(); | |
if ($request->ajax()) | |
{ | |
return Datatables::of($subscribes)->make(true); | |
} | |
return view('admin.subscribes.index', compact('subscribes')); | |
} | |
//View | |
@extends('layouts.admin') | |
@section('styles') | |
@endsection | |
@section('content') | |
<div id="page-wrapper" style="min-height: 902px;"> | |
@if (session('status')) | |
<div class="alert alert-success"> | |
{{ session('status') }} | |
</div> | |
@endif | |
<div style="padding-top:25px;"></div> | |
<div class="row"> | |
<div class="col-md-12"> | |
<h1> | |
Subscribes | |
</h1> | |
</div> | |
<div class="panel-body"> | |
<table id="products-table" class="table"> | |
<thead> | |
<tr> | |
<th>#</th> | |
<th>email</th> | |
<th>name</th> | |
<th>message</th> | |
<th>Created At</th> | |
</tr> | |
</thead> | |
</table> | |
</div> | |
</div> | |
</div> | |
@stop | |
@push('scripts') | |
<script> | |
$(function(){ | |
$('#products-table').DataTable({ | |
processing: true, | |
serverSide: true, | |
ajax: '{!! route('admin.subscribes.index') !!}', | |
columns: [ | |
{ data: 'id', name: 'id' }, | |
{ data: 'email', name: 'email' }, | |
{ data: 'name', name: 'name' }, | |
{ data: 'message', name: 'message' }, | |
{ data: 'created_at', name: 'created_at' } | |
] | |
}); | |
}); | |
</script> | |
@endpush |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment