forked from yajra/laravel-datatables
-
Notifications
You must be signed in to change notification settings - Fork 0
Dependency Injection
Arjay Angeles edited this page May 22, 2015
·
2 revisions
###Dependency Injection
You can also access Datatables
class via Laravel's Dependency Injection. See example below:
<?php namespace App\Http\Controllers;
use App\Http\Requests;
use App\User;
use Datatables;
class DemoController extends Controller
{
public function getBasic()
{
return view('datatables.demo');
}
public function getBasicData(Datatables $datatables)
{
$users = User::select([
'id', 'name', 'email', 'created_at', 'updated_at'
]);
return $datatables->usingEloquent($users)->make(true);
}
}