Skip to content

Commit 63c1654

Browse files
committed
Add support for rendering view directly on addColumn and editColumn
1 parent 5cc7385 commit 63c1654

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/yajra/Datatables/Helper.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ public static function compileContent($content, array $data, $param)
6868
*/
6969
public static function compileBlade($str, $data = [])
7070
{
71+
if (view()->exists($str)) {
72+
return view($str, $data)->render();
73+
}
74+
7175
$empty_filesystem_instance = new Filesystem();
7276
$blade = new BladeCompiler($empty_filesystem_instance, 'datatables');
7377
$parsed_string = $blade->compileString($str);

tests/helper.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,22 @@ function app($instance) {
1919

2020
return new Datatables(Request::capture());
2121
}
22+
23+
function view($view = null, array $data = []) {
24+
if ( ! $view) {
25+
return new BladeView();
26+
}
27+
28+
return (new BladeView())->exists($view);
29+
}
30+
31+
/**
32+
* Blade View Stub
33+
*/
34+
class BladeView
35+
{
36+
public function exists($view)
37+
{
38+
return false;
39+
}
40+
}

0 commit comments

Comments
 (0)