Overview

Namespaces

  • None
  • Yajra
    • Datatables
      • Contracts
      • Engines
      • Facades
      • Generators
      • Html
      • Processors
      • Services
      • Transformers

Classes

  • Yajra\Datatables\Datatables
  • Yajra\Datatables\DatatablesServiceProvider
  • Yajra\Datatables\Engines\BaseEngine
  • Yajra\Datatables\Engines\CollectionEngine
  • Yajra\Datatables\Engines\EloquentEngine
  • Yajra\Datatables\Engines\QueryBuilderEngine
  • Yajra\Datatables\Facades\Datatables
  • Yajra\Datatables\Generators\DataTablesMakeCommand
  • Yajra\Datatables\Generators\DataTablesScopeCommand
  • Yajra\Datatables\Helper
  • Yajra\Datatables\Html\Builder
  • Yajra\Datatables\Html\Column
  • Yajra\Datatables\Html\Parameters
  • Yajra\Datatables\Processors\DataProcessor
  • Yajra\Datatables\Processors\RowProcessor
  • Yajra\Datatables\Request
  • Yajra\Datatables\Services\DataTable
  • Yajra\Datatables\Transformers\DataTransformer

Interfaces

  • Yajra\Datatables\Contracts\DataTableButtonsContract
  • Yajra\Datatables\Contracts\DataTableContract
  • Yajra\Datatables\Contracts\DataTableEngineContract
  • Yajra\Datatables\Contracts\DataTableScopeContract

Functions

  • config_path
  • public_path
  • Overview
  • Namespace
  • Class
 1: <?php
 2: 
 3: namespace Yajra\Datatables\Html;
 4: 
 5: use Illuminate\Support\Fluent;
 6: 
 7: /**
 8:  * Class Column.
 9:  *
10:  * @package Yajra\Datatables\Html
11:  * @see     https://datatables.net/reference/option/ for possible columns option
12:  * @author  Arjay Angeles <aqangeles@gmail.com>
13:  */
14: class Column extends Fluent
15: {
16:     /**
17:      * @param array $attributes
18:      */
19:     public function __construct($attributes = [])
20:     {
21:         $attributes['orderable']  = isset($attributes['orderable']) ? $attributes['orderable'] : true;
22:         $attributes['searchable'] = isset($attributes['searchable']) ? $attributes['searchable'] : true;
23:         $attributes['exportable'] = isset($attributes['exportable']) ? $attributes['exportable'] : true;
24:         $attributes['printable']  = isset($attributes['printable']) ? $attributes['printable'] : true;
25:         $attributes['footer']     = isset($attributes['footer']) ? $attributes['footer'] : '';
26: 
27:         // Allow methods override attribute value
28:         foreach ($attributes as $attribute => $value) {
29:             $method = 'parse' . ucfirst(strtolower($attribute));
30:             if (method_exists($this, $method)) {
31:                 $attributes[$attribute] = $this->$method($value);
32:             }
33:         }
34: 
35:         parent::__construct($attributes);
36:     }
37: 
38:     /**
39:      * Parse render attribute.
40:      *
41:      * @param mixed $value
42:      * @return string|null
43:      */
44:     public function parseRender($value)
45:     {
46:         /** @var \Illuminate\Contracts\View\Factory $view */
47:         $view       = app('view');
48:         $parameters = [];
49: 
50:         if (is_array($value)) {
51:             $parameters = array_except($value, 0);
52:             $value      = $value[0];
53:         }
54: 
55:         if (is_callable($value)) {
56:             return $value($parameters);
57:         } elseif ($view->exists($value)) {
58:             return $view->make($value)->with($parameters)->render();
59:         }
60: 
61:         return $value ? $this->parseRenderAsString($value) : null;
62:     }
63: 
64:     /**
65:      * Display render value as is.
66:      *
67:      * @param mixed $value
68:      * @return string
69:      */
70:     private function parseRenderAsString($value)
71:     {
72:         return "function(data,type,full,meta){return $value;}";
73:     }
74: }
75: 
API documentation generated by ApiGen