@@ -18,7 +18,7 @@ Add the `yajra/datatables` under the `require` key after that run the `composer
1818``` php
1919 {
2020 "require": {
21- "laravel/framework": "4.1 .*",
21+ "laravel/framework": "4.2 .*",
2222 ...
2323 "yajra/laravel-datatables-oracle": "*"
2424 }
@@ -91,11 +91,27 @@ It is better, you know these:
9191 ->make();
9292```
9393
94- ** Example 3:**
94+ ** Example 3: Overriding default filter option **
9595``` php
9696 $posts = Post::select(array('posts.id','posts.name','posts.created_at','posts.status'));
9797
98- return Datatables::of($posts)->filter(function($query){
98+ return Datatables::of($posts)
99+ ->filter(function($query){
100+ if (Input::get('id')) {
101+ $query->where('id','=',Input::get('id'));
102+ }
103+ })->make();
104+ ```
105+
106+ ** Example 4: Accessing Carbon object on timestamps**
107+ > Note: You cannot access Carbon object using blade templating approach
108+
109+ ``` php
110+ $posts = Post::select(array('posts.id','posts.name','posts.created_at','posts.status'));
111+
112+ return Datatables::of($posts)
113+ ->editColumn('created_at', function($data){ $data->created_at->toDateTimeString() })
114+ ->filter(function($query){
99115 if (Input::get('id')) {
100116 $query->where('id','=',Input::get('id'));
101117 }
0 commit comments