mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 08:35:00 +00:00
Replace log.
This commit is contained in:
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Casts\SeparateTimezoneCaster;
|
||||
use FireflyIII\Handlers\Observer\BudgetLimitObserver;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
@@ -33,6 +34,13 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
* Class BudgetLimit
|
||||
*
|
||||
* @property TransactionCurrency $transactionCurrency
|
||||
* @property Carbon $start_date
|
||||
* @property Carbon $end_date
|
||||
*/
|
||||
#[ObservedBy([BudgetLimitObserver::class])]
|
||||
class BudgetLimit extends Model
|
||||
{
|
||||
@@ -50,10 +58,9 @@ class BudgetLimit extends Model
|
||||
if (auth()->check()) {
|
||||
$budgetLimitId = (int)$value;
|
||||
$budgetLimit = self::where('budget_limits.id', $budgetLimitId)
|
||||
->leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')
|
||||
->where('budgets.user_id', auth()->user()->id)
|
||||
->first(['budget_limits.*'])
|
||||
;
|
||||
->leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')
|
||||
->where('budgets.user_id', auth()->user()->id)
|
||||
->first(['budget_limits.*']);
|
||||
if (null !== $budgetLimit) {
|
||||
return $budgetLimit;
|
||||
}
|
||||
@@ -86,14 +93,14 @@ class BudgetLimit extends Model
|
||||
protected function amount(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn ($value) => (string)$value,
|
||||
get: static fn($value) => (string)$value,
|
||||
);
|
||||
}
|
||||
|
||||
protected function budgetId(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn ($value) => (int)$value,
|
||||
get: static fn($value) => (int)$value,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -113,7 +120,7 @@ class BudgetLimit extends Model
|
||||
protected function transactionCurrencyId(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn ($value) => (int)$value,
|
||||
get: static fn($value) => (int)$value,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Casts\SeparateTimezoneCaster;
|
||||
use FireflyIII\Handlers\Observer\RecurrenceObserver;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
@@ -38,6 +39,10 @@ use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
* @property Carbon $first_date
|
||||
* @property Carbon|null $latest_date
|
||||
*/
|
||||
#[ObservedBy([RecurrenceObserver::class])]
|
||||
class Recurrence extends Model
|
||||
{
|
||||
|
@@ -35,6 +35,9 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
* @property User $user
|
||||
*/
|
||||
#[ObservedBy([RuleObserver::class])]
|
||||
class Rule extends Model
|
||||
{
|
||||
|
@@ -35,6 +35,9 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
* @property User $user
|
||||
*/
|
||||
#[ObservedBy([RuleGroupObserver::class])]
|
||||
class RuleGroup extends Model
|
||||
{
|
||||
|
@@ -32,8 +32,16 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
|
||||
/**
|
||||
* @property User $user
|
||||
* @property UserGroup $userGroup
|
||||
* @property Collection<TransactionJournal> $transactionJournals
|
||||
*/
|
||||
#[ObservedBy([TransactionGroupObserver::class])]
|
||||
class TransactionGroup extends Model
|
||||
{
|
||||
@@ -50,13 +58,13 @@ class TransactionGroup extends Model
|
||||
*/
|
||||
public static function routeBinder(string $value): self
|
||||
{
|
||||
app('log')->debug(sprintf('Now in %s("%s")', __METHOD__, $value));
|
||||
Log::debug(sprintf('Now in %s("%s")', __METHOD__, $value));
|
||||
if (auth()->check()) {
|
||||
$groupId = (int)$value;
|
||||
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
app('log')->debug(sprintf('User authenticated as %s', $user->email));
|
||||
Log::debug(sprintf('User authenticated as %s', $user->email));
|
||||
|
||||
/** @var null|TransactionGroup $group */
|
||||
$group = $user->transactionGroups()
|
||||
@@ -64,12 +72,12 @@ class TransactionGroup extends Model
|
||||
->where('transaction_groups.id', $groupId)->first(['transaction_groups.*'])
|
||||
;
|
||||
if (null !== $group) {
|
||||
app('log')->debug(sprintf('Found group #%d.', $group->id));
|
||||
Log::debug(sprintf('Found group #%d.', $group->id));
|
||||
|
||||
return $group;
|
||||
}
|
||||
}
|
||||
app('log')->debug('Found no group.');
|
||||
Log::debug('Found no group.');
|
||||
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
@@ -47,6 +47,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @method EloquentBuilder|static before()
|
||||
* @method EloquentBuilder|static after()
|
||||
* @method static EloquentBuilder|static query()
|
||||
* @property TransactionGroup $transactionGroup
|
||||
*/
|
||||
#[ObservedBy([TransactionJournalObserver::class])]
|
||||
class TransactionJournal extends Model
|
||||
|
Reference in New Issue
Block a user