# shiftcontroller/2.1.0/application/models/location_model.php

ShiftController Employee Shift Scheduling, version 2.1.0. 45 lines.

- Page: https://pluginprobe.com/plugins/shiftcontroller/2.1.0/code/application/models/location_model.php
- Raw: https://pluginprobe.com/plugins/shiftcontroller/2.1.0/raw/application/models/location_model.php
- Modified: 2013-11-19T19:08:10+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/shiftcontroller/2.1.0/code/application/models/location_model.php#L10-L20`.

```php
<?php
class Location_model extends MY_model
{
	var $table = 'locations';
	var $allow_none = FALSE;
	var $default_order_by = array('show_order' => 'ASC');
	var $build_title = array(
		'_name_'
		);

	var $has_many = array( 
		'shift' => array(
			'class'			=> 'shift_model',
			'other_field'	=> 'location',
			),
		);

	var $validation = array(
		'name'	=> array(
			'label'	=> 'lang:location_name',
			'rules'	=> array('required', 'trim', 'max_length' => 50, 'unique')
			)
		);

	var $my_fields = array(
		array(
			'name'		=> 'name',
			'label'		=> 'lang:location_name',
			'size'		=> 24,
			'required'	=> TRUE,
			),
		);

	public function title( $html = FALSE )
	{
		$return = '';
		if( $html )
		{
			$return .= '<i class="icon-home"></i> ';
		}

		$return .= parent::title();
		return $return;
	}
}
```
