Skip to content

Commit

Permalink
Merge pull request #12 from ekomi-ltd/IT-15901-link-search-fix
Browse files Browse the repository at this point in the history
IT-15901 : Commenting admin links and adding index on creator
  • Loading branch information
amanmukhtar authored May 16, 2024
2 parents ddc19a8 + e5e9aa2 commit 421c541
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
3 changes: 1 addition & 2 deletions app/Http/Controllers/AdminPaginationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ public function paginateUserLinks(Request $request) {

$username = session('username');
$user_links = Link::where('creator', $username)
->select(['id', 'short_url', 'long_url', 'clicks', 'created_at'])
->orderBy('id', 'desc');
->select(['id', 'short_url', 'long_url', 'clicks', 'created_at']);

return Datatables::of($user_links)
->editColumn('clicks', [$this, 'renderClicksCell'])
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddIndexOnLinksCreator extends Migration
{
/**
* Run the migrations
*/
public function up()
{
Schema::table('links', function (Blueprint $table) {
$table->index('creator');
});
}

/**
* Reverse the migrations
*/
public function down()
{
Schema::table('links', function (Blueprint $table) {
$table->dropIndex('links_creator_index');
});
}
}
4 changes: 2 additions & 2 deletions public/js/AdminCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ polr.controller('AdminCtrl', function($scope, $compile, $timeout) {
}, datatables_config));
}
if ($('#admin_links_table').length) {
$scope.datatables['admin_links_table'] = $('#admin_links_table').DataTable($.extend({
/*$scope.datatables['admin_links_table'] = $('#admin_links_table').DataTable($.extend({
"ajax": BASE_API_PATH + 'admin/get_admin_links',
"columns": [
Expand All @@ -162,7 +162,7 @@ polr.controller('AdminCtrl', function($scope, $compile, $timeout) {
{data: 'delete', name: 'delete', orderable: false, searchable: false}
]
}, datatables_config));
}, datatables_config));*/
}

$scope.datatables['user_links_table'] = $('#user_links_table').DataTable( {
Expand Down

0 comments on commit 421c541

Please sign in to comment.