|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace Yajra\DataTables\Html; |
| 6 | + |
| 7 | +use Illuminate\Support\Fluent; |
| 8 | +use Illuminate\Support\Traits\Macroable; |
| 9 | + |
| 10 | +class Layout extends Fluent |
| 11 | +{ |
| 12 | + use Macroable; |
| 13 | + |
| 14 | + public function topStart(string|array|null $options, int $order = 0): static |
| 15 | + { |
| 16 | + return $this->top($options, $order, 'Start'); |
| 17 | + } |
| 18 | + |
| 19 | + public function topEnd(string|array|null $options, int $order = 0): static |
| 20 | + { |
| 21 | + return $this->top($options, $order, 'End'); |
| 22 | + } |
| 23 | + |
| 24 | + public function bottomStart(string|array|null $options, int $order = 0): static |
| 25 | + { |
| 26 | + return $this->bottom($options, $order, 'Start'); |
| 27 | + } |
| 28 | + |
| 29 | + public function bottomEnd(string|array|null $options, int $order = 0): static |
| 30 | + { |
| 31 | + return $this->bottom($options, $order, 'End'); |
| 32 | + } |
| 33 | + |
| 34 | + public function top(array|string|null $options, ?int $order = null, ?string $position = null): static |
| 35 | + { |
| 36 | + if ($order > 0) { |
| 37 | + $this->attributes["top{$order}{$position}"] = $options; |
| 38 | + } else { |
| 39 | + $this->attributes["top{$position}"] = $options; |
| 40 | + } |
| 41 | + |
| 42 | + return $this; |
| 43 | + } |
| 44 | + |
| 45 | + public function bottom(array|string|null $options, ?int $order = null, ?string $position = null): static |
| 46 | + { |
| 47 | + if ($order > 0) { |
| 48 | + $this->attributes["bottom{$order}{$position}"] = $options; |
| 49 | + } else { |
| 50 | + $this->attributes["bottom{$position}"] = $options; |
| 51 | + } |
| 52 | + |
| 53 | + return $this; |
| 54 | + } |
| 55 | +} |
0 commit comments