<?php

namespace App\Http\Controllers\Api\V1\Story;

use App\Http\Controllers\Api\V1\Story\Resources\StoryResource;
use App\Http\Controllers\Controller;
use App\Models\CMS\Media\Story;
use Illuminate\Http\JsonResponse;

class StoryController extends Controller
{
    /**
     * (Media) Active stories.
     */
    public function index(): JsonResponse
    {
        return response()->rest(
            StoryResource::collection(
                Story::with('media')
                    ->active()
                    ->ordered()
                    ->get()
            )
        );
    }
}
