public function getIndex() { $groups = Groups::select(['id', 'name'])->live()->orderBy('id', 'DESC'); return Datatables::of($groups)->add_column('actions', function ($row) { return permslink('settings/groups/data/perms/' . $row->id . '/edit', trans('app.edit_perms'), ['class' => 'btn btn-xs btn-warning']) . " " . permslink('settings/groups/' . $row->id . '/edit', trans('app.edit'), ['class' => "btn btn-xs btn-default"]) . " " . permslink('settings/groups/' . $row->id, trans('app.delete'), ['class' => "del-item btn btn-xs btn-danger", 'data-token' => csrf_token()]); })->removeColumn('id')->make(); }
public function getIndex() { $config = Config::select(['id', 'name', 'value'])->live()->orderBy('id', 'DESC'); return Datatables::of($config)->add_column('actions', function ($row) { return permshtml('settings/config/' . $row->id . '/edit', '<a href="' . url('settings/config/' . $row->id . '/edit') . '" class="btn btn-xs btn-default">' . trans('app.edit') . '</a>') . " " . permshtml('settings/config/' . $row->id, '<a href="' . url('settings/config/' . $row->id) . '" data-token="' . csrf_token() . '" class="del-item btn btn-xs btn-danger">' . trans('app.delete') . '</a>', "delete"); })->removeColumn('id')->make(); }
public function getIndex() { $users = User::select(['id', 'name', 'surname', 'email'])->live()->orderBy('id', 'DESC'); return Datatables::of($users)->add_column('groups', function ($user) { return implode(', ', $user->Groups()->lists('name')->all()); })->add_column('actions', function ($row) { return permshtml('settings/users/' . $row->id . '/edit', '<a href="' . url('settings/users/' . $row->id . '/edit') . '" class="btn btn-xs btn-default">' . trans('app.edit') . '</a>') . " " . permshtml('settings/users/' . $row->id, '<a href="' . url('settings/users/' . $row->id) . '" data-token="' . csrf_token() . '" class="del-item btn btn-xs btn-danger">' . trans('app.delete') . '</a>', "delete"); })->removeColumn('id')->make(); }
/** * Returns current database prefix * * @return string * @static */ public static function database_prefix() { return \Bllim\Datatables\Datatables::database_prefix(); }
public function test_datatables_make_function() { $demo = DB::table('demos')->select('id', 'name'); $output = Datatables::of($demo)->make(); $this->assertInstanceOf('Illuminate\\Http\\JsonResponse', $output); }