EscolaLMS/Courses

View on GitHub
src/Http/Resources/TopicSimpleResource.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
<?php

namespace EscolaLms\Courses\Http\Resources;

use EscolaLms\Auth\Traits\ResourceExtandable;
use EscolaLms\Courses\Facades\Topic;
use Illuminate\Http\Resources\Json\JsonResource;

class TopicSimpleResource extends TopicResource
{
    public function toArray($request)
    {
        $response = parent::toArray($request);
        if (!$this->resource->preview) {
            unset($response['topicable']);
            unset($response['resources']);
        }

        return $response;
    }
}