Skip to content

Commit

Permalink
Update RepositoryContract.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Torann authored May 18, 2023
1 parent 77c3afb commit 8daf664
Showing 1 changed file with 43 additions and 7 deletions.
50 changes: 43 additions & 7 deletions src/Contracts/RepositoryContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Torann\LaravelRepository\Contracts;

use Illuminate\Support\Collection;
use Illuminate\Support\MessageBag;
use Illuminate\Database\Eloquent\Model;

/**
Expand Down Expand Up @@ -168,24 +169,59 @@ public function delete(mixed $entity);
public function toSql();

/**
* Add a message to the repository's error messages.
*
* @return MessageBag
*/
public function getMessageBag(): MessageBag;

/**
* @param string $message
* @param string $key
*
* @return static
*/
public function addError(string $message, string $key = 'message');
public function addMessage(string $message, string $key = 'message'): static;

/**
* @param string $key
*
* @return bool
*/
public function hasMessage(string $key = 'message'): bool;

/**
* Get the repository's error messages.
* @param string|null $key
* @param string|null $format
* @param string $default
*
* @return string
*/
public function getMessage(string $key = null, string $format = null, string $default = ''): string;

/**
* Add an error to the message box
*
* @return bool
*/
public function addError(string $message);

/**
* Determine if any errors were reported
*
* @return bool
*/
public function hasErrors(): bool;

/**
* Get all error messages.
*
* @param string|null $format
*
* @return \Illuminate\Support\MessageBag
* @return array
*/
public function getErrors();
public function getErrors(): array;

/**
* Get the repository's first error message.
* Get a single error message.
*
* @param string $default
*
Expand Down

0 comments on commit 8daf664

Please sign in to comment.