Skip to content

Commit d13d4cf

Browse files
author
Nikita Teryaev
committed
fix logic for tests
1 parent 8d93623 commit d13d4cf

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

app/Authentication/Validators/GroupValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class GroupValidator extends AbstractValidator
1414
public function __construct()
1515
{
1616
Event::listen('validating', function ($input) {
17-
$table_name = isset($input['_table_name']) ? $input['_table_name'] : $this->table_name;
17+
$table_name = isset($input['_table_name']) ? $input['_table_name'] : $this::$table_name;
1818
static::$rules["name"][] = "unique:{$table_name},name,{$input['id']}";
1919
});
2020
}

app/Authentication/Validators/PermissionValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class PermissionValidator extends AbstractValidator
1515
public function __construct()
1616
{
1717
Event::listen('validating', function ($input) {
18-
$table_name = isset($input['_table_name']) ? $input['_table_name'] : $this->table_name;
18+
$table_name = isset($input['_table_name']) ? $input['_table_name'] : $this::$table_name;
1919

2020
static::$rules["permission"][] = "unique:{$table_name},permission,{$input['id']}";
2121
});

app/Authentication/Validators/UserValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function __construct()
1818
// check if the input comes form the correct form
1919
if (!isset($input['form_name']) || $input['form_name'] != 'user')
2020
return true;
21-
$table_name = isset($input['_table_name']) ? $input['_table_name'] : $this->table_name;
21+
$table_name = isset($input['_table_name']) ? $input['_table_name'] : $this::$table_name;
2222
if (empty($input["id"])) {
2323
static::$rules["password"][] = "required";
2424
static::$rules["email"][] = "unique:{$table_name},email";

app/Library/Form/FormModel.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,18 @@ public function __construct(ValidatorInterface $validator, $repository)
5050
*/
5151
public function process(array $input)
5252
{
53-
try{
54-
$model = $this->r->getModel();
55-
$table_name = (new $model)->getTable();
56-
if ($table_name) {
57-
$input['_table_name'] = $table_name;
58-
}
59-
} catch (\Exception $e) {
60-
61-
}
62-
6353
if($this->v->validate($input))
6454
{
55+
try{
56+
$model = $this->r->getModel();
57+
$table_name = (new $model)->getTable();
58+
if ($table_name) {
59+
$input['_table_name'] = $table_name;
60+
}
61+
} catch (\Exception $e) {
62+
63+
}
64+
6565
Event::fire("form.processing", array($input));
6666
return $this->callRepository($input);
6767
}

0 commit comments

Comments
 (0)