Skip to content

Add support for rendering view

Compare
Choose a tag to compare
@yajra yajra released this 12 Aug 03:26
· 1828 commits to master since this release

addColumn and editColumn will now load view if it exists. All eloquent/data attributes will be passed as variables on view.

Usage:

Controller

return $datatables
    ->eloquent($builder)
    ->addColumn('action', 'admin.users.datatables.action')
    ->editColumn('active', 'admin.users.datatables.active')

View
/resources/views/admin/users/datatables/action.blade.php

{{ $first_name }} #{{ $id }}

/resources/views/admin/users/datatables/active.blade.php

@if($active)
active
@else
inactive
@endif