<?php
defined('BASEPATH') OR exit('No direct script access allowed');

/**
 * Service_model — creative service offerings.
 */
#[\AllowDynamicProperties]
class Service_model extends MY_Model {

	protected $table = 'services';
	protected $order_by = 'sort_order ASC, id ASC';

	/** Active services for the public site. */
	public function active()
	{
		return $this->get_all(array('is_active' => 1));
	}

	/** Fetch a single active service by slug. */
	public function by_slug($slug)
	{
		return $this->get_by(array('slug' => $slug, 'is_active' => 1));
	}

	/** Build a select-friendly id => title map. */
	public function options()
	{
		$out = array();
		foreach ($this->get_all() as $row)
		{
			$out[$row['id']] = $row['title'];
		}
		return $out;
	}
}
