<commit_before><?php namespace App;

use Illuminate\Database\Eloquent\Model;

class Appointment extends Model {

	protected $fillable = ['contact_id', 'business_id', 'date', 'time', 'duration', 'comments'];

	public function contact()
	{
		return $this->belongsTo('\App\Contact');
	}

}
<commit_msg>Add appointment finishTime and statusLabel attributes<commit_after><?php namespace App;

use Illuminate\Database\Eloquent\Model;

use Carbon\Carbon;

class Appointment extends Model {

	protected $fillable = ['contact_id', 'business_id', 'date', 'time', 'duration', 'comments'];

	const STATUS_RESERVED  = 'R';
	const STATUS_CONFIRMED = 'C';
	const STATUS_ANNULATED = 'A';
	const STATUS_SERVED    = 'S';

	public function contact()
	{
		return $this->belongsTo('\App\Contact');
	}

	public function getFinishTimeAttribute()
	{
		if (is_numeric($this->duration)) {
			$carbon = new Carbon("{$this->date} {$this->time}");
			return $carbon->addMinutes($this->duration);
		}
	}

	public function getStatusLabelAttribute()
	{
		switch ($this->status) {
			case Self::STATUS_RESERVED:
				$label = trans('appointments.status.reserved');
				break;
			case Self::STATUS_CONFIRMED:
				$label = trans('appointments.status.confirmed');
				break;
			case Self::STATUS_ANNULATED:
				$label = trans('appointments.status.annulated');
				break;
			case Self::STATUS_SERVED:
				$label = trans('appointments.status.annulated');
				break;
			default:
				$label = '?';
				break;
		}
		return $label;
	}

}

{'fraction_non_alphanumeric': 0.15117056856187291, 'fraction_numerical': 0.0, 'mean_word_length': 4.5, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2927530', 'n_tokens_mistral': 556, 'n_tokens_neox': 494, 'n_words': 104}