Skip to content

Commit

Permalink
Added helper methods for full page configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
amshehzad committed Nov 2, 2023
1 parent 71c2602 commit 77c28e0
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 37 deletions.
10 changes: 5 additions & 5 deletions src/DataTableComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,20 +131,20 @@ public function render(): \Illuminate\Contracts\Foundation\Application|\Illumina

$view = view('livewire-tables::datatable');

if (isset($this->layout)){
if ($this->hasLayout()){
$view->layout($this->layout);

Check warning on line 135 in src/DataTableComponent.php

View check run for this annotation

Codecov / codecov/patch

src/DataTableComponent.php#L135

Added line #L135 was not covered by tests
}

if (isset($this->extends)){
if ($this->hasExtends()){
$view->extends($this->extends);

Check warning on line 139 in src/DataTableComponent.php

View check run for this annotation

Codecov / codecov/patch

src/DataTableComponent.php#L139

Added line #L139 was not covered by tests
}

if (isset($this->section)){
if ($this->hasSection()){
$view->section($this->section);

Check warning on line 143 in src/DataTableComponent.php

View check run for this annotation

Codecov / codecov/patch

src/DataTableComponent.php#L143

Added line #L143 was not covered by tests
}

if (isset($this->slot)){
$view->section($this->slot);
if ($this->hasSlot()){
$view->slot($this->slot);

Check warning on line 147 in src/DataTableComponent.php

View check run for this annotation

Codecov / codecov/patch

src/DataTableComponent.php#L147

Added line #L147 was not covered by tests
}

$view->with([
Expand Down
8 changes: 4 additions & 4 deletions src/Traits/ComponentUtilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ trait ComponentUtilities

protected $tdAttributesCallback;

protected string $layout;
protected ?string $layout = null;

protected string $slot;
protected ?string $slot = null;

protected string $extends;
protected ?string $extends = null;

protected string $section;
protected ?string $section = null;

protected bool $collapsingColumnsStatus = true;

Expand Down
28 changes: 0 additions & 28 deletions src/Traits/Configuration/ComponentConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,32 +275,4 @@ public function setSection(string $section): self

return $this;
}

public function setLayout(string $layout): self
{
$this->layout = $layout;

return $this;
}

public function setSlot(string $slot): self
{
$this->slot = $slot;

return $this;
}

public function setExtends(string $layout): self
{
$this->extends = $layout;

return $this;
}

public function setSection(string $section): self
{
$this->section = $section;

return $this;
}
}
20 changes: 20 additions & 0 deletions src/Traits/Helpers/ComponentHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,41 @@ public function getModel()
return $this->model;
}

public function hasExtends()
{
return $this->extends !== null;
}

public function getExtends()
{
return $this->extends;
}

public function hasSection()
{
return $this->section !== null;
}

public function getSection()
{
return $this->section;
}

public function hasSlot()
{
return $this->slot !== null;
}

public function getSlot()
{
return $this->slot;
}

public function hasLayout()
{
return $this->layout !== null;
}

public function getLayout()
{
return $this->layout;
Expand Down

0 comments on commit 77c28e0

Please sign in to comment.