Created
February 12, 2021 13:33
-
-
Save im-noob/77131233e68c899d2c56d593c4cf4e04 to your computer and use it in GitHub Desktop.
DataTableBackend.php
This file contains hidden or 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
$data = User::all(); | |
$dataTable = DataTables::collection($data) | |
->editColumn('check_box', static function ($value) { | |
return '<td> | |
<div class="checkbox"> | |
<input type="checkbox" name="check" value="checkbox" class="row-check-box-active-table"> | |
<label for="checkbox"></label> | |
</div> | |
</td>'; | |
})->editColumn('profile_pic_and_name', static function ($value) { | |
return '<div class="data-user-box"> | |
<div class="data-user-prof on"> | |
<span style="background-image: url(images/p-img.jpg);"><i><img | |
src="images/online-icon.svg"></i></span> | |
</div> | |
<p>Amy Harding</p> | |
</div>'; | |
})->editColumn('role', static function ($value) { | |
return 'role'; | |
})->editColumn('status', static function ($value) { | |
return 'status'; | |
})->editColumn('date_added', static function ($value) { | |
return 'date_added'; | |
}); | |
return $dataTable->rawColumns([ | |
'check_box', | |
'profile_pic_and_name' | |
])->make(true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment