mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 10:47:00 +00:00 
			
		
		
		
	Various code cleanup
This commit is contained in:
		| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| /* | ||||
|  * BalanceController.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -21,6 +21,9 @@ declare(strict_types=1); | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| 
 | ||||
| namespace FireflyIII\Api\V2\Controllers\Chart; | ||||
| 
 | ||||
| use Carbon\Carbon; | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| /* | ||||
|  * BudgetController.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -21,6 +21,8 @@ declare(strict_types=1); | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| namespace FireflyIII\Api\V2\Controllers\Chart; | ||||
| 
 | ||||
| use Carbon\Carbon; | ||||
|   | ||||
| @@ -1,8 +1,8 @@ | ||||
| <?php | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| /* | ||||
|  * BudgetController.php | ||||
|  * CategoryController.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
|  * | ||||
|  * This file is part of Firefly III (https://github.com/firefly-iii). | ||||
| @@ -21,6 +21,8 @@ declare(strict_types=1); | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| namespace FireflyIII\Api\V2\Controllers\Chart; | ||||
| 
 | ||||
| use Carbon\Carbon; | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| /* | ||||
|  * ShowController.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -21,6 +21,8 @@ declare(strict_types=1); | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| namespace FireflyIII\Api\V2\Controllers\Model\Bill; | ||||
| 
 | ||||
| use FireflyIII\Api\V2\Controllers\Controller; | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| /* | ||||
|  * ShowController.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -21,6 +21,8 @@ declare(strict_types=1); | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| namespace FireflyIII\Api\V2\Controllers\Model\PiggyBank; | ||||
| 
 | ||||
| use FireflyIII\Api\V2\Controllers\Controller; | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| /* | ||||
|  * StoreController.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -21,6 +21,8 @@ declare(strict_types=1); | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| namespace FireflyIII\Api\V2\Controllers\Model\Transaction; | ||||
| 
 | ||||
| use FireflyIII\Api\V2\Controllers\Controller; | ||||
|   | ||||
| @@ -1,4 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| 
 | ||||
| /* | ||||
|  * DestroyController.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -19,6 +21,8 @@ | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| namespace FireflyIII\Api\V2\Controllers\UserGroup; | ||||
| 
 | ||||
| use FireflyIII\Api\V2\Controllers\Controller; | ||||
| @@ -28,5 +32,4 @@ use FireflyIII\Api\V2\Controllers\Controller; | ||||
|  */ | ||||
| class DestroyController extends Controller | ||||
| { | ||||
| 
 | ||||
| } | ||||
|   | ||||
| @@ -1,4 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| 
 | ||||
| /* | ||||
|  * ShowController.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -19,6 +21,8 @@ | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| namespace FireflyIII\Api\V2\Controllers\UserGroup; | ||||
| 
 | ||||
| use FireflyIII\Api\V2\Controllers\Controller; | ||||
|   | ||||
| @@ -1,4 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| 
 | ||||
| /* | ||||
|  * StoreController.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -19,6 +21,8 @@ | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| namespace FireflyIII\Api\V2\Controllers\UserGroup; | ||||
| 
 | ||||
| use FireflyIII\Api\V2\Controllers\Controller; | ||||
| @@ -50,6 +54,8 @@ class StoreController extends Controller | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @param StoreRequest $request | ||||
|      * | ||||
|      * @return JsonResponse | ||||
|      */ | ||||
|     public function store(StoreRequest $request): JsonResponse | ||||
|   | ||||
| @@ -1,4 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| 
 | ||||
| /* | ||||
|  * UpdateController.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -19,13 +21,17 @@ | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| namespace FireflyIII\Api\V2\Controllers\UserGroup; | ||||
| 
 | ||||
| use FireflyIII\Api\V2\Controllers\Controller; | ||||
| 
 | ||||
| /** | ||||
|  * Class UpdateController | ||||
|  */ | ||||
| class UpdateController extends Controller | ||||
| { | ||||
| 
 | ||||
|     // basic edit van group
 | ||||
|     // add user, add rights, remove user, remove rights.
 | ||||
| } | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| /* | ||||
|  * BalanceChartRequest.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -21,6 +21,8 @@ declare(strict_types=1); | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| namespace FireflyIII\Api\V2\Request\Chart; | ||||
| 
 | ||||
| use FireflyIII\Support\Request\ChecksLogin; | ||||
| @@ -28,6 +30,9 @@ use FireflyIII\Support\Request\ConvertsDataTypes; | ||||
| use Illuminate\Foundation\Http\FormRequest; | ||||
| use Illuminate\Validation\Validator; | ||||
| 
 | ||||
| /** | ||||
|  * Class BalanceChartRequest | ||||
|  */ | ||||
| class BalanceChartRequest extends FormRequest | ||||
| { | ||||
|     use ConvertsDataTypes; | ||||
|   | ||||
| @@ -1,4 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| 
 | ||||
| /* | ||||
|  * StoreRequest.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -19,12 +21,17 @@ | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| namespace FireflyIII\Api\V2\Request\UserGroup; | ||||
| 
 | ||||
| use FireflyIII\Support\Request\ChecksLogin; | ||||
| use FireflyIII\Support\Request\ConvertsDataTypes; | ||||
| use Illuminate\Foundation\Http\FormRequest; | ||||
| 
 | ||||
| /** | ||||
|  * Class StoreRequest | ||||
|  */ | ||||
| class StoreRequest extends FormRequest | ||||
| { | ||||
|     use ChecksLogin; | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| /* | ||||
|  * OutputVersion.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -21,25 +21,29 @@ declare(strict_types=1); | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| namespace FireflyIII\Console\Commands\System; | ||||
| 
 | ||||
| use Illuminate\Console\Command; | ||||
| 
 | ||||
| /** | ||||
|  * Class OutputVersion | ||||
|  */ | ||||
| class OutputVersion extends Command | ||||
| { | ||||
|     /** | ||||
|      * The name and signature of the console command. | ||||
|      * | ||||
|      * @var string | ||||
|      */ | ||||
|     protected $signature = 'firefly-iii:output-version'; | ||||
| 
 | ||||
|     /** | ||||
|      * The console command description. | ||||
|      * | ||||
|      * @var string | ||||
|      */ | ||||
|     protected $description = 'Outputs the Firefly III version'; | ||||
|     /** | ||||
|      * The name and signature of the console command. | ||||
|      * | ||||
|      * @var string | ||||
|      */ | ||||
|     protected $signature = 'firefly-iii:output-version'; | ||||
| 
 | ||||
|     /** | ||||
|      * Execute the console command. | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| /* | ||||
|  * RuleActionFailedOnArray.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -21,6 +21,8 @@ declare(strict_types=1); | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| namespace FireflyIII\Events\Model\Rule; | ||||
| 
 | ||||
| use FireflyIII\Models\RuleAction; | ||||
|   | ||||
| @@ -1,8 +1,8 @@ | ||||
| <?php | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| /* | ||||
|  * RuleActionFailedOnArray.php | ||||
|  * RuleActionFailedOnObject.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
|  * | ||||
|  * This file is part of Firefly III (https://github.com/firefly-iii). | ||||
| @@ -21,6 +21,8 @@ declare(strict_types=1); | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| namespace FireflyIII\Events\Model\Rule; | ||||
| 
 | ||||
| use FireflyIII\Models\RuleAction; | ||||
|   | ||||
| @@ -1,4 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| 
 | ||||
| /* | ||||
|  * UserGroupFactory.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -19,6 +21,8 @@ | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| namespace FireflyIII\Factory; | ||||
| 
 | ||||
| use FireflyIII\Enums\UserRoleEnum; | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| /* | ||||
|  * RuleHandler.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -21,6 +21,8 @@ declare(strict_types=1); | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| namespace FireflyIII\Handlers\Events\Model; | ||||
| 
 | ||||
| use FireflyIII\Events\Model\Rule\RuleActionFailedOnArray; | ||||
|   | ||||
| @@ -76,7 +76,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | ||||
|  * @method static Builder|Rule withoutTrashed() | ||||
|  * @property int|null                     $user_group_id | ||||
|  * @method static \Illuminate\Database\Eloquent\Builder|Rule whereUserGroupId($value) | ||||
|  * @property-read \FireflyIII\Models\UserGroup|null $userGroup | ||||
|  * @property-read UserGroup|null          $userGroup | ||||
|  * @mixin Eloquent | ||||
|  */ | ||||
| class Rule extends Model | ||||
| @@ -125,14 +125,6 @@ class Rule extends Model | ||||
|         throw new NotFoundHttpException(); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsTo | ||||
|      */ | ||||
|     public function user(): BelongsTo | ||||
|     { | ||||
|         return $this->belongsTo(User::class); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return HasMany | ||||
|      */ | ||||
| @@ -167,6 +159,14 @@ class Rule extends Model | ||||
|         $this->attributes['description'] = e($value); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsTo | ||||
|      */ | ||||
|     public function user(): BelongsTo | ||||
|     { | ||||
|         return $this->belongsTo(User::class); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsTo | ||||
|      */ | ||||
|   | ||||
| @@ -61,7 +61,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | ||||
|  * @method static Builder|TransactionGroup withoutTrashed() | ||||
|  * @property int|null                             $user_group_id | ||||
|  * @method static \Illuminate\Database\Eloquent\Builder|TransactionGroup whereUserGroupId($value) | ||||
|  * @property-read \FireflyIII\Models\UserGroup|null $userGroup | ||||
|  * @property-read UserGroup|null                  $userGroup | ||||
|  * @mixin Eloquent | ||||
|  */ | ||||
| class TransactionGroup extends Model | ||||
| @@ -116,14 +116,6 @@ class TransactionGroup extends Model | ||||
|         throw new NotFoundHttpException(); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsTo | ||||
|      */ | ||||
|     public function user(): BelongsTo | ||||
|     { | ||||
|         return $this->belongsTo(User::class); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return HasMany | ||||
|      */ | ||||
| @@ -132,6 +124,14 @@ class TransactionGroup extends Model | ||||
|         return $this->hasMany(TransactionJournal::class); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsTo | ||||
|      */ | ||||
|     public function user(): BelongsTo | ||||
|     { | ||||
|         return $this->belongsTo(User::class); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * @return BelongsTo | ||||
|      */ | ||||
|   | ||||
| @@ -33,7 +33,6 @@ use Illuminate\Notifications\Notification; | ||||
| use Illuminate\Support\Facades\Log; | ||||
| use Illuminate\Notifications\Messages\SlackMessage; | ||||
| 
 | ||||
| 
 | ||||
| /** | ||||
|  * Class UserLogin | ||||
|  */ | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| /* | ||||
|  * BillRepository.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -21,6 +21,8 @@ declare(strict_types=1); | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| namespace FireflyIII\Repositories\Administration\Bill; | ||||
| 
 | ||||
| use Carbon\Carbon; | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| /* | ||||
|  * BillRepositoryInterface.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -21,6 +21,8 @@ declare(strict_types=1); | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| namespace FireflyIII\Repositories\Administration\Bill; | ||||
| 
 | ||||
| use Carbon\Carbon; | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| /* | ||||
|  * AvailableBudgetRepository.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -21,6 +21,9 @@ declare(strict_types=1); | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| 
 | ||||
| namespace FireflyIII\Repositories\Administration\Budget; | ||||
| 
 | ||||
| use Carbon\Carbon; | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| /* | ||||
|  * AvailableBudgetRepositoryInterface.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -21,6 +21,9 @@ declare(strict_types=1); | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| 
 | ||||
| namespace FireflyIII\Repositories\Administration\Budget; | ||||
| 
 | ||||
| use Carbon\Carbon; | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| /* | ||||
|  * BudgetRepository.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -21,6 +21,9 @@ declare(strict_types=1); | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| 
 | ||||
| namespace FireflyIII\Repositories\Administration\Budget; | ||||
| 
 | ||||
| use FireflyIII\Support\Repositories\Administration\AdministrationTrait; | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| /* | ||||
|  * BudgetRepositoryInterface.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -21,6 +21,9 @@ declare(strict_types=1); | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| 
 | ||||
| namespace FireflyIII\Repositories\Administration\Budget; | ||||
| 
 | ||||
| use Illuminate\Support\Collection; | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| /* | ||||
|  * OperationsRepository.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -21,6 +21,9 @@ declare(strict_types=1); | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| 
 | ||||
| namespace FireflyIII\Repositories\Administration\Budget; | ||||
| 
 | ||||
| use Carbon\Carbon; | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| /* | ||||
|  * OperationsRepositoryInterface.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -21,6 +21,9 @@ declare(strict_types=1); | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| 
 | ||||
| namespace FireflyIII\Repositories\Administration\Budget; | ||||
| 
 | ||||
| use Carbon\Carbon; | ||||
| @@ -36,8 +39,8 @@ interface OperationsRepositoryInterface | ||||
|      * which have the specified budget set to them. It's grouped per currency, with as few details in the array | ||||
|      * as possible. Amounts are always negative. | ||||
|      * | ||||
|      * @param Carbon $start | ||||
|      * @param Carbon $end | ||||
|      * @param Carbon          $start | ||||
|      * @param Carbon          $end | ||||
|      * @param Collection|null $accounts | ||||
|      * @param Collection|null $budgets | ||||
|      * | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| /* | ||||
|  * PiggyBankRepository.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -21,6 +21,9 @@ declare(strict_types=1); | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| 
 | ||||
| namespace FireflyIII\Repositories\Administration\PiggyBank; | ||||
| 
 | ||||
| use FireflyIII\Support\Repositories\Administration\AdministrationTrait; | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| /* | ||||
|  * PiggyBankRepositoryInterface.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -21,6 +21,8 @@ declare(strict_types=1); | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| namespace FireflyIII\Repositories\Administration\PiggyBank; | ||||
| 
 | ||||
| use Illuminate\Support\Collection; | ||||
|   | ||||
| @@ -1,4 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| 
 | ||||
| /* | ||||
|  * UserGroupRepository.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -19,6 +21,8 @@ | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| namespace FireflyIII\Repositories\UserGroup; | ||||
| 
 | ||||
| use FireflyIII\Factory\UserGroupFactory; | ||||
|   | ||||
| @@ -1,4 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| 
 | ||||
| /* | ||||
|  * UserGroupRepositoryInterface.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -19,6 +21,8 @@ | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| namespace FireflyIII\Repositories\UserGroup; | ||||
| 
 | ||||
| use FireflyIII\User; | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| /* | ||||
|  * CleansChartData.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -21,6 +21,8 @@ declare(strict_types=1); | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| namespace FireflyIII\Support\Http\Api; | ||||
| 
 | ||||
| use FireflyIII\Exceptions\FireflyException; | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| /* | ||||
|  * ExchangeRateConverter.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -21,6 +21,8 @@ declare(strict_types=1); | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| namespace FireflyIII\Support\Http\Api; | ||||
| 
 | ||||
| use Carbon\Carbon; | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| /* | ||||
|  * UrlValidator.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -21,6 +21,8 @@ declare(strict_types=1); | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| namespace FireflyIII\Support\Notifications; | ||||
| 
 | ||||
| /** | ||||
|   | ||||
| @@ -175,7 +175,10 @@ class BillTransformer extends AbstractTransformer | ||||
|                     'native_amount'                   => $this->converter->convert($currencies[$currencyId], $this->default, $journal->date, $transaction['amount']), | ||||
|                     'foreign_native_amount'           => '' === (string)$transaction['foreign_amount'] ? null : $this->converter->convert( | ||||
|                         $currencies[$foreignCurrencyId], | ||||
|                         $this->default, $journal->date, $transaction['foreign_amount']), | ||||
|                         $this->default, | ||||
|                         $journal->date, | ||||
|                         $transaction['foreign_amount'] | ||||
|                     ), | ||||
|                 ]; | ||||
|             } | ||||
|         } | ||||
|   | ||||
| @@ -1,4 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| 
 | ||||
| /* | ||||
|  * UserGroupTransformer.php | ||||
|  * Copyright (c) 2023 james@firefly-iii.org | ||||
| @@ -19,6 +21,8 @@ | ||||
|  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||
|  */ | ||||
| 
 | ||||
| declare(strict_types=1); | ||||
| 
 | ||||
| namespace FireflyIII\Transformers\V2; | ||||
| 
 | ||||
| use FireflyIII\Enums\UserRoleEnum; | ||||
|   | ||||
							
								
								
									
										49
									
								
								app/User.php
									
									
									
									
									
								
							
							
						
						
									
										49
									
								
								app/User.php
									
									
									
									
									
								
							| @@ -406,30 +406,45 @@ class User extends Authenticatable | ||||
|                                  ->whereIn('user_role_id', $dbRolesIds) | ||||
|                                  ->where('user_group_id', $userGroup->id)->get(); | ||||
|         if (0 === $groupMemberships->count()) { | ||||
|             app('log')->error(sprintf('User #%d "%s" does not have roles %s in user group #%d "%s"', | ||||
|                                       $this->id, $this->email, | ||||
|                                       join(', ', $roles), $userGroup->id, $userGroup->title)); | ||||
|             app('log')->error(sprintf( | ||||
|                 'User #%d "%s" does not have roles %s in user group #%d "%s"', | ||||
|                 $this->id, | ||||
|                 $this->email, | ||||
|                 join(', ', $roles), | ||||
|                 $userGroup->id, | ||||
|                 $userGroup->title | ||||
|             )); | ||||
|             return false; | ||||
|         } | ||||
|         foreach ($groupMemberships as $membership) { | ||||
|             app('log')->debug(sprintf('User #%d "%s" has role "%s" in user group #%d "%s"', | ||||
|                                       $this->id, $this->email, | ||||
|                                       $membership->userRole->title, $userGroup->id, $userGroup->title)); | ||||
|             if (in_array($membership->userRole->title, $dbRolesTitles)) { | ||||
|             app('log')->debug(sprintf( | ||||
|                 'User #%d "%s" has role "%s" in user group #%d "%s"', | ||||
|                 $this->id, | ||||
|                 $this->email, | ||||
|                 $membership->userRole->title, | ||||
|                 $userGroup->id, | ||||
|                 $userGroup->title | ||||
|             )); | ||||
|             if (in_array($membership->userRole->title, $dbRolesTitles, true)) { | ||||
|                 app('log')->debug(sprintf('Return true, found role "%s"', $membership->userRole->title)); | ||||
|                 return true; | ||||
|             } | ||||
|         } | ||||
|         app('log')->error(sprintf('User #%d "%s" does not have roles %s in user group #%d "%s"', | ||||
|                                   $this->id, $this->email, | ||||
|                                   join(', ', $roles), $userGroup->id, $userGroup->title)); | ||||
|         app('log')->error(sprintf( | ||||
|             'User #%d "%s" does not have roles %s in user group #%d "%s"', | ||||
|             $this->id, | ||||
|             $this->email, | ||||
|             join(', ', $roles), | ||||
|             $userGroup->id, | ||||
|             $userGroup->title | ||||
|         )); | ||||
|         return false; | ||||
| //        // not necessary, should always return true:
 | ||||
| //        $result = $groupMembership->userRole->title === $role->value;
 | ||||
| //        app('log')->error(sprintf('Does user #%d "%s" have role "%s" in user group #%d "%s"? %s',
 | ||||
| //                                  $this->id, $this->email,
 | ||||
| //                                  $role->value, $userGroup->id, $userGroup->title, var_export($result, true)));
 | ||||
| //        return $result;
 | ||||
|         //        // not necessary, should always return true:
 | ||||
|         //        $result = $groupMembership->userRole->title === $role->value;
 | ||||
|         //        app('log')->error(sprintf('Does user #%d "%s" have role "%s" in user group #%d "%s"? %s',
 | ||||
|         //                                  $this->id, $this->email,
 | ||||
|         //                                  $role->value, $userGroup->id, $userGroup->title, var_export($result, true)));
 | ||||
|         //        return $result;
 | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
| @@ -666,7 +681,7 @@ class User extends Authenticatable | ||||
|      */ | ||||
|     public function userGroup(): BelongsTo | ||||
|     { | ||||
|         return $this->belongsTo(UserGroup::class,); | ||||
|         return $this->belongsTo(UserGroup::class, ); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|   | ||||
		Reference in New Issue
	
	Block a user