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
0
votes
1 answer
Laravel datatables raw columns
i have a code like this to display an action button for datatables
->addColumn('action', function () {
return '

M Muqiit Faturrahman
- 79
- 12
0
votes
0 answers
I don't know how to implement "Belongs To". Laravel
please help me my problem is this:
I'm having relationships in laravel with eloquent. I tried to use Datatables but I don't know how to do "BelongTo Relations". Also, look for an idea in Relationships
I tried "Model Belongs To Demo" but I have no…

Ema Reynoso
- 3
- 1
0
votes
2 answers
Formatting number in Eloquent query or Yarja Datatables
I am writing a searchable table which includes the area and population. Here is the basic query:
public function getCountryData()
{
$co =…

Jim
- 596
- 1
- 10
- 36
0
votes
1 answer
Laravel View Composer, cant seem to get it to work
so i have followed many tutorials and videos and checked here and cant seem to get this to work, really need help. im going to provide my code and explain what im trying to so and hopefully someone can help me sort this out. so what im trying to so…

Anthony Moore
- 84
- 1
- 9
0
votes
1 answer
Laravel mutator from JSON to php array to display in datatable
I'm trying to retrieve a list of aliases formatting as JSON within my database. However when I use the casts mutator it only removes the citation symbols.
Like the following:
"[`SOME ALIAS HERE`]"
Becomes:
[`SOME ALIAS HERE`]
And nothing more than…

Dunkstormen
- 115
- 1
- 10
0
votes
1 answer
Row Group Server Side Yajra DataTables
i have problem with yajra datatables to make row group in server side. I want row group show all employee in companies.name. and my current code like this:
public function index(DataTablesBuilderService $builder)
{
$columns = [
…

Bonny AUlia
- 95
- 2
- 10
0
votes
1 answer
How to apply switch statement for multi columns in datatables
I have a laravel project that implements datatables to display data. I want to use some labels to format some columns on the table.
The problem now is having a second switch statement , the first one is working fine and the formatting is showing up…

Bongani Dlamini
- 103
- 2
- 11
0
votes
3 answers
custom query in laravel datatable
i am trying to do a query on a table likes so
tbl_bottle
name | type | location
bot1 A USA
bot2 B
bot3 C USA
bot4 A UK
bot5 A UK
so when i load front end it will show
this
name | type |…

6563cc10d2
- 193
- 1
- 2
- 8
0
votes
1 answer
Show number of reservations user have made in admin's user list page
I want to count the number of reservation users made in admin panel using Laravel Datatables.
Reservation model
public function customer()
{
return $this->belongsTo(User::class, 'customer_id');
}
User model
public function reservations()
…

Tridev Shrestha
- 447
- 7
- 21
0
votes
1 answer
Pass filtered data to Datatables v8 on Laravel v5.6
I have an integration with laravel datatables with elasticsearch. For the previous versions, this code was solving the issue.
return value(new CollectionEngine(collect($data), new DatatablesRequest()))
->setTotalRecords($total)
…

Cesar Sosa
- 13
- 3
0
votes
0 answers
Laravel DataTables JSON column escaping chars
Trying to use Yajra DataTables as service implementation and here is my problem:
I have JSON column metas I building table columns based on fields inside that column, for excample:
[ 'data' => 'date', 'name' => 'metas->date AS date', 'title' =>…

RomkaLTU
- 3,683
- 8
- 40
- 63
0
votes
1 answer
Why is my DataTables not working properly?
Im using Laravel 5.5 with this package https://github.com/yajra/laravel-datatables
Im getting following response on my browser tab instead of a table. Without datatable function, page loads perfectly with static content. Can anyone point me what im…

Shawn
- 37
- 8
0
votes
2 answers
Datatable: addColumn sends only text
I'm doing server side procesing and I'm adding columns with some css styles, but for some reason it isn't interpreted in html, it gets it only as text.
This is my php code.
public function getCompras()
{
$compra = Compra::with('empresas');
…

Christian
- 481
- 1
- 7
- 24
0
votes
2 answers
Laravel oneToMany accessor usage in eloquent and datatables
On my User model I have the following:
public function isOnline()
{
return $this->hasMany('App\Accounting', 'userid')->select('rtype')->latest('ts');
}
The accounting table has activity records and I'd like this to return the latest value for…

ironchefbadass
- 129
- 16
0
votes
2 answers
Datatable query using name rather than username
I have a project where we don't store the name of a user and just use their username for everything.
I cam across a package called Ticketit which is a helpdesk ticketing system for Laravel.
The package uses the name of users for everything and so…

James
- 15,754
- 12
- 73
- 91