Donations Appreciated

When we give cheerfully and accept gratefully, everyone is blessed. - Maya Angelou

Click here to lend your support to: Laravel Datatables and make a donation at pledgie.com !

Service Scope Implementation

DataTables Service Implementation with Scope Tutorial is available at https://datatables.yajrabox.com/service.

IdNameEmailCreated AtUpdated At

CREATING A SCOPE.

php artisan datatables:scope UserDataTableScope
namespace App\DataTables\Scopes;

use Yajra\Datatables\Contracts\DataTableScopeContract;

class UserDataTableScope implements DataTableScopeContract
{
    public function apply($query)
    {
        return $query->whereBetween('id', [500, 550]);
    }
}

APPLYING A SCOPE

public function getUsers(UsersDataTable $dataTable)
{
    return $dataTable->addScope(new UserDataTableScope)->render('path.to.view');
}