mirror of https://github.com/4xmen/xshop.git
added markup json to product and post
parent
3b0017010b
commit
545045005c
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Resources;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||||
|
|
||||||
|
class CommentMarkupCollection extends JsonResource
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Transform the resource collection into an array.
|
||||||
|
*
|
||||||
|
* @return array<int|string, mixed>
|
||||||
|
*/
|
||||||
|
public function toArray(Request $request): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'@type' => 'Review',
|
||||||
|
'reviewBody' =>$this->body,
|
||||||
|
'datePublished' => $this->created_at,
|
||||||
|
'author' =>
|
||||||
|
[
|
||||||
|
'@type' => 'Person',
|
||||||
|
'name' => $this->commentator()['name'],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue