-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from franciscobizi/dev
Adding errors message
- Loading branch information
Showing
2 changed files
with
35 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace FBIZI\Traits; | ||
|
||
/** | ||
* Auth Error Response | ||
* | ||
* @author Francisco Bizi <dev@dev.com> | ||
*/ | ||
trait AuthErrorResponse | ||
{ | ||
protected function missingToken(string $message = "") | ||
{ | ||
$message = !empty($message) ? $message : "Missing token. Get token before procceed to this action."; | ||
return ['code' => 401, 'message' => $message]; | ||
} | ||
|
||
protected function unauthorized(string $message = "") | ||
{ | ||
$message = !empty($message) ? $message : "Don't have permission to access it."; | ||
return ['code' => 403, 'message' => $message]; | ||
} | ||
} |