Pajak.php 742 Bytes
<?php

/**
 * @Author: irul
 * @Date:   2019-09-20 23:30:29
 * @Last Modified by:   irul
 * @Last Modified time: 2019-10-01 23:43:20
 */

namespace Integrasi\Reklame\Base\Models;

class Pajak extends AbstractModel
{
	protected $table   = 'pad_pajak';
	protected $visible = array('id', 'pajaknm', 'tarif', 'latestTarif');

	// == RELATIONSHIPS == //

	/**
	 * Get the tarif record associated with the pajak.
	 */
	public function tarif()
	{
		return $this->hasMany($this->getParentNamespace() . '\PajakTarif');
	}

	/**
	 * Get the latest tarif record associated with the pajak.
	 */
	public function latestTarif()
	{
		return $this->hasOne($this->getParentNamespace() . '\PajakTarif')
			->whereEnabled(1)
			->latest(self::CREATED_AT);
	}
}