|
1 | 1 | # Datatables library for PHP |
2 | 2 | [](https://packagist.org/packages/ozdemir/datatables) [](https://github.com/n1crack/datatables/actions/workflows/tests.yml) [](https://github.com/n1crack/datatables/blob/master/LICENCE) |
3 | 3 |
|
4 | | -PHP Library to handle server-side processing for Datatables, in a fast and simple way. [Live Demo](https://datatables.ozdemir.be/) |
| 4 | +Simplify your Datatables server-side processing effortlessly using our lightning-fast PHP library, streamlining your workflow seamlessly. [Live Demo](https://datatables.ozdemir.be/) |
5 | 5 |
|
6 | 6 | ## Features |
7 | 7 | * Easy to use. Generates json using only a few lines of code. |
@@ -127,20 +127,22 @@ use Ozdemir\Datatables\DB\LaravelAdapter; |
127 | 127 |
|
128 | 128 | Route::get('/ajax/laravel', function () { |
129 | 129 |
|
130 | | - $sqlBuilder = Track::select([ |
131 | | - 'TrackId', |
132 | | - 'Track.Name', |
133 | | - 'Title as Album', |
134 | | - 'MediaType.Name as MediaType', |
135 | | - 'UnitPrice', |
136 | | - 'Milliseconds', |
137 | | - 'Bytes', |
138 | | - ]) |
139 | | - ->join('Album', 'Album.AlbumId', 'Track.AlbumId') |
140 | | - ->join('MediaType', 'MediaType.MediaTypeId', 'Track.MediaTypeId'); |
141 | | - |
142 | 130 | $dt = new Datatables(new LaravelAdapter); |
143 | | - $dt->query($sqlBuilder); // same as the previous example, sql statement can be used. |
| 131 | + |
| 132 | + $dt->query( |
| 133 | + Track::query() |
| 134 | + ->select([ |
| 135 | + 'TrackId', |
| 136 | + 'Track.Name', |
| 137 | + 'Title as Album', |
| 138 | + 'MediaType.Name as MediaType', |
| 139 | + 'UnitPrice', |
| 140 | + 'Milliseconds', |
| 141 | + 'Bytes', |
| 142 | + ]) |
| 143 | + ->join('Album', 'Album.AlbumId', 'Track.AlbumId') |
| 144 | + ->join('MediaType', 'MediaType.MediaTypeId', 'Track.MediaTypeId') |
| 145 | + ); // same as the previous example, sql statement can be used. |
144 | 146 |
|
145 | 147 | return $dt->generate(); |
146 | 148 | }); |
|
0 commit comments