app/Http/Livewire/Datatable.php: Reorder methods.
This commit is contained in:
parent
b012f2b6bc
commit
89755f975f
1 changed files with 32 additions and 32 deletions
|
|
@ -93,6 +93,38 @@ class Datatable extends Component
|
||||||
return class_basename($this->model);
|
return class_basename($this->model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set trashed flag.
|
||||||
|
*/
|
||||||
|
public function setTrashed($value)
|
||||||
|
{
|
||||||
|
$this->trashed = (bool) $value;
|
||||||
|
|
||||||
|
if ($this->trashed) {
|
||||||
|
// Add deleted_at columns.
|
||||||
|
$this->columns['deleted_at'] = 'Deleted at';
|
||||||
|
$this->sort_columns['deleted_at'] = 'deleted_at';
|
||||||
|
} else {
|
||||||
|
// Unset deleted_at columns.
|
||||||
|
unset($this->columns['deleted_at']);
|
||||||
|
unset($this->sort_columns['deleted_at']);
|
||||||
|
|
||||||
|
// if delete_at was the sorting column
|
||||||
|
// revert back to default sorting.
|
||||||
|
if ($this->sort == 'deleted_at') {
|
||||||
|
$this->sort = $this->default_sort;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle trashed flag
|
||||||
|
*/
|
||||||
|
public function toggleTrashed()
|
||||||
|
{
|
||||||
|
$this->setTrashed(!$this->trashed);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete an record
|
* Delete an record
|
||||||
*/
|
*/
|
||||||
|
|
@ -164,36 +196,4 @@ class Datatable extends Component
|
||||||
|
|
||||||
return view('livewire.datatable', ['items' => $items]);
|
return view('livewire.datatable', ['items' => $items]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Toggle trashed flag
|
|
||||||
*/
|
|
||||||
public function toggleTrashed()
|
|
||||||
{
|
|
||||||
$this->setTrashed(!$this->trashed);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set trashed flag.
|
|
||||||
*/
|
|
||||||
public function setTrashed($value)
|
|
||||||
{
|
|
||||||
$this->trashed = (bool) $value;
|
|
||||||
|
|
||||||
if ($this->trashed) {
|
|
||||||
// Add deleted_at columns.
|
|
||||||
$this->columns['deleted_at'] = 'Deleted at';
|
|
||||||
$this->sort_columns['deleted_at'] = 'deleted_at';
|
|
||||||
} else {
|
|
||||||
// Unset deleted_at columns.
|
|
||||||
unset($this->columns['deleted_at']);
|
|
||||||
unset($this->sort_columns['deleted_at']);
|
|
||||||
|
|
||||||
// if delete_at was the sorting column
|
|
||||||
// revert back to default sorting.
|
|
||||||
if ($this->sort == 'deleted_at') {
|
|
||||||
$this->sort = $this->default_sort;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue