<?php

namespace App\Http\Controllers\api\v1;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\api\v1\QrCode;

class CartesController extends Controller
{
    public function getpartenairefromcarteid(Request $request)
    {
        if (!isset($request->carte) || $request->carte == '') {
            return response()->json([
                'status' => 'error',
                'type' => 'no_carte',
                'response' => 'aucune carte selectionner'
            ], 200);
        }
        $cartes = QrCode::where('num_carte', $request->carte)->with('cartes_spaces')->get();
        return response()->json(['success' => true, 'message' =>  "Les cartes disponibles", 'data' => $cartes]);
    }
}
