update deploy
This commit is contained in:
32
app/Http/Resources/CommentResource.php
Normal file
32
app/Http/Resources/CommentResource.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\Comment;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin Comment
|
||||
*/
|
||||
class CommentResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'commentable_type' => $this->commentable_type,
|
||||
'commentable_id' => $this->commentable_id,
|
||||
'author_name' => $this->author_name,
|
||||
'content' => $this->content,
|
||||
'rating' => $this->rating,
|
||||
'is_approved' => $this->is_approved,
|
||||
'admin_reply' => $this->admin_reply,
|
||||
'created_at' => $this->created_at?->toISOString(),
|
||||
'updated_at' => $this->updated_at?->toISOString(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user