Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Re-arrange code. No changes.
James Cole4c015e2d1253
diff --git a/app/Models/Budget.php b/app/Models/Budget.phpindex d33cdad51f..98f22bab7e 100644--- a/app/Models/Budget.php+++ b/app/Models/Budget.php@@ -22,21 +22,21 @@ use Watson\Validating\ValidatingTrait;/*** FireflyIII\Models\Budget*- * @property integer $id- * @property \Carbon\Carbon $created_at- * @property \Carbon\Carbon $updated_at- * @property \Carbon\Carbon $deleted_at- * @property string $name- * @property integer $user_id- * @property boolean $active- * @property boolean $encrypted- * @property-read \Illuminate\Database\Eloquent\Collection|BudgetLimit[] $budgetlimits- * @property-read \Illuminate\Database\Eloquent\Collection|TransactionJournal[] $transactionjournals- * @property-read \FireflyIII\User $user- * @property string $dateFormatted- * @property string $budgeted- * @property float $amount- * @property \Carbon\Carbon $date+ * @property integer $id+ * @property \Carbon\Carbon $created_at+ * @property \Carbon\Carbon $updated_at+ * @property \Carbon\Carbon $deleted_at+ * @property string $name+ * @property integer $user_id+ * @property boolean $active+ * @property boolean $encrypted+ * @property-read \Illuminate\Database\Eloquent\Collection|BudgetLimit[] $budgetlimits+ * @property-read \Illuminate\Database\Eloquent\Collection|TransactionJournal[] $transactionjournals+ * @property-read \FireflyIII\User $user+ * @property string $dateFormatted+ * @property string $budgeted+ * @property float $amount+ * @property \Carbon\Carbon $date* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereId($value)* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereCreatedAt($value)* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereUpdatedAt($value)@@ -46,7 +46,7 @@ use Watson\Validating\ValidatingTrait;* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereActive($value)* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereEncrypted($value)* @mixin \Eloquent- * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions+ * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\LimitRepetition[] $limitrepetitions*/class Budget extends Modeldiff --git a/app/Models/Configuration.php b/app/Models/Configuration.phpindex 93de3d0602..9b3c7066a6 100644--- a/app/Models/Configuration.php+++ b/app/Models/Configuration.php@@ -18,12 +18,12 @@ use Illuminate\Database\Eloquent\SoftDeletes;* FireflyIII\Models\Configuration** @mixin \Eloquent- * @property integer $id+ * @property integer $id* @property \Carbon\Carbon $created_at* @property \Carbon\Carbon $updated_at* @property \Carbon\Carbon $deleted_at- * @property string $name- * @property string $data+ * @property string $name+ * @property string $data* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Configuration whereId($value)* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Configuration whereCreatedAt($value)* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Configuration whereUpdatedAt($value)@@ -35,9 +35,8 @@ class Configuration extends Model{use SoftDeletes;- protected $table = 'configuration';-protected $dates = ['created_at', 'updated_at', 'deleted_at'];+ protected $table = 'configuration';/*** @param $value@@ -58,5 +57,4 @@ class Configuration extends Model}-}diff --git a/app/Models/PiggyBankRepetition.php b/app/Models/PiggyBankRepetition.phpindex 4919142fa0..75e57de22d 100644--- a/app/Models/PiggyBankRepetition.php+++ b/app/Models/PiggyBankRepetition.php@@ -40,9 +40,9 @@ use Illuminate\Database\Eloquent\Model;class PiggyBankRepetition extends Model{+ protected $dates = ['created_at', 'updated_at', 'startdate', 'targetdate'];protected $fillable = ['piggy_bank_id', 'startdate', 'targetdate', 'currentamount'];protected $hidden = ['currentamount_encrypted'];- protected $dates = ['created_at', 'updated_at', 'startdate', 'targetdate'];/*** @return \Illuminate\Database\Eloquent\Relations\BelongsTodiff --git a/app/Models/Preference.php b/app/Models/Preference.phpindex 15ddef16e6..d8884325b1 100644--- a/app/Models/Preference.php+++ b/app/Models/Preference.php@@ -16,6 +16,7 @@ use FireflyIII\Exceptions\FireflyException;use Illuminate\Contracts\Encryption\DecryptException;use Illuminate\Database\Eloquent\Model;use Log;+/*** FireflyIII\Models\Preference*@@ -54,7 +55,7 @@ class Preference extends Modeltry {$data = Crypt::decrypt($value);} catch (DecryptException $e) {- Log::error('Could not decrypt preference.', ['id' => $this->id,'name' => $this->name,'data' => $this->data]);+ Log::error('Could not decrypt preference.', ['id' => $this->id, 'name' => $this->name, 'data' => $this->data]);throw new FireflyException('Could not decrypt preference #' . $this->id . '.');}diff --git a/app/Models/Rule.php b/app/Models/Rule.phpindex 491c7ad1d8..368a4f8d87 100644--- a/app/Models/Rule.php+++ b/app/Models/Rule.php@@ -53,27 +53,34 @@ class Rule extends Modeluse SoftDeletes;/**- * @return \Illuminate\Database\Eloquent\Relations\BelongsTo+ * @param Rule $value+ *+ * @return Rule*/- public function user()+ public static function routeBinder(Rule $value){- return $this->belongsTo('FireflyIII\User');+ if (Auth::check()) {+ if ($value->user_id == Auth::user()->id) {+ return $value;+ }+ }+ throw new NotFoundHttpException;}/**- * @return \Illuminate\Database\Eloquent\Relations\BelongsTo+ * @return \Illuminate\Database\Eloquent\Relations\HasMany*/- public function ruleGroup()+ public function ruleActions(){- return $this->belongsTo('FireflyIII\Models\RuleGroup');+ return $this->hasMany('FireflyIII\Models\RuleAction');}/**- * @return \Illuminate\Database\Eloquent\Relations\HasMany+ * @return \Illuminate\Database\Eloquent\Relations\BelongsTo*/- public function ruleActions()+ public function ruleGroup(){- return $this->hasMany('FireflyIII\Models\RuleAction');+ return $this->belongsTo('FireflyIII\Models\RuleGroup');}/**@@ -85,18 +92,11 @@ class Rule extends Model}/**- * @param Rule $value- *- * @return Rule+ * @return \Illuminate\Database\Eloquent\Relations\BelongsTo*/- public static function routeBinder(Rule $value)+ public function user(){- if (Auth::check()) {- if ($value->user_id == Auth::user()->id) {- return $value;- }- }- throw new NotFoundHttpException;+ return $this->belongsTo('FireflyIII\User');}}diff --git a/app/Models/RuleGroup.php b/app/Models/RuleGroup.phpindex c02d11ebec..d10b736600 100644--- a/app/Models/RuleGroup.php+++ b/app/Models/RuleGroup.php@@ -49,14 +49,20 @@ class RuleGroup extends Modelprotected $fillable = ['user_id', 'order', 'title', 'description', 'active'];/**- * @return \Illuminate\Database\Eloquent\Relations\BelongsTo+ * @param RuleGroup $value+ *+ * @return Rule*/- public function user()+ public static function routeBinder(RuleGroup $value){- return $this->belongsTo('FireflyIII\User');+ if (Auth::check()) {+ if ($value->user_id == Auth::user()->id) {+ return $value;+ }+ }+ throw new NotFoundHttpException;}-/*** @return \Illuminate\Database\Eloquent\Relations\HasMany*/@@ -66,17 +72,10 @@ class RuleGroup extends Model}/**- * @param RuleGroup $value- *- * @return Rule+ * @return \Illuminate\Database\Eloquent\Relations\BelongsTo*/- public static function routeBinder(RuleGroup $value)+ public function user(){- if (Auth::check()) {- if ($value->user_id == Auth::user()->id) {- return $value;- }- }- throw new NotFoundHttpException;+ return $this->belongsTo('FireflyIII\User');}}