.
This commit is contained in:
80
app/Term.php
Normal file
80
app/Term.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?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];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user