Laravel DataTables is an API designed to transform Laravel structures (collections, models, query builders) into a suitable format for consumption by the jQuery Datatables plugin.
Questions tagged [laravel-datatables]
69 questions
4
votes
1 answer
Passing parameter to each column of datatable
In my Laravel 5.6 application, I try to pass a $id variable from my route to each single column of my datatable.
My code:
public function getVendorslistChange($id){
try {
return…

dlfjj
- 349
- 1
- 8
- 26
3
votes
2 answers
Laravel Datatables: How to sort column with the second data
How do I sort according to the second data? The sorting works only on the ID. But in my table, I added a badge count and that's what I want to sort by.
Here is my controller
return DataTables::of($users)
->addIndexColumn()
…

draw134
- 1,053
- 4
- 35
- 84
3
votes
2 answers
Excluding Laravel appends values from model results
Laravel has the option to add an $appends array to each model making additional values automatically available as if they are database attributes by adding accessors for each.
This is normally pretty handy, except in this case I need to ONLY get the…

eComEvo
- 11,669
- 26
- 89
- 145
2
votes
3 answers
Make MySQL query more performant
I have two tables, users and points. Currently users has 84,263 rows, while points has 1,636,119 rows. Each user can have 0 or multiple points and I need to extract which point was created last.
show create table users
CREATE TABLE `users` (
`id`…

Kristjan O.
- 814
- 1
- 9
- 33
2
votes
2 answers
Table does not render (Yajra Datatables)
So, this is my controller:
use Yajra\DataTables\Facades\DataTables;
class CategoriasController extends Controller
{
public function index()
{
return Datatables::collection(Categoria::all())->make(true);
}
[...]
}
this is my…

myg0t
- 31
- 1
- 5
2
votes
2 answers
Searching an accessor of eager-loaded relation from datatables
I've got the following models:
hasOne(Department::class);
}
}
class Department extends Model {
protected $appends = ["email"];
public function…

miken32
- 42,008
- 16
- 111
- 154
2
votes
2 answers
Laravel DataTables Service implementation and Joins
Can't figure out simple task: join 1 table and add column. There is no useful documentation about service implementation here: DataTables as a Service Implementation
public function query()
{
$query = Technika::query()
…

RomkaLTU
- 3,683
- 8
- 40
- 63
1
vote
0 answers
Incomplete json response in a large eloquent-collection's ajax request
I'm having an error in my Laravel 8 app which uses yajra/laravel-datatables-oracle with server-side rendering, and I can't figure it out so far. What makes it frustating is the fact that this have been working just fine for the last couple of…

rifqy abdl
- 156
- 1
- 8
1
vote
2 answers
Unable to understand why I cannot install laravel-datatables
I'm mantaining an old project, started with laravel 5.4, and now lifted up to laravel 8.
It's all working.
Now I'm in need to install laravel-datatables.
Looking at doc, I discarded v10 because it requires Laravel 9+
For same reason, I discarded…

realtebo
- 23,922
- 37
- 112
- 189
1
vote
0 answers
Livewire Datatables - update columns dynamically without page refresh
I have a custom reporting feature I'm trying to build. To keep it short, the user is presented with options to choose from, those options are used to build an Eloquent query that returns data from the database to the front-end, in the form of an…

RgFirefly
- 29
- 4
1
vote
1 answer
How to connect laravel to firebase?
I am using laravel framework and firebase-database , i made connection between those two it's working fine ,i want to use eloquent models for manipulating the data for that i am using this…

usersuser
- 167
- 12
1
vote
1 answer
Livewire Datatables - Transform column and filter
I'm trying to substitute column data through callback, that has to return a username, mapped to user unique identifier. The list of usernames is outside of of the model' data and that's where I'm stuck.
I cannot use filterable() with the list of…

Daniel Protopopov
- 6,778
- 3
- 23
- 39
1
vote
2 answers
Difficulties with creating a function to delete data from the database
I created a button in the table to implement the function of deleting data on the site, I did everything according to the video tutorial and after I did everything refreshing the page I got an error:
Undefined variable: value (View:…

Mineral
- 39
- 1
- 1
- 7
1
vote
1 answer
Laravel datatable service using with relationship different name
I tried using 2 words method relationship. How i can implement the relationship in datatable service using ->with?
In the query method looks like this :
public function query(Pihak $model)
{
$model = Pihak::query()
…

Ray Coder
- 1,022
- 3
- 15
- 30
1
vote
0 answers
yajra datatables keep index column on search
I have a data collection and I have added a column with index:
BACKEND:
Route::get('user-data', function() {
$model = App\User::query();
return DataTables::eloquent($model)
->addIndexColumn()
…

Escudo Bravo
- 75
- 2
- 10