<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;

class Workshop extends Model
{
    protected $fillable = ['title','slug','short_description','description','workshop_date','duration','price','seats_available','venue','image','is_online','is_active'];
    protected $casts = ['workshop_date' => 'datetime', 'is_online' => 'boolean', 'is_active' => 'boolean'];

    public function bookings() { return $this->hasMany(WorkshopBooking::class); }
    public function scopeActive($query) { return $query->where('is_active', true)->orderBy('workshop_date'); }
    public function getIsUpcomingAttribute() { return $this->workshop_date && $this->workshop_date->isFuture(); }
}
