mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Some new tests and fixes. [skip ci]
This commit is contained in:
@@ -5,25 +5,25 @@ use LaravelBook\Ardent\Ardent as Ardent;
|
||||
/**
|
||||
* Limit
|
||||
*
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property integer $component_id
|
||||
* @property \Carbon\Carbon $startdate
|
||||
* @property float $amount
|
||||
* @property boolean $repeats
|
||||
* @property string $repeat_freq
|
||||
* @property-read \Component $component
|
||||
* @property-read \Budget $budget
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property integer $component_id
|
||||
* @property \Carbon\Carbon $startdate
|
||||
* @property float $amount
|
||||
* @property boolean $repeats
|
||||
* @property string $repeat_freq
|
||||
* @property-read \Component $component
|
||||
* @property-read \Budget $budget
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\LimitRepetition[] $limitrepetitions
|
||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereComponentId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereStartdate($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereAmount($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereRepeats($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereRepeatFreq($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereComponentId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereStartdate($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereAmount($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereRepeats($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereRepeatFreq($value)
|
||||
*/
|
||||
class Limit extends Ardent
|
||||
{
|
||||
@@ -38,17 +38,23 @@ class Limit extends Ardent
|
||||
|
||||
];
|
||||
|
||||
public static $factory
|
||||
= [
|
||||
public static function factory()
|
||||
{
|
||||
$start = new Carbon\Carbon;
|
||||
$start->startOfMonth();
|
||||
|
||||
return [
|
||||
'component_id' => 'factory|Budget',
|
||||
'startdate' => 'date',
|
||||
'enddate' => 'date',
|
||||
'amount' => '100'
|
||||
'startdate' => $start,
|
||||
'amount' => '100',
|
||||
'repeats' => 0,
|
||||
'repeat_freq' => 'monthly'
|
||||
];
|
||||
}
|
||||
|
||||
public function component()
|
||||
{
|
||||
return $this->belongsTo('Component','component_id');
|
||||
return $this->belongsTo('Component', 'component_id');
|
||||
}
|
||||
|
||||
public function budget()
|
||||
@@ -56,7 +62,8 @@ class Limit extends Ardent
|
||||
return $this->belongsTo('Budget', 'component_id');
|
||||
}
|
||||
|
||||
public function limitrepetitions() {
|
||||
public function limitrepetitions()
|
||||
{
|
||||
return $this->hasMany('LimitRepetition');
|
||||
}
|
||||
|
||||
|
||||
@@ -31,13 +31,19 @@ class LimitRepetition extends Ardent
|
||||
'amount' => 'numeric|required|min:0.01',
|
||||
];
|
||||
|
||||
public static $factory
|
||||
= [
|
||||
public static function factory()
|
||||
{
|
||||
$start = new \Carbon\Carbon;
|
||||
$start->startOfMonth();
|
||||
$end = clone $start;
|
||||
$end->endOfMonth();
|
||||
return [
|
||||
'limit_id' => 'factory|Limit',
|
||||
'startdate' => 'date',
|
||||
'enddate' => 'date',
|
||||
'amount' => 'integer'
|
||||
'startdate' => $start,
|
||||
'enddate' => $end,
|
||||
'amount' => 100
|
||||
];
|
||||
}
|
||||
|
||||
public function limit()
|
||||
{
|
||||
|
||||
@@ -32,13 +32,13 @@ use LaravelBook\Ardent\Ardent;
|
||||
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereDate($value)
|
||||
* @method static \TransactionJournal after($date)
|
||||
* @method static \TransactionJournal before($date)
|
||||
* @property integer $user_id
|
||||
* @property-read \User $user
|
||||
* @property integer $user_id
|
||||
* @property-read \User $user
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\
|
||||
* 'Budget[] $budgets
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\
|
||||
* 'Category[] $categories
|
||||
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereUserId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereUserId($value)
|
||||
*/
|
||||
class TransactionJournal extends Ardent
|
||||
{
|
||||
@@ -52,15 +52,18 @@ class TransactionJournal extends Ardent
|
||||
'completed' => 'required|between:0,1'
|
||||
];
|
||||
|
||||
public static $factory
|
||||
= [
|
||||
public static function factory()
|
||||
{
|
||||
$date = new \Carbon\Carbon;
|
||||
return [
|
||||
'transaction_type_id' => 'factory|TransactionType',
|
||||
'transaction_currency_id' => 'factory|TransactionCurrency',
|
||||
'description' => 'string',
|
||||
'completed' => '1',
|
||||
'user_id' => 'factory|User',
|
||||
'date' => 'date|Y-m-d'
|
||||
'date' => $date
|
||||
];
|
||||
}
|
||||
|
||||
public function transactionType()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user