<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Target extends Model
{
    use HasFactory;

    protected $fillable = ['name', 'code', 'goal_id', 'content'];

    public function goal()
    {
        return $this->belongsTo(Goal::class);
    }    

    /**
     * The roles that belong to the user.
     */
    public function communes()
    {
        return $this->belongsToMany(Commune::class, 'spatialisations');
    }
}
