Skip to content

Commit

Permalink
Deprecate of and use make method.
Browse files Browse the repository at this point in the history
  • Loading branch information
yajra committed Jul 5, 2017
1 parent eb958d3 commit 7c898f7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ return DataTables::eloquent(User::query())->toArray();
// using DataTables Factory
use Yajra\DataTables\Factory;

return Factory::make(User::query())->toJson();
return (new Factory)->eloquent(User::query())->toJson();
return (new Factory)->queryBuilder(DB::table('users'))->toJson();
return (new Factory)->collection(User::all())->toJson();
Expand All @@ -50,6 +51,7 @@ return (new CollectionDataTable(User::all())->toJson();
- Namespace changed from `Yajra\Datatables` to `Yajra\DataTables`.
- Rename `Datatables` to `Factory` class.
- Rename Facade from `Datatables` to `DataTables` class.
- `Datatables::of()` deprecated and replaced with `Factory::make()`.
- Preserve `Eloquent\Builder` when overriding the default ordering of dataTables when using `EloquentEngine`.
- Preserve `Eloquent\Builder` when using filterColumn api. Allows us to use model scope and any eloquent magics.
- Fractal integration extracted to own plugin [laravel-datatables-fractal](https://github.com/yajra/laravel-datatables-fractal).
Expand Down
15 changes: 14 additions & 1 deletion src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,26 @@ class Factory
protected $html;

/**
* Gets query and returns instance of class.
* Make a DataTable instance from source.
*
* @param mixed $source
* @return mixed
* @throws \Exception
* @deprecated in favor of make.
*/
public static function of($source)
{
return self::make($source);
}

/**
* Make a DataTable instance from source.
*
* @param mixed $source
* @return mixed
* @throws \Exception
*/
public static function make($source)
{
$engines = config('datatables.engines');
$builders = config('datatables.builders');
Expand Down

0 comments on commit 7c898f7

Please sign in to comment.