mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-14 08:11:20 +00:00
Extend rule set for import.
This commit is contained in:
@@ -79,8 +79,9 @@ class Account extends Model
|
||||
= [
|
||||
'user_id' => 'required|exists:users,id',
|
||||
'account_type_id' => 'required|exists:account_types,id',
|
||||
'name' => 'required',
|
||||
'name' => 'required|between:1,200',
|
||||
'active' => 'required|boolean',
|
||||
'iban' => 'between:1,50|iban',
|
||||
];
|
||||
/** @var bool */
|
||||
private $joinedAccountTypes;
|
||||
|
@@ -17,6 +17,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Watson\Validating\ValidatingTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\Bill
|
||||
@@ -58,17 +59,20 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereNameEncrypted($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereMatchEncrypted($value)
|
||||
* @mixin \Eloquent
|
||||
* @property string $deleted_at
|
||||
* @property string $deleted_at
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereDeletedAt($value)
|
||||
*/
|
||||
class Bill extends Model
|
||||
{
|
||||
|
||||
use ValidatingTrait;
|
||||
|
||||
protected $dates = ['created_at', 'updated_at', 'date'];
|
||||
protected $fillable
|
||||
= ['name', 'match', 'amount_min', 'match_encrypted', 'name_encrypted', 'user_id', 'amount_max', 'date', 'repeat_freq', 'skip',
|
||||
'automatch', 'active',];
|
||||
protected $hidden = ['amount_min_encrypted', 'amount_max_encrypted', 'name_encrypted', 'match_encrypted'];
|
||||
protected $rules = ['name' => 'required|between:1,200',];
|
||||
|
||||
/**
|
||||
* @param Bill $value
|
||||
|
@@ -17,6 +17,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Watson\Validating\ValidatingTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\Budget
|
||||
@@ -51,11 +52,12 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
class Budget extends Model
|
||||
{
|
||||
|
||||
use SoftDeletes;
|
||||
use SoftDeletes, ValidatingTrait;
|
||||
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at', 'startdate', 'enddate'];
|
||||
protected $fillable = ['user_id', 'name', 'active'];
|
||||
protected $hidden = ['encrypted'];
|
||||
protected $rules = ['name' => 'required|between:1,200',];
|
||||
|
||||
/**
|
||||
* @param array $fields
|
||||
|
@@ -17,6 +17,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Watson\Validating\ValidatingTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\Category
|
||||
@@ -46,11 +47,12 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
*/
|
||||
class Category extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
use SoftDeletes, ValidatingTrait;
|
||||
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||
protected $fillable = ['user_id', 'name'];
|
||||
protected $hidden = ['encrypted'];
|
||||
protected $rules = ['name' => 'required|between:1,200',];
|
||||
|
||||
/**
|
||||
* @param array $fields
|
||||
|
@@ -15,6 +15,7 @@ use Auth;
|
||||
use Crypt;
|
||||
use FireflyIII\Support\Models\TagSupport;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Watson\Validating\ValidatingTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\Tag
|
||||
@@ -52,6 +53,9 @@ class Tag extends TagSupport
|
||||
{
|
||||
protected $dates = ['created_at', 'updated_at', 'date'];
|
||||
protected $fillable = ['user_id', 'tag', 'date', 'description', 'longitude', 'latitude', 'zoomLevel', 'tagMode'];
|
||||
protected $rules = ['tag' => 'required|between:1,200',];
|
||||
|
||||
use ValidatingTrait;
|
||||
|
||||
/**
|
||||
* @param array $fields
|
||||
|
@@ -15,6 +15,7 @@ use Auth;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Watson\Validating\ValidatingTrait;
|
||||
|
||||
/**
|
||||
* FireflyIII\Models\TransactionCurrency
|
||||
@@ -38,19 +39,12 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
*/
|
||||
class TransactionCurrency extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
use SoftDeletes, ValidatingTrait;
|
||||
|
||||
|
||||
protected $fillable = ['name', 'code', 'symbol'];
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function transactionJournals()
|
||||
{
|
||||
return $this->hasMany('FireflyIII\Models\TransactionJournal');
|
||||
}
|
||||
protected $fillable = ['name', 'code', 'symbol'];
|
||||
protected $rules = ['name' => 'required|between:1,200', 'code' => 'required|between:3,3', 'symbol' => 'required|between:1,12'];
|
||||
|
||||
/**
|
||||
* @param TransactionCurrency $currency
|
||||
@@ -64,4 +58,12 @@ class TransactionCurrency extends Model
|
||||
}
|
||||
throw new NotFoundHttpException;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function transactionJournals()
|
||||
{
|
||||
return $this->hasMany('FireflyIII\Models\TransactionJournal');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user