<?php

namespace App\Models;

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

class Team extends Model
{
    use HasFactory, SoftDeletes;

    protected $fillable = ['business_id', 'manager_id', 'name', 'code', 'description', 'status'];

    public function business() { return $this->belongsTo(Business::class); }
    public function manager() { return $this->belongsTo(User::class, 'manager_id'); }
    public function members() { return $this->belongsToMany(User::class)->withTimestamps(); }
}
