-
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.
feat: create logic for show challenge
- Loading branch information
1 parent
1578387
commit c468026
Showing
4 changed files
with
42 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\DTO\Api\Challenge\Response; | ||
|
||
use App\Models\Challenge; | ||
use App\Models\User; | ||
use Illuminate\Database\Eloquent\Collection; | ||
use Spatie\LaravelData\Data; | ||
|
||
class ChallengeShowDTO extends Data | ||
{ | ||
public function __construct( | ||
public Challenge $challenge, | ||
public Collection $members, | ||
) { | ||
} | ||
|
||
public static function fromModel(Challenge $challenge): self | ||
{ | ||
return new self( | ||
$challenge, | ||
$challenge->users()->get(), | ||
); | ||
} | ||
} |
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
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