Skip to content

Commit

Permalink
Merge pull request #1487 from ElfSundae/fix-helper
Browse files Browse the repository at this point in the history
[8.0] Fix datatables() helper.
  • Loading branch information
yajra authored Nov 2, 2017
2 parents dd9127f + 38591cb commit 40269f0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/helper.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
<?php

use Yajra\DataTables\DataTables;

if (! function_exists('datatables')) {
/**
* Helper to make a new DataTable instance from source.
* Or return a new factory if source is not set.
* Or return the factory if source is not set.
*
* @param mixed $source
* @return \Yajra\DataTables\DataTableAbstract|\Yajra\DataTables\DataTables
*/
function datatables($source = null)
{
if ($source) {
return DataTables::make($source);
if (is_null($source)) {
return app('datatables');
}

return new DataTables;
return app('datatables')->make($source);
}
}

0 comments on commit 40269f0

Please sign in to comment.