Files
kalendar/app/Term.php
2018-10-30 15:24:18 +01:00

81 lines
2.3 KiB
PHP

<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
/**
* Class Term
*
* @package App
* @property integer $id
* @property integer $day
* @property integer $month
* @property integer $inter
* @property integer $applies_to
* @property string $name
* @property string $desc
* @mixin \Eloquent
* @property \Carbon\Carbon|null $created_at
* @property \Carbon\Carbon|null $updated_at
* @method static \Illuminate\Database\Eloquent\Builder|\App\Term whereAppliesTo($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Term whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Term whereDay($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Term whereDesc($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Term whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Term whereInter($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Term whereMonth($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Term whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Term whereUpdatedAt($value)
*/
class Term extends Model
{
public static function getDays($value = null)
{
$days = range(1, 31);
$days = array_combine($days, $days);
$days[-1] = 'poslední den';
if ($value === null) {
return $days;
}
return $days[$value];
}
public static function getMonths($value = null)
{
$months = range(1, 12);
$months = array_combine($months, $months);
$months = ['' => ''] + $months;
if ($value === null) {
return $months;
}
return $months[$value];
}
public static function getInter($value = null)
{
$inter = [
0 => 'měsíčně',
1 => 'čtvrtletně',
2 => 'ročně',
];
if ($value === null) {
return $inter;
}
return $inter[$value];
}
public static function getAppliesTo($value = null)
{
$applies_to = [
0 => 'měsíční i čtvrtletní',
1 => 'měsíční',
2 => 'čtvrtletní',
];
if ($value === null) {
return $applies_to;
}
return $applies_to[$value];
}
}