<?php

namespace App\Http\Controllers;

use App\Http\Requests\GameServersRequest;
use App\Http\Resources\GameServersResource;
use App\Models\GameServers;

class GameServersController extends Controller
{
    public function index()
    {
        return GameServersResource::collection(GameServers::all());
    }

    public function store(GameServersRequest $request)
    {
        return new GameServersResource(GameServers::create($request->validated()));
    }

    public function show(GameServers $gameServers)
    {
        return new GameServersResource($gameServers);
    }

    public function update(GameServersRequest $request, GameServers $gameServers)
    {
        $gameServers->update($request->validated());

        return new GameServersResource($gameServers);
    }

    public function destroy(GameServers $gameServers)
    {
        $gameServers->delete();

        return response()->json();
    }
}
