Skip to content

Commit

Permalink
Add model methods to the Activity contract
Browse files Browse the repository at this point in the history
  • Loading branch information
zbundy committed Jul 2, 2024
1 parent 93288ac commit 7576cc3
Showing 1 changed file with 104 additions and 0 deletions.
104 changes: 104 additions & 0 deletions src/Contracts/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,108 @@ public function scopeCausedBy(Builder $query, Model $causer): Builder;
public function scopeForEvent(Builder $query, string $event): Builder;

public function scopeForSubject(Builder $query, Model $subject): Builder;

/**
* Update the model in the database.
*
* @param array $attributes
* @param array $options
* @return bool
*/
public function update(array $attributes = [], array $options = []);

/**
* Update the model in the database within a transaction.
*
* @param array $attributes
* @param array $options
* @return bool
*
* @throws \Throwable
*/
public function updateOrFail(array $attributes = [], array $options = []);

/**
* Update the model in the database without raising any events.
*
* @param array $attributes
* @param array $options
* @return bool
*/
public function updateQuietly(array $attributes = [], array $options = []);

/**
* Save the model to the database.
*
* @param array $options
* @return bool
*/
public function save(array $options = []);

/**
* Save the model to the database without raising any events.
*
* @param array $options
* @return bool
*/
public function saveQuietly(array $options = []);

/**
* Save the model to the database within a transaction.
*
* @param array $options
* @return bool
*
* @throws \Throwable
*/
public function saveOrFail(array $options = []);

/**
* Delete the model from the database.
*
* @return bool|null
*
* @throws \LogicException
*/
public function delete();

/**
* Delete the model from the database without raising any events.
*
* @return bool
*/
public function deleteQuietly();

/**
* Delete the model from the database within a transaction.
*
* @return bool|null
*
* @throws \Throwable
*/
public function deleteOrFail();

/**
* Force a hard delete on a soft deleted model.
*
* This method protects developers from running forceDelete when the trait is missing.
*
* @return bool|null
*/
public function forceDelete();

/**
* Reload a fresh model instance from the database.
*
* @param array|string $with
* @return static|null
*/
public function fresh($with = []);

/**
* Reload the current model instance with fresh attributes from the database.
*
* @return $this
*/
public function refresh();
}

0 comments on commit 7576cc3

Please sign in to comment.