Started work on recurring transactions controller. [skip ci]

This commit is contained in:
James Cole
2014-08-06 17:02:02 +02:00
parent 5e809633e3
commit 23d69c0dd9
12 changed files with 146 additions and 39 deletions

View File

@@ -0,0 +1,33 @@
<?php
use LaravelBook\Ardent\Ardent;
class RecurringTransaction extends Ardent
{
public static $rules
= [
'user_id' => 'required|exists:users,id',
'name' => 'required|between:1,255',
'match' => 'required',
'amount_max' => 'required|between:0,65536',
'amount_min' => 'required|between:0,65536',
'date' => 'required|date',
'active' => 'required|between:0,1',
'automatch' => 'required|between:0,1',
'repeat_freq' => 'required|in:daily,weekly,monthly,quarterly,half-year,yearly',
'skip' => 'required|between:0,31',
];
public static $factory
= [
'user_id' => 'factory|User',
'name' => 'string',
'data' => 'string'
];
public function user()
{
return $this->belongsTo('User');
}
}

View File

@@ -73,6 +73,11 @@ class User extends Ardent implements UserInterface, RemindableInterface
return $this->hasMany('Account');
}
public function recurringtransactions()
{
return $this->hasMany('RecurringTransaction');
}
public function piggybanks()
{
return $this->hasMany('Piggybank');