<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;

/**
 * @property int $id
 * @property string $name
 * @property string|null $description
 */
class Group extends Model
{
    protected $fillable = ['name', 'description'];

    /**
     * Nama grup yang dikenali sistem (RPD §6).
     */
    public const ADMIN = 'admin';

    public const MEMBERS = 'members';

    public const DEVELOPER = 'developer';

    public function users(): BelongsToMany
    {
        return $this->belongsToMany(User::class, 'users_groups');
    }
}
