Skip to content

Commit

Permalink
add boot to votes
Browse files Browse the repository at this point in the history
  • Loading branch information
MoamenEltouny committed Aug 25, 2022
1 parent 908d077 commit 9cb3fcf
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Traits/Actions/Vote/isVotable.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@

trait isVotable
{
/**
* Bootstrap the trait.
*
* @return void
*/
public static function bootIsVotable()
{
static::deleting(function ($model) {
$model->votes()->delete();
});
}

/**
* Get Vote Object
*
Expand Down
12 changes: 12 additions & 0 deletions src/Traits/Actions/Vote/isVoter.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@

trait isVoter
{
/**
* Bootstrap the trait.
*
* @return void
*/
public static function bootIsVoter()
{
static::deleting(function ($model) {
$model->votes()->delete();
});
}

/**
* Get Vote Object
*
Expand Down

0 comments on commit 9cb3fcf

Please sign in to comment.