Yajra\Datatables\Html\Builder::scripts PHP Method

scripts() public method

Generate DataTable javascript.
public scripts ( null $script = null, array $attributes = ['type' => 'text/javascript'] ) : string
$script null
$attributes array
return string
    public function scripts($script = null, array $attributes = ['type' => 'text/javascript'])
    {
        $script = $script ?: $this->generateScripts();
        return '<script' . $this->html->attributes($attributes) . '>' . $script . '</script>' . PHP_EOL;
    }

Usage Example

 /**
  * Возвращет javascript-код инициализации таблицы.
  *
  * @return string
  */
 public function script()
 {
     $this->buildIfNotBuilt();
     return $this->html->scripts();
 }