Merge branch 'develop' into feature/credit_calc

# Conflicts:
#	app/Factory/TransactionJournalMetaFactory.php
#	app/Repositories/Account/AccountRepository.php
#	app/Transformers/AccountTransformer.php
#	config/firefly.php
#	frontend/src/components/accounts/Create.vue
This commit is contained in:
James Cole
2021-04-27 06:54:38 +02:00
259 changed files with 3163 additions and 2520 deletions

View File

@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
@@ -87,6 +88,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|Account withTrashed()
* @method static Builder|Account withoutTrashed()
* @mixin Eloquent
* @property Carbon $lastActivityDate
*/
class Account extends Model
{

View File

@@ -74,6 +74,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|Budget withTrashed()
* @method static Builder|Budget withoutTrashed()
* @mixin Eloquent
* @property string $email
*/
class Budget extends Model
{

View File

@@ -44,6 +44,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property \Illuminate\Support\Carbon|null $deleted_at
* @property int $user_id
* @property string $name
* @property Carbon $lastActivity
* @property bool $encrypted
* @property-read Collection|\FireflyIII\Models\Attachment[] $attachments
* @property-read int|null $attachments_count

View File

@@ -40,6 +40,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property string $name
* @property string $outward
* @property string $inward
* @property int $journalCount
* @property bool $editable
* @property-read Collection|\FireflyIII\Models\TransactionJournalLink[] $transactionJournalLinks
* @property-read int|null $transaction_journal_links_count

View File

@@ -22,7 +22,6 @@ declare(strict_types=1);
namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Builder;
@@ -33,13 +32,13 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* FireflyIII\Models\Preference
*
* @property int $id
* @property int $id
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property int $user_id
* @property string $name
* @property int|string|array|null $data
* @property-read User $user
* @property int $user_id
* @property string $name
* @property int|string|array|null $data
* @property-read User $user
* @method static Builder|Preference newModelQuery()
* @method static Builder|Preference newQuery()
* @method static Builder|Preference query()
@@ -73,19 +72,29 @@ class Preference extends Model
*
* @param string $value
*
* @throws NotFoundHttpException
* @return Preference
* @throws NotFoundHttpException
*/
public static function routeBinder(string $value): Preference
{
if (auth()->check()) {
/** @var User $user */
$user = auth()->user();
/** @var Preference $preference */
/** @var Preference|null $preference */
$preference = $user->preferences()->where('name', $value)->first();
if (null !== $preference) {
return $preference;
}
$default = config('firefly.default_preferences');
if (array_key_exists($value, $default)) {
$preference = new Preference;
$preference->name = $value;
$preference->data = $default[$value];
$preference->user_id = $user->id;
$preference->save();
return $preference;
}
}
throw new NotFoundHttpException;
}

View File

@@ -83,6 +83,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Query\Builder|Transaction withTrashed()
* @method static \Illuminate\Database\Query\Builder|Transaction withoutTrashed()
* @mixin Eloquent
* @property int $the_count
*/
class Transaction extends Model
{

View File

@@ -114,6 +114,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @mixin Eloquent
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Location[] $locations
* @property-read int|null $locations_count
* @property int $the_count
*/
class TransactionJournal extends Model
{