Skip to content

Commit

Permalink
Merge pull request #4 from sajadsdi/fix/data_type
Browse files Browse the repository at this point in the history
[Fix] empty data type to object
  • Loading branch information
sajadsdi authored Jul 30, 2024
2 parents b566a45 + f81775f commit 2e7593d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.4] - 2024-07-31

### Added

- No addition.

### Changed

- Change `data` default type to object in response.

### Fixed

- Fix empty data type bug.

## [1.0.3] - 2024-04-23

### Added
Expand Down
4 changes: 2 additions & 2 deletions src/Concerns/RestResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ protected function getVersion(): string
* @param int $status
* @return Response|ResponseFactory
*/
public function response(mixed $data = [], string $message = 'Success!', array $errors = [], int $status = 200): Response|ResponseFactory
public function response(array $data = [], string $message = 'Success!', array $errors = [], int $status = 200): Response|ResponseFactory
{
return response([
'data' => $data,
'data' => (object)$data,
'message' => $message,
'errors' => (object)$errors,
'status' => $status,
Expand Down

0 comments on commit 2e7593d

Please sign in to comment.