<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class JobCategory extends Model
{
	protected $table = 'job_categories';

	public function jobs(){
		return $this->hasMany('App\Job');
	}

	public function url(){
		return '/category/'.$this->slug;
	}

	public function shortDescription(){
		$description = $this->description;
		$truncated = (strlen($description) > 45) ? substr($description, 0, 45) . '...' : $description;
		return $truncated;
	}
}
