<?php

namespace App\Http\Controllers;

use App\Models\Credits;
use Illuminate\Http\Request;

class CreditsController extends Controller
{
    public function getCredits()
    {
        $credits = Credits::first();
        if ($credits) {
            return response()->json(['credits' => $credits->number]);
        } else {
            return response()->json(['credits' => 0]);
        }
    }
}
