mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-23 12:27:05 +00:00
Some experimental model tests.
This commit is contained in:
@@ -6,8 +6,19 @@ class Account extends Elegant
|
||||
|
||||
public static $rules
|
||||
= [
|
||||
'name' => 'required|between:1,100',
|
||||
'user_id' => 'required|exists:users,id'
|
||||
'name' => 'required|between:1,100',
|
||||
'user_id' => 'required|exists:users,id',
|
||||
'account_type_id' => 'required|exists:account_types,id',
|
||||
'active' => 'required|between:0,1|numeric'
|
||||
|
||||
];
|
||||
|
||||
public static $factory
|
||||
= [
|
||||
'name' => 'string',
|
||||
'user_id' => 'factory|User',
|
||||
'account_type_id' => 'factory|AccountType',
|
||||
'active' => '1'
|
||||
];
|
||||
|
||||
public function accountType()
|
||||
|
@@ -1,10 +1,16 @@
|
||||
<?php
|
||||
|
||||
|
||||
class AccountType extends Eloquent {
|
||||
class AccountType extends Eloquent
|
||||
{
|
||||
|
||||
public function accounts() {
|
||||
public static $factory
|
||||
= [
|
||||
'description' => 'string'
|
||||
];
|
||||
|
||||
public function accounts()
|
||||
{
|
||||
return $this->hasMany('Account');
|
||||
}
|
||||
|
||||
}
|
@@ -9,6 +9,12 @@ class Preference extends Elegant
|
||||
'data' => 'required'
|
||||
];
|
||||
|
||||
public static $factory = [
|
||||
'user_id' => 'factory|User',
|
||||
'name' => 'string',
|
||||
'data' => 'string'
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('User');
|
||||
|
@@ -18,6 +18,14 @@ class User extends Elegant implements UserInterface, RemindableInterface
|
||||
'password' => 'required|between:60,60',
|
||||
'reset' => 'between:32,32',
|
||||
];
|
||||
|
||||
public static $factory
|
||||
= [
|
||||
'email' => 'email',
|
||||
'password' => 'string',
|
||||
'migrated' => '0'
|
||||
|
||||
];
|
||||
/**
|
||||
* The database table used by the model.
|
||||
*
|
||||
|
Reference in New Issue
Block a user