mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 16:57:09 +00:00
Would be nice to remove the references as well...
This commit is contained in:
@@ -58,9 +58,9 @@ class Attachment extends Model
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder(string $value): Attachment
|
public static function routeBinder(string $value): Attachment
|
||||||
{
|
{
|
||||||
if ($guard->check()) {
|
if (auth()->check()) {
|
||||||
$attachmentId = intval($value);
|
$attachmentId = intval($value);
|
||||||
$attachment = $guard->user()->attachments()->find($attachmentId);
|
$attachment = auth()->user()->attachments()->find($attachmentId);
|
||||||
if (!is_null($attachment)) {
|
if (!is_null($attachment)) {
|
||||||
return $attachment;
|
return $attachment;
|
||||||
}
|
}
|
||||||
|
@@ -90,9 +90,9 @@ class Budget extends Model
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder(string $value): Budget
|
public static function routeBinder(string $value): Budget
|
||||||
{
|
{
|
||||||
if ($guard->check()) {
|
if (auth()->check()) {
|
||||||
$budgetId = intval($value);
|
$budgetId = intval($value);
|
||||||
$budget = $guard->user()->budgets()->find($budgetId);
|
$budget = auth()->user()->budgets()->find($budgetId);
|
||||||
if (!is_null($budget)) {
|
if (!is_null($budget)) {
|
||||||
return $budget;
|
return $budget;
|
||||||
}
|
}
|
||||||
|
@@ -51,11 +51,11 @@ class BudgetLimit extends Model
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder(string $value): BudgetLimit
|
public static function routeBinder(string $value): BudgetLimit
|
||||||
{
|
{
|
||||||
if ($guard->check()) {
|
if (auth()->check()) {
|
||||||
$budgetLimitId = intval($value);
|
$budgetLimitId = intval($value);
|
||||||
$budgetLimit = self::where('budget_limits.id', $budgetLimitId)
|
$budgetLimit = self::where('budget_limits.id', $budgetLimitId)
|
||||||
->leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')
|
->leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')
|
||||||
->where('budgets.user_id', $guard->user()->id)
|
->where('budgets.user_id', auth()->user()->id)
|
||||||
->first(['budget_limits.*']);
|
->first(['budget_limits.*']);
|
||||||
if (!is_null($budgetLimit)) {
|
if (!is_null($budgetLimit)) {
|
||||||
return $budgetLimit;
|
return $budgetLimit;
|
||||||
|
@@ -89,9 +89,9 @@ class Category extends Model
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder(string $value): Category
|
public static function routeBinder(string $value): Category
|
||||||
{
|
{
|
||||||
if ($guard->check()) {
|
if (auth()->check()) {
|
||||||
$categoryId = intval($value);
|
$categoryId = intval($value);
|
||||||
$category = $guard->user()->categories()->find($categoryId);
|
$category = auth()->user()->categories()->find($categoryId);
|
||||||
if (!is_null($category)) {
|
if (!is_null($category)) {
|
||||||
return $category;
|
return $category;
|
||||||
}
|
}
|
||||||
|
@@ -50,9 +50,9 @@ class ExportJob extends Model
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder(string $value): ExportJob
|
public static function routeBinder(string $value): ExportJob
|
||||||
{
|
{
|
||||||
if ($guard->check()) {
|
if (auth()->check()) {
|
||||||
$key = trim($value);
|
$key = trim($value);
|
||||||
$exportJob = $guard->user()->exportJobs()->where('key', $key)->first();
|
$exportJob = auth()->user()->exportJobs()->where('key', $key)->first();
|
||||||
if (null !== $exportJob) {
|
if (null !== $exportJob) {
|
||||||
return $exportJob;
|
return $exportJob;
|
||||||
}
|
}
|
||||||
|
@@ -67,9 +67,9 @@ class ImportJob extends Model
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder(string $value): ImportJob
|
public static function routeBinder(string $value): ImportJob
|
||||||
{
|
{
|
||||||
if ($guard->check()) {
|
if (auth()->check()) {
|
||||||
$key = trim($value);
|
$key = trim($value);
|
||||||
$importJob = $guard->user()->importJobs()->where('key', $key)->first();
|
$importJob = auth()->user()->importJobs()->where('key', $key)->first();
|
||||||
if (null !== $importJob) {
|
if (null !== $importJob) {
|
||||||
// must have valid status:
|
// must have valid status:
|
||||||
if (!in_array($importJob->status, $importJob->validStatus)) {
|
if (!in_array($importJob->status, $importJob->validStatus)) {
|
||||||
|
@@ -56,7 +56,7 @@ class LinkType extends Model
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder(string $value): LinkType
|
public static function routeBinder(string $value): LinkType
|
||||||
{
|
{
|
||||||
if ($guard->check()) {
|
if (auth()->check()) {
|
||||||
$linkTypeId = intval($value);
|
$linkTypeId = intval($value);
|
||||||
$linkType = self::find($linkTypeId);
|
$linkType = self::find($linkTypeId);
|
||||||
if (null !== $linkType) {
|
if (null !== $linkType) {
|
||||||
|
@@ -67,11 +67,11 @@ class PiggyBank extends Model
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder(string $value): PiggyBank
|
public static function routeBinder(string $value): PiggyBank
|
||||||
{
|
{
|
||||||
if ($guard->check()) {
|
if (auth()->check()) {
|
||||||
$piggyBankId = intval($value);
|
$piggyBankId = intval($value);
|
||||||
$piggyBank = self::where('piggy_banks.id', $piggyBankId)
|
$piggyBank = self::where('piggy_banks.id', $piggyBankId)
|
||||||
->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')
|
->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')
|
||||||
->where('accounts.user_id', $guard->user()->id)->first(['piggy_banks.*']);
|
->where('accounts.user_id', auth()->user()->id)->first(['piggy_banks.*']);
|
||||||
if (!is_null($piggyBank)) {
|
if (!is_null($piggyBank)) {
|
||||||
return $piggyBank;
|
return $piggyBank;
|
||||||
}
|
}
|
||||||
|
@@ -55,9 +55,9 @@ class Rule extends Model
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder(string $value): Rule
|
public static function routeBinder(string $value): Rule
|
||||||
{
|
{
|
||||||
if ($guard->check()) {
|
if (auth()->check()) {
|
||||||
$ruleId = intval($value);
|
$ruleId = intval($value);
|
||||||
$rule = $guard->user()->rules()->find($ruleId);
|
$rule = auth()->user()->rules()->find($ruleId);
|
||||||
if (!is_null($rule)) {
|
if (!is_null($rule)) {
|
||||||
return $rule;
|
return $rule;
|
||||||
}
|
}
|
||||||
|
@@ -58,9 +58,9 @@ class RuleGroup extends Model
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder(string $value): RuleGroup
|
public static function routeBinder(string $value): RuleGroup
|
||||||
{
|
{
|
||||||
if ($guard->check()) {
|
if (auth()->check()) {
|
||||||
$ruleGroupId = intval($value);
|
$ruleGroupId = intval($value);
|
||||||
$ruleGroup = $guard->user()->ruleGroups()->find($ruleGroupId);
|
$ruleGroup = auth()->user()->ruleGroups()->find($ruleGroupId);
|
||||||
if (!is_null($ruleGroup)) {
|
if (!is_null($ruleGroup)) {
|
||||||
return $ruleGroup;
|
return $ruleGroup;
|
||||||
}
|
}
|
||||||
|
@@ -93,9 +93,9 @@ class Tag extends Model
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder(string $value): Tag
|
public static function routeBinder(string $value): Tag
|
||||||
{
|
{
|
||||||
if ($guard->check()) {
|
if (auth()->check()) {
|
||||||
$tagId = intval($value);
|
$tagId = intval($value);
|
||||||
$tag = $guard->user()->tags()->find($tagId);
|
$tag = auth()->user()->tags()->find($tagId);
|
||||||
if (!is_null($tag)) {
|
if (!is_null($tag)) {
|
||||||
return $tag;
|
return $tag;
|
||||||
}
|
}
|
||||||
|
@@ -60,7 +60,7 @@ class TransactionCurrency extends Model
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder(string $value): TransactionCurrency
|
public static function routeBinder(string $value): TransactionCurrency
|
||||||
{
|
{
|
||||||
if ($guard->check()) {
|
if (auth()->check()) {
|
||||||
$currencyId = intval($value);
|
$currencyId = intval($value);
|
||||||
$currency = self::find($currencyId);
|
$currency = self::find($currencyId);
|
||||||
if (!is_null($currency)) {
|
if (!is_null($currency)) {
|
||||||
|
@@ -88,9 +88,9 @@ class TransactionJournal extends Model
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder(string $value): TransactionJournal
|
public static function routeBinder(string $value): TransactionJournal
|
||||||
{
|
{
|
||||||
if ($guard->check()) {
|
if (auth()->check()) {
|
||||||
$journalId = intval($value);
|
$journalId = intval($value);
|
||||||
$journal = $guard->user()->transactionJournals()->where('transaction_journals.id', $journalId)
|
$journal = auth()->user()->transactionJournals()->where('transaction_journals.id', $journalId)
|
||||||
->first(['transaction_journals.*']);
|
->first(['transaction_journals.*']);
|
||||||
if (!is_null($journal)) {
|
if (!is_null($journal)) {
|
||||||
return $journal;
|
return $journal;
|
||||||
|
@@ -46,13 +46,13 @@ class TransactionJournalLink extends Model
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder(string $value): TransactionJournalLink
|
public static function routeBinder(string $value): TransactionJournalLink
|
||||||
{
|
{
|
||||||
if ($guard->check()) {
|
if (auth()->check()) {
|
||||||
$linkId = intval($value);
|
$linkId = intval($value);
|
||||||
$link = self::where('journal_links.id', $linkId)
|
$link = self::where('journal_links.id', $linkId)
|
||||||
->leftJoin('transaction_journals as t_a', 't_a.id', '=', 'source_id')
|
->leftJoin('transaction_journals as t_a', 't_a.id', '=', 'source_id')
|
||||||
->leftJoin('transaction_journals as t_b', 't_b.id', '=', 'destination_id')
|
->leftJoin('transaction_journals as t_b', 't_b.id', '=', 'destination_id')
|
||||||
->where('t_a.user_id', $guard->user()->id)
|
->where('t_a.user_id', auth()->user()->id)
|
||||||
->where('t_b.user_id', $guard->user()->id)
|
->where('t_b.user_id', auth()->user()->id)
|
||||||
->first(['journal_links.*']);
|
->first(['journal_links.*']);
|
||||||
if (!is_null($link)) {
|
if (!is_null($link)) {
|
||||||
return $link;
|
return $link;
|
||||||
|
@@ -74,7 +74,7 @@ class TransactionType extends Model
|
|||||||
*/
|
*/
|
||||||
public static function routeBinder(string $type): TransactionType
|
public static function routeBinder(string $type): TransactionType
|
||||||
{
|
{
|
||||||
if (!$guard->check()) {
|
if (!auth()->check()) {
|
||||||
throw new NotFoundHttpException();
|
throw new NotFoundHttpException();
|
||||||
}
|
}
|
||||||
$transactionType = self::where('type', ucfirst($type))->first();
|
$transactionType = self::where('type', ucfirst($type))->first();
|
||||||
|
Reference in New Issue
Block a user