<?php

namespace App\Repositories;

use App\Models\Profil;

class ProfilRepository
{

    protected $profil;

    public function __construct(Profil $profil)
    {
        $this->profil = $profil;
    }

    public function getProfil(): ?Profil
    {
        return $this->profil->first();
    }

    public function saveProfil(array $data): Profil
    {
        // Adjust the unique keys and fields as needed
        return $this->profil->updateOrCreate(
            ['id' => $data['id'] ?? null], // or another unique key
            $data
        );
    }
}
