<?php

namespace App\Models;

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

class StageAcademyUser extends Model
{
    use SoftDeletes;

    protected $fillable = [
        'name',
        'country',
        'province',
        'gender',
        'phone',
        'image',
        'password',
        'source_type',
        'password_reset_at',
    ];

    protected $hidden = [
        'password',
    ];

    protected $casts = [
        'password_reset_at' => 'datetime',
    ];

    public function courses(): BelongsToMany
    {
        return $this->belongsToMany(StageAcademyCourse::class, 'stage_academy_user_courses', 'user_id', 'course_id')
            ->withTimestamps();
    }
}
