for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace CSlant\Blog\Api\Http\Resources\Post;
use CSlant\Blog\Core\Facades\Base\Media\RvMedia;
use CSlant\Blog\Core\Models\Post;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
/**
* Post Navigation Resource for previous/next navigation
*/
class PostNavigationResource extends JsonResource
{
* @param Request $request
*
* @return array<string, mixed>
public function toArray($request): array
if (!$this->resource) {
return [];
}
/** @var Post $this */
return [
'id' => $this->id,
'name' => $this->name,
'description' => $this->description,
'slug' => $this->slug,
'url' => $this->url,
'image' => $this->image ? RvMedia::getImageUrl($this->image) : null,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
];