/home/techb158/immovalet.com/vendor/yajra/laravel-datatables-html/src/Html
NameSizeModeActions
Columns/-0755rm
Editor/-0755rm
Options/-0755rm
Builder.php74520644editdlrm
Button.php100550644editdlrm
Column.php135310644editdlrm
ColumnDefinition.php2620644editdlrm
ColumnDefinitions.php1250644editdlrm
HasAuthorizations.php21740644editdlrm
HasEditor.php17640644editdlrm
HasOptions.php82460644editdlrm
HasTable.php46180644editdlrm
Parameters.php4040644editdlrm
SearchPane.php71110644editdlrm
Edit: /home/techb158/immovalet.com/vendor/yajra/laravel-datatables-html/src/Html/Builder.php (7452B)
config = $config; $this->view = $view; $this->html = $html; $this->collection = new Collection; $this->tableAttributes = $this->config->get('datatables-html.table', []); $this->attributes = [ 'serverSide' => true, 'processing' => true, ]; } /** * Generate DataTable javascript. * * @param null $script * @param array $attributes * @return \Illuminate\Support\HtmlString * @throws \Exception */ public function scripts($script = null, array $attributes = ['type' => 'text/javascript']) { $script = $script ?: $this->generateScripts(); $attributes = $this->html->attributes($attributes); return new HtmlString("{$script}\n"); } /** * Get generated raw scripts. * * @return \Illuminate\Support\HtmlString * @throws \Exception */ public function generateScripts() { $parameters = $this->generateJson(); return new HtmlString( sprintf($this->template(), $this->getTableAttribute('id'), $parameters) ); } /** * Get generated json configuration. * * @return string */ public function generateJson() { return $this->parameterize($this->getOptions()); } /** * Get DataTable options array. * * @return array */ public function getOptions() { return array_merge( $this->attributes, [ 'ajax' => $this->ajax, 'columns' => $this->collection->map(function (Column $column) { $column = $column->toArray(); unset($column['attributes']); return $column; })->toArray(), ] ); } /** * Generate DataTables js parameters. * * @param array $attributes * @return string */ public function parameterize($attributes = []) { $parameters = (new Parameters($attributes))->toArray(); $values = []; $replacements = []; foreach (Arr::dot($parameters) as $key => $value) { if ($this->isCallbackFunction($value, $key)) { $values[] = trim($value); Arr::set($parameters, $key, '%' . $key . '%'); $replacements[] = '"%' . $key . '%"'; } } $new = []; foreach ($parameters as $key => $value) { Arr::set($new, $key, $value); } $json = json_encode($new); $json = str_replace($replacements, $values, $json); return $json; } /** * Check if given key & value is a valid callback js function. * * @param string $value * @param string $key * @return bool */ protected function isCallbackFunction($value, $key) { if (empty($value)) { return false; } $callbacks = $this->config->get('datatables-html.callback', ['$', '$.', 'function']); return Str::startsWith(trim($value), $callbacks) || Str::contains($key, 'editor'); } /** * Get javascript template to use. * * @return string */ protected function template() { $template = $this->template ?: $this->config->get('datatables-html.script', 'datatables::script'); return $this->view->make($template, ['editors' => $this->editors])->render(); } /** * Generate DataTable's table html. * * @param array $attributes * @param bool $drawFooter * @param bool $drawSearch * @return \Illuminate\Support\HtmlString */ public function table(array $attributes = [], $drawFooter = false, $drawSearch = false) { $this->setTableAttributes($attributes); $th = $this->compileTableHeaders(); $htmlAttr = $this->html->attributes($this->tableAttributes); $tableHtml = ''; $searchHtml = $drawSearch ? '' . implode('', $this->compileTableSearchHeaders()) . '' : ''; $tableHtml .= '' . implode('', $th) . '' . $searchHtml . ''; if ($drawFooter) { $tf = $this->compileTableFooter(); $tableHtml .= '' . implode('', $tf) . ''; } $tableHtml .= '
'; return new HtmlString($tableHtml); } /** * Configure DataTable's parameters. * * @param array $attributes * @return $this */ public function parameters(array $attributes = []) { $this->attributes = array_merge($this->attributes, $attributes); return $this; } /** * Set custom javascript template. * * @param string $template * @return $this */ public function setTemplate($template) { $this->template = $template; return $this; } /** * Make a data script to be appended on ajax request of dataTables. * * @param array $data * @return string */ protected function makeDataScript(array $data) { $script = ''; foreach ($data as $key => $value) { $dataValue = $this->isCallbackFunction($value, $key) ? $value : "'{$value}'"; $script .= PHP_EOL . "data.{$key} = {$dataValue};"; } return $script; } /** * Generate scripts that sets the dataTables options into a variable. * * @return $this */ public function asOptions() { return $this->setTemplate('datatables::options'); } /** * Wrap dataTable scripts with a function. * * @return $this */ public function asFunction() { return $this->setTemplate('datatables::function'); } }