firefly-iii/app/Rules/IsDuplicateTransaction.php

52 lines
1.3 KiB
PHP
Raw Normal View History

<?php
2020-12-21 22:35:06 -06:00
declare(strict_types=1);
2020-11-08 07:13:21 -06:00
/*
* IsDuplicateTransaction.php
* Copyright (c) 2020 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
2017-10-21 01:40:00 -05:00
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
2017-10-21 01:40:00 -05:00
*
* This program is distributed in the hope that it will be useful,
2017-10-21 01:40:00 -05:00
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
2017-10-21 01:40:00 -05:00
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
2020-11-08 07:13:21 -06:00
namespace FireflyIII\Rules;
2020-11-08 07:13:21 -06:00
use Illuminate\Contracts\Validation\Rule;
2017-12-17 07:30:53 -06:00
/**
2020-11-08 07:13:21 -06:00
* Class IsDuplicateTransaction
2017-12-17 07:30:53 -06:00
*/
2020-11-08 07:13:21 -06:00
class IsDuplicateTransaction implements Rule
{
2020-11-08 07:13:21 -06:00
private string $value;
/**
2020-11-08 07:13:21 -06:00
* @inheritDoc
*/
2020-11-08 07:13:21 -06:00
public function passes($attribute, $value)
{
$this->value = $value;
return false;
}
/**
2020-11-08 07:13:21 -06:00
* @inheritDoc
*/
2020-11-08 07:13:21 -06:00
public function message()
{
return $this->value;
}
2020-12-21 22:35:06 -06:00
}