mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-21 19:49:54 +00:00
Code clean up.
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
@@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
|
||||
/**
|
||||
* Class AccountFormRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class AccountFormRequest.
|
||||
*/
|
||||
class AccountFormRequest extends Request
|
||||
{
|
||||
@@ -77,7 +73,7 @@ class AccountFormRequest extends Request
|
||||
|
||||
$nameRule = 'required|min:1|uniqueAccountForUser';
|
||||
$idRule = '';
|
||||
if (!is_null($repository->find(intval($this->get('id')))->id)) {
|
||||
if (null !== $repository->find(intval($this->get('id')))->id) {
|
||||
$idRule = 'belongsToUser:accounts';
|
||||
$nameRule = 'required|min:1|uniqueAccountForUser:' . intval($this->get('id'));
|
||||
}
|
||||
|
@@ -18,16 +18,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
|
||||
/**
|
||||
* Class AttachmentFormRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class AttachmentFormRequest.
|
||||
*/
|
||||
class AttachmentFormRequest extends Request
|
||||
{
|
||||
|
@@ -18,16 +18,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
|
||||
/**
|
||||
* Class BillFormRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class BillFormRequest.
|
||||
*/
|
||||
class BillFormRequest extends Request
|
||||
{
|
||||
|
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
@@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
|
||||
/**
|
||||
* Class BudgetFormRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class BudgetFormRequest.
|
||||
*/
|
||||
class BudgetFormRequest extends Request
|
||||
{
|
||||
@@ -61,7 +57,7 @@ class BudgetFormRequest extends Request
|
||||
/** @var BudgetRepositoryInterface $repository */
|
||||
$repository = app(BudgetRepositoryInterface::class);
|
||||
$nameRule = 'required|between:1,100|uniqueObjectForUser:budgets,name';
|
||||
if (!is_null($repository->find(intval($this->get('id')))->id)) {
|
||||
if (null !== $repository->find(intval($this->get('id')))->id) {
|
||||
$nameRule = 'required|between:1,100|uniqueObjectForUser:budgets,name,' . intval($this->get('id'));
|
||||
}
|
||||
|
||||
|
@@ -18,16 +18,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
|
||||
/**
|
||||
* Class BudgetIncomeRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class BudgetIncomeRequest.
|
||||
*/
|
||||
class BudgetIncomeRequest extends Request
|
||||
{
|
||||
|
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
@@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests;
|
||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||
|
||||
/**
|
||||
* Class CategoryFormRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class CategoryFormRequest.
|
||||
*/
|
||||
class CategoryFormRequest extends Request
|
||||
{
|
||||
@@ -60,7 +56,7 @@ class CategoryFormRequest extends Request
|
||||
/** @var CategoryRepositoryInterface $repository */
|
||||
$repository = app(CategoryRepositoryInterface::class);
|
||||
$nameRule = 'required|between:1,100|uniqueObjectForUser:categories,name';
|
||||
if (!is_null($repository->find(intval($this->get('id')))->id)) {
|
||||
if (null !== $repository->find(intval($this->get('id')))->id) {
|
||||
$nameRule = 'required|between:1,100|uniqueObjectForUser:categories,name,' . intval($this->get('id'));
|
||||
}
|
||||
|
||||
|
@@ -18,16 +18,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
|
||||
/**
|
||||
* Class ConfigurationRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class ConfigurationRequest.
|
||||
*/
|
||||
class ConfigurationRequest extends Request
|
||||
{
|
||||
|
@@ -18,16 +18,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
|
||||
/**
|
||||
* Class BillFormRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class BillFormRequest.
|
||||
*/
|
||||
class CurrencyFormRequest extends Request
|
||||
{
|
||||
|
@@ -18,16 +18,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
|
||||
/**
|
||||
* Class DeleteAccountFormRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class DeleteAccountFormRequest.
|
||||
*/
|
||||
class DeleteAccountFormRequest extends Request
|
||||
{
|
||||
|
@@ -18,16 +18,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
|
||||
/**
|
||||
* Class EmailFormRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class EmailFormRequest.
|
||||
*/
|
||||
class EmailFormRequest extends Request
|
||||
{
|
||||
|
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
@@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests;
|
||||
use Carbon\Carbon;
|
||||
|
||||
/**
|
||||
* Class ExportFormRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class ExportFormRequest.
|
||||
*/
|
||||
class ExportFormRequest extends Request
|
||||
{
|
||||
|
@@ -18,16 +18,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
|
||||
/**
|
||||
* Class ImportUploadRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class ImportUploadRequest.
|
||||
*/
|
||||
class ImportUploadRequest extends Request
|
||||
{
|
||||
|
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
@@ -27,10 +26,7 @@ use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
|
||||
/**
|
||||
* Class JournalFormRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class JournalFormRequest.
|
||||
*/
|
||||
class JournalFormRequest extends Request
|
||||
{
|
||||
@@ -81,7 +77,6 @@ class JournalFormRequest extends Request
|
||||
'native_amount' => $this->float('native_amount'),
|
||||
'source_amount' => $this->float('source_amount'),
|
||||
'destination_amount' => $this->float('destination_amount'),
|
||||
|
||||
];
|
||||
|
||||
return $data;
|
||||
@@ -130,12 +125,13 @@ class JournalFormRequest extends Request
|
||||
}
|
||||
|
||||
/**
|
||||
* Inspired by https://www.youtube.com/watch?v=WwnI0RS6J5A
|
||||
* Inspired by https://www.youtube.com/watch?v=WwnI0RS6J5A.
|
||||
*
|
||||
* @param string $what
|
||||
* @param array $rules
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function enhanceRules(string $what, array $rules): array
|
||||
|
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
@@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests;
|
||||
use FireflyIII\Models\LinkType;
|
||||
|
||||
/**
|
||||
* Class JournalLink
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class JournalLink.
|
||||
*/
|
||||
class JournalLinkRequest extends Request
|
||||
{
|
||||
@@ -54,7 +50,7 @@ class JournalLinkRequest extends Request
|
||||
$return['transaction_journal_id'] = $this->integer('link_journal_id');
|
||||
$return['comments'] = strlen($this->string('comments')) > 0 ? $this->string('comments') : null;
|
||||
$return['direction'] = $parts[1];
|
||||
if ($return['transaction_journal_id'] === 0 && ctype_digit($this->string('link_other'))) {
|
||||
if (0 === $return['transaction_journal_id'] && ctype_digit($this->string('link_other'))) {
|
||||
$return['transaction_journal_id'] = $this->integer('link_other');
|
||||
}
|
||||
|
||||
|
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
@@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests;
|
||||
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
|
||||
|
||||
/**
|
||||
* Class BillFormRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class BillFormRequest.
|
||||
*/
|
||||
class LinkTypeFormRequest extends Request
|
||||
{
|
||||
@@ -53,7 +49,7 @@ class LinkTypeFormRequest extends Request
|
||||
$repository = app(LinkTypeRepositoryInterface::class);
|
||||
$nameRule = 'required|min:1|unique:link_types,name';
|
||||
$idRule = '';
|
||||
if (!is_null($repository->find($this->integer('id'))->id)) {
|
||||
if (null !== $repository->find($this->integer('id'))->id) {
|
||||
$idRule = 'exists:link_types,id';
|
||||
$nameRule = 'required|min:1';
|
||||
}
|
||||
|
@@ -18,16 +18,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
|
||||
/**
|
||||
* Class MassDeleteJournalRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class MassDeleteJournalRequest.
|
||||
*/
|
||||
class MassDeleteJournalRequest extends Request
|
||||
{
|
||||
|
@@ -18,16 +18,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
|
||||
/**
|
||||
* Class MassEditJournalRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class MassEditJournalRequest.
|
||||
*/
|
||||
class MassEditJournalRequest extends Request
|
||||
{
|
||||
|
@@ -18,16 +18,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
|
||||
/**
|
||||
* Class NewUserFormRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class NewUserFormRequest.
|
||||
*/
|
||||
class NewUserFormRequest extends Request
|
||||
{
|
||||
|
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
@@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests;
|
||||
use Carbon\Carbon;
|
||||
|
||||
/**
|
||||
* Class PiggyBankFormRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class PiggyBankFormRequest.
|
||||
*/
|
||||
class PiggyBankFormRequest extends Request
|
||||
{
|
||||
@@ -67,7 +63,6 @@ class PiggyBankFormRequest extends Request
|
||||
$nameRule = 'required|between:1,255|uniquePiggyBankForUser:' . intval($this->get('id'));
|
||||
}
|
||||
|
||||
|
||||
$rules = [
|
||||
'name' => $nameRule,
|
||||
'account_id' => 'required|belongsToUser:accounts',
|
||||
@@ -76,7 +71,6 @@ class PiggyBankFormRequest extends Request
|
||||
'startdate' => 'date',
|
||||
'targetdate' => 'date|nullable',
|
||||
'order' => 'integer|min:1',
|
||||
|
||||
];
|
||||
|
||||
return $rules;
|
||||
|
@@ -18,16 +18,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
|
||||
/**
|
||||
* Class ProfileFormRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class ProfileFormRequest.
|
||||
*/
|
||||
class ProfileFormRequest extends Request
|
||||
{
|
||||
|
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
@@ -33,10 +32,7 @@ use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* Class CategoryFormRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class CategoryFormRequest.
|
||||
*/
|
||||
class ReportFormRequest extends Request
|
||||
{
|
||||
@@ -62,7 +58,7 @@ class ReportFormRequest extends Request
|
||||
if (is_array($set)) {
|
||||
foreach ($set as $accountId) {
|
||||
$account = $repository->find(intval($accountId));
|
||||
if (!is_null($account->id)) {
|
||||
if (null !== $account->id) {
|
||||
$collection->push($account);
|
||||
}
|
||||
}
|
||||
@@ -83,7 +79,7 @@ class ReportFormRequest extends Request
|
||||
if (is_array($set)) {
|
||||
foreach ($set as $budgetId) {
|
||||
$budget = $repository->find(intval($budgetId));
|
||||
if (!is_null($budget->id)) {
|
||||
if (null !== $budget->id) {
|
||||
$collection->push($budget);
|
||||
}
|
||||
}
|
||||
@@ -104,7 +100,7 @@ class ReportFormRequest extends Request
|
||||
if (is_array($set)) {
|
||||
foreach ($set as $categoryId) {
|
||||
$category = $repository->find(intval($categoryId));
|
||||
if (!is_null($category->id)) {
|
||||
if (null !== $category->id) {
|
||||
$collection->push($category);
|
||||
}
|
||||
}
|
||||
@@ -115,6 +111,7 @@ class ReportFormRequest extends Request
|
||||
|
||||
/**
|
||||
* @return Carbon
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function getEndDate(): Carbon
|
||||
@@ -122,7 +119,7 @@ class ReportFormRequest extends Request
|
||||
$date = new Carbon;
|
||||
$range = $this->get('daterange');
|
||||
$parts = explode(' - ', strval($range));
|
||||
if (count($parts) === 2) {
|
||||
if (2 === count($parts)) {
|
||||
try {
|
||||
$date = new Carbon($parts[1]);
|
||||
} catch (Exception $e) {
|
||||
@@ -135,6 +132,7 @@ class ReportFormRequest extends Request
|
||||
|
||||
/**
|
||||
* @return Carbon
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function getStartDate(): Carbon
|
||||
@@ -142,7 +140,7 @@ class ReportFormRequest extends Request
|
||||
$date = new Carbon;
|
||||
$range = $this->get('daterange');
|
||||
$parts = explode(' - ', strval($range));
|
||||
if (count($parts) === 2) {
|
||||
if (2 === count($parts)) {
|
||||
try {
|
||||
$date = new Carbon($parts[0]);
|
||||
} catch (Exception $e) {
|
||||
@@ -165,7 +163,7 @@ class ReportFormRequest extends Request
|
||||
if (is_array($set)) {
|
||||
foreach ($set as $tagTag) {
|
||||
$tag = $repository->findByTag($tagTag);
|
||||
if (!is_null($tag->id)) {
|
||||
if (null !== $tag->id) {
|
||||
$collection->push($tag);
|
||||
}
|
||||
}
|
||||
|
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
@@ -27,9 +26,7 @@ use Carbon\Carbon;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* Class Request
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class Request.
|
||||
*/
|
||||
class Request extends FormRequest
|
||||
{
|
||||
@@ -40,7 +37,7 @@ class Request extends FormRequest
|
||||
*/
|
||||
public function boolean(string $field): bool
|
||||
{
|
||||
return intval($this->input($field)) === 1;
|
||||
return 1 === intval($this->input($field));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
@@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests;
|
||||
use FireflyIII\Repositories\Rule\RuleRepositoryInterface;
|
||||
|
||||
/**
|
||||
* Class RuleFormRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class RuleFormRequest.
|
||||
*/
|
||||
class RuleFormRequest extends Request
|
||||
{
|
||||
@@ -77,7 +73,7 @@ class RuleFormRequest extends Request
|
||||
$contextActions = join(',', config('firefly.rule-actions-text'));
|
||||
|
||||
$titleRule = 'required|between:1,100|uniqueObjectForUser:rules,title';
|
||||
if (!is_null($repository->find(intval($this->get('id')))->id)) {
|
||||
if (null !== $repository->find(intval($this->get('id')))->id) {
|
||||
$titleRule = 'required|between:1,100|uniqueObjectForUser:rules,title,' . intval($this->get('id'));
|
||||
}
|
||||
$rules = [
|
||||
@@ -91,7 +87,7 @@ class RuleFormRequest extends Request
|
||||
'rule-action.*' => 'required|in:' . join(',', $validActions),
|
||||
];
|
||||
// since Laravel does not support this stuff yet, here's a trick.
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
for ($i = 0; $i < 10; ++$i) {
|
||||
$rules['rule-action-value.' . $i] = 'required_if:rule-action.' . $i . ',' . $contextActions . '|ruleActionValue';
|
||||
}
|
||||
|
||||
|
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
@@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests;
|
||||
use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;
|
||||
|
||||
/**
|
||||
* Class RuleGroupFormRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class RuleGroupFormRequest.
|
||||
*/
|
||||
class RuleGroupFormRequest extends Request
|
||||
{
|
||||
@@ -62,7 +58,7 @@ class RuleGroupFormRequest extends Request
|
||||
/** @var RuleGroupRepositoryInterface $repository */
|
||||
$repository = app(RuleGroupRepositoryInterface::class);
|
||||
$titleRule = 'required|between:1,100|uniqueObjectForUser:rule_groups,title';
|
||||
if (!is_null($repository->find(intval($this->get('id')))->id)) {
|
||||
if (null !== $repository->find(intval($this->get('id')))->id) {
|
||||
$titleRule = 'required|between:1,100|uniqueObjectForUser:rule_groups,title,' . intval($this->get('id'));
|
||||
}
|
||||
|
||||
|
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
@@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests;
|
||||
use Carbon\Carbon;
|
||||
|
||||
/**
|
||||
* Class ExportFormRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class ExportFormRequest.
|
||||
*/
|
||||
class SelectTransactionsRequest extends Request
|
||||
{
|
||||
|
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
@@ -26,9 +25,7 @@ namespace FireflyIII\Http\Requests;
|
||||
use Steam;
|
||||
|
||||
/**
|
||||
* Class SplitJournalFormRequest
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class SplitJournalFormRequest.
|
||||
*/
|
||||
class SplitJournalFormRequest extends Request
|
||||
{
|
||||
|
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
@@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests;
|
||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||
|
||||
/**
|
||||
* Class TagFormRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class TagFormRequest.
|
||||
*/
|
||||
class TagFormRequest extends Request
|
||||
{
|
||||
@@ -51,7 +47,7 @@ class TagFormRequest extends Request
|
||||
$longitude = null;
|
||||
$zoomLevel = null;
|
||||
|
||||
if ($this->get('tag_position_has_tag') === 'true') {
|
||||
if ('true' === $this->get('tag_position_has_tag')) {
|
||||
$latitude = $this->string('tag_position_latitude');
|
||||
$longitude = $this->string('tag_position_longitude');
|
||||
$zoomLevel = $this->integer('tag_position_zoomlevel');
|
||||
@@ -78,7 +74,7 @@ class TagFormRequest extends Request
|
||||
$repository = app(TagRepositoryInterface::class);
|
||||
$idRule = '';
|
||||
$tagRule = 'required|min:1|uniqueObjectForUser:tags,tag';
|
||||
if (!is_null($repository->find(intval($this->get('id')))->id)) {
|
||||
if (null !== $repository->find(intval($this->get('id')))->id) {
|
||||
$idRule = 'belongsToUser:tags';
|
||||
$tagRule = 'required|min:1|uniqueObjectForUser:tags,tag,' . $this->get('id');
|
||||
}
|
||||
|
@@ -18,16 +18,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
|
||||
/**
|
||||
* Class RuleFormRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class RuleFormRequest.
|
||||
*/
|
||||
class TestRuleFormRequest extends Request
|
||||
{
|
||||
|
@@ -18,16 +18,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
|
||||
/**
|
||||
* Class TokenFormRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class TokenFormRequest.
|
||||
*/
|
||||
class TokenFormRequest extends Request
|
||||
{
|
||||
|
@@ -18,16 +18,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
|
||||
/**
|
||||
* Class UserFormRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class UserFormRequest.
|
||||
*/
|
||||
class UserFormRequest extends Request
|
||||
{
|
||||
@@ -47,7 +43,7 @@ class UserFormRequest extends Request
|
||||
{
|
||||
return [
|
||||
'email' => $this->string('email'),
|
||||
'blocked' => $this->integer('blocked') === 1,
|
||||
'blocked' => 1 === $this->integer('blocked'),
|
||||
'blocked_code' => $this->string('blocked_code'),
|
||||
'password' => $this->string('password'),
|
||||
];
|
||||
|
@@ -18,16 +18,12 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
|
||||
/**
|
||||
* Class UserRegistrationRequest
|
||||
*
|
||||
*
|
||||
* @package FireflyIII\Http\Requests
|
||||
* Class UserRegistrationRequest.
|
||||
*/
|
||||
class UserRegistrationRequest extends Request
|
||||
{
|
||||
@@ -49,7 +45,6 @@ class UserRegistrationRequest extends Request
|
||||
return [
|
||||
'email' => 'email|required',
|
||||
'password' => 'confirmed|secure_password',
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user