Skip to content

Commit

Permalink
serial no display in output.
Browse files Browse the repository at this point in the history
  • Loading branch information
rajan-parmar committed Jan 11, 2020
1 parent 5418be2 commit b5e9d1b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 25 additions & 0 deletions app/Laratables/CustomUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,29 @@ public static function laratablesCustomAction($user)
{
return view('navtab.output.customize.action', compact('user'))->render();
}

/**
* Sets the serial number column value for each user.
*
* @param \Illuminate\Support\Collection
* @return \Illuminate\Support\Collection
**/
public static function laratablesModifyCollection($users)
{
return $users->map(function ($user, $key) {
$user->serial_no = $key + 1 + request()->input('start');
return $user;
});
}

/**
* Returns the custom column serial number value for table.
*
* @param \App\User $user
* @return string
**/
public static function laratablesCustomSerialNo($user)
{
return $user->serial_no;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
ajax: "{{ route('custom_laratable') }}",
order: [[1, "asc"]],
columns: [
{ name: 'serial_no', orderable: false, searchable: false},
{ name: 'serial_no', orderable: false, searchable: false},
{ name: 'Name' },
{ name: 'start_date' },
{ name: 'salary' },
Expand Down

0 comments on commit b5e9d1b

Please sign in to comment.