Skip to content

Commit

Permalink
feat: added setActive And setInactive function to CanBeInactive Trait (
Browse files Browse the repository at this point in the history
  • Loading branch information
Dipesh79 authored Feb 4, 2024
1 parent ee9cedb commit 330a190
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/Traits/CanBeInactive.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,29 @@ public function getQualifiedInactiveAtColumn(): string
return $this->qualifyColumn($this->getInactiveAtColumn());
}

/**
* Inactivate the model.
*
* @return bool
*/
public function setInactive(): bool
{
$this->{$this->getInactiveAtColumn()} = $this->freshTimestamp();
return $this->save();
}

/**
* Activate the model.
*
* @return bool
*/

public function setActive(): bool
{
$this->{$this->getInactiveAtColumn()} = null;
return $this->save();
}



}

0 comments on commit 330a190

Please sign in to comment.