@@ -18,7 +18,7 @@ |
||
| 18 | 18 | /** |
| 19 | 19 | * Constructor. |
| 20 | 20 | * |
| 21 | - * @param Builder $src |
|
| 21 | + * @param Collection $src |
|
| 22 | 22 | */ |
| 23 | 23 | public function __construct(Collection $src) |
| 24 | 24 | { |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | |
| 4 | 4 | use Illuminate\Database\Eloquent\Builder; |
| 5 | 5 | use Event; |
| 6 | -use Illuminate\Foundation\Application; |
|
| 7 | 6 | use Illuminate\Support\Collection; |
| 8 | 7 | |
| 9 | 8 | class CollectionDataProvider extends DataProvider |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | */ |
| 56 | 56 | public function getPaginationFactory() |
| 57 | 57 | { |
| 58 | - return $this->getPaginator();//$this->src->getQuery()->getConnection()->getPaginator(); |
|
| 58 | + return $this->getPaginator(); //$this->src->getQuery()->getConnection()->getPaginator(); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | protected function getIterator() |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | $b = new Blueprint(self::GRID_CLASS, [ |
| 84 | 84 | new BuildDataProvider(), |
| 85 | - new CustomInstruction(function (Scaffold $s) { |
|
| 85 | + new CustomInstruction(function(Scaffold $s) { |
|
| 86 | 86 | /** @var EloquentDataProvider $provider */ |
| 87 | 87 | $provider = $s->getInput('data_provider'); |
| 88 | 88 | $is_eloquent = $provider instanceof EloquentDataProvider; |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | { |
| 120 | 120 | $blueprint = new Blueprint(self::COMPONENT_CLASS, [ |
| 121 | 121 | |
| 122 | - new CustomInstruction(function (Scaffold $s) { |
|
| 122 | + new CustomInstruction(function(Scaffold $s) { |
|
| 123 | 123 | if ($s->input instanceof Closure) { |
| 124 | 124 | $s->class = 'Nayjest\Grids\Components\RenderFunc'; |
| 125 | 125 | $s->constructor_arguments = [$s->input]; |
@@ -127,13 +127,13 @@ discard block |
||
| 127 | 127 | } elseif (is_string($s->input)) { |
| 128 | 128 | $s->class = 'Nayjest\Grids\Components\RenderFunc'; |
| 129 | 129 | $out = $s->input; |
| 130 | - $s->constructor_arguments = [function () use ($out) { |
|
| 130 | + $s->constructor_arguments = [function() use ($out) { |
|
| 131 | 131 | return $out; |
| 132 | 132 | }]; |
| 133 | 133 | $s->input = []; |
| 134 | 134 | } |
| 135 | 135 | }, Instruction::PHASE_PRE_INST), |
| 136 | - new CustomMapping('type', function ($type, Scaffold $s) { |
|
| 136 | + new CustomMapping('type', function($type, Scaffold $s) { |
|
| 137 | 137 | if (strpos($type, '\\') !== false) { |
| 138 | 138 | $s->class = $type; |
| 139 | 139 | } else { |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | { |
| 164 | 164 | return new Blueprint(self::FILTER_CLASS, [ |
| 165 | 165 | new SimpleValueAsField('name'), |
| 166 | - new CustomMapping('type', function ($type, Scaffold $s) { |
|
| 166 | + new CustomMapping('type', function($type, Scaffold $s) { |
|
| 167 | 167 | switch ($type) { |
| 168 | 168 | case 'select': |
| 169 | 169 | $s->class = 'Nayjest\Grids\SelectFilterConfig'; |
@@ -18,8 +18,8 @@ |
||
| 18 | 18 | $before = ''; |
| 19 | 19 | $after = ''; |
| 20 | 20 | foreach ($this->html_tags as $tag) { |
| 21 | - $before.="<$tag>"; |
|
| 22 | - $after = "</$tag>".$after; |
|
| 21 | + $before .= "<$tag>"; |
|
| 22 | + $after = "</$tag>" . $after; |
|
| 23 | 23 | } |
| 24 | 24 | return $before . $this->renderComponents() . $after; |
| 25 | 25 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | public function initialize(Grid $grid) |
| 49 | 49 | { |
| 50 | 50 | parent::initialize($grid); |
| 51 | - Event::listen(Grid::EVENT_PREPARE, function (Grid $grid) { |
|
| 51 | + Event::listen(Grid::EVENT_PREPARE, function(Grid $grid) { |
|
| 52 | 52 | if ($this->grid !== $grid) { |
| 53 | 53 | return; |
| 54 | 54 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $file = fopen('php://output', 'w'); |
| 114 | 114 | |
| 115 | 115 | header('Content-Type: text/csv'); |
| 116 | - header('Content-Disposition: attachment; filename="'. $this->getFileName() .'"'); |
|
| 116 | + header('Content-Disposition: attachment; filename="' . $this->getFileName() . '"'); |
|
| 117 | 117 | header('Pragma: no-cache'); |
| 118 | 118 | |
| 119 | 119 | set_time_limit(0); |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | ] |
| 147 | 147 | ], |
| 148 | 148 | 'current_month' => [ |
| 149 | - 'Cur. month (' . date('F'). ')', |
|
| 149 | + 'Cur. month (' . date('F') . ')', |
|
| 150 | 150 | [ |
| 151 | 151 | $carbon->startOfMonth()->format('Y-m-d'), |
| 152 | 152 | $carbon->endOfMonth()->format('Y-m-d') |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | |
| 225 | 225 | protected function getDefaultFilteringFunc() |
| 226 | 226 | { |
| 227 | - return function ($value, DataProvider $provider) { |
|
| 227 | + return function($value, DataProvider $provider) { |
|
| 228 | 228 | $provider->filter($this->getName(), '>=', $value[0]); |
| 229 | 229 | $provider->filter($this->getName(), '<=', $value[1]); |
| 230 | 230 | }; |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | |
| 24 | 24 | protected function setupPaginationForReading() |
| 25 | 25 | { |
| 26 | - Paginator::currentPageResolver(function () { |
|
| 26 | + Paginator::currentPageResolver(function() { |
|
| 27 | 27 | return Input::get("$this->input_key.page", 1); |
| 28 | 28 | }); |
| 29 | 29 | } |
@@ -73,7 +73,7 @@ |
||
| 73 | 73 | if ($from_input === null) { |
| 74 | 74 | return $this->grid->getConfig()->getPageSize(); |
| 75 | 75 | } else { |
| 76 | - return (int) $from_input; |
|
| 76 | + return (int)$from_input; |
|
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | { |
| 60 | 60 | $field_names = $this->field_names; |
| 61 | 61 | $this->fields = $this->grid->getConfig()->getColumns()->filter( |
| 62 | - function (FieldConfig $field) use ($field_names) { |
|
| 62 | + function(FieldConfig $field) use ($field_names) { |
|
| 63 | 63 | return in_array($field->getName(), $field_names); |
| 64 | 64 | } |
| 65 | 65 | ); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | { |
| 77 | 77 | Event::listen( |
| 78 | 78 | DataProvider::EVENT_FETCH_ROW, |
| 79 | - function (DataRow $row, DataProvider $currentProvider) use ($provider) { |
|
| 79 | + function(DataRow $row, DataProvider $currentProvider) use ($provider) { |
|
| 80 | 80 | if ($currentProvider !== $provider) { |
| 81 | 81 | return; |
| 82 | 82 | } |
@@ -219,6 +219,6 @@ discard block |
||
| 219 | 219 | */ |
| 220 | 220 | public function getFieldOperation($fieldName) |
| 221 | 221 | { |
| 222 | - return isset($this->field_operations[$fieldName])?$this->field_operations[$fieldName]:self::OPERATION_SUM; |
|
| 222 | + return isset($this->field_operations[$fieldName]) ? $this->field_operations[$fieldName] : self::OPERATION_SUM; |
|
| 223 | 223 | } |
| 224 | 224 | } |