From be5ff35b13e74c9f9124bedd62d494f114a37eeb Mon Sep 17 00:00:00 2001 From: James Cole Date: Mon, 18 Jan 2016 13:15:11 +0100 Subject: [PATCH] Reversed the removal of the validating trait since @roberthorlings discovered it's actually still being used. --- app/Models/TransactionJournal.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php index 4299f900b1..c69f4c02b7 100644 --- a/app/Models/TransactionJournal.php +++ b/app/Models/TransactionJournal.php @@ -12,6 +12,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Query\Builder; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Watson\Validating\ValidatingTrait; /** * FireflyIII\Models\TransactionJournal @@ -54,13 +55,24 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; */ class TransactionJournal extends Model { - use SoftDeletes; + use SoftDeletes, ValidatingTrait; protected $fillable = ['user_id', 'transaction_type_id', 'bill_id', 'transaction_currency_id', 'description', 'completed', 'date', 'encrypted', 'tag_count']; protected $hidden = ['encrypted']; protected $dates = ['created_at', 'updated_at', 'date', 'deleted_at']; + protected $rules + = [ + 'user_id' => 'required|exists:users,id', + 'transaction_type_id' => 'required|exists:transaction_types,id', + 'bill_id' => 'exists:bills,id', + 'transaction_currency_id' => 'required|exists:transaction_currencies,id', + 'description' => 'required|between:1,1024', + 'completed' => 'required|boolean', + 'date' => 'required|date', + 'encrypted' => 'required|boolean', + ]; /** * @codeCoverageIgnore