$scheduledUserDishes * @method static create(array $array) * @method static Builder where(array|Closure|Expression|string $column, mixed $operator = null, mixed $value = null, string $boolean = 'and') * @method static ScheduleFactory factory($count = null, $state = []) */ class Schedule extends Model { /** @use HasFactory */ use HasFactory; protected $table = 'schedules'; public $timestamps = false; protected $fillable = ['planner_id', 'date', 'is_skipped']; protected $casts = [ 'date' => 'date', 'is_skipped' => 'boolean', ]; protected static function booted(): void { static::addGlobalScope(new BelongsToPlanner); } public function scheduledUserDishes(): HasMany { return $this->hasMany(ScheduledUserDish::class); } public function hasAllUsersScheduled(): bool { return $this->scheduledUserDishes->count() === User::all()->count(); } }