mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 06:04:08 -08:00
Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
a781f84aea
|
@ -914,13 +914,22 @@ class Helper
|
|||
$rules = $class::rules();
|
||||
foreach ($rules as $rule_name => $rule) {
|
||||
if ($rule_name == $field) {
|
||||
if (strpos($rule_name, 'required') === false) {
|
||||
return false;
|
||||
if (is_array($rule)) {
|
||||
if (in_array('required', $rule)) {
|
||||
$required = true;
|
||||
} else {
|
||||
$required = false;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
if (strpos($rule, 'required') === false) {
|
||||
$required = false;
|
||||
} else {
|
||||
$required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $required;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
19
tests/Feature/Assets/Ui/EditAssetTest.php
Normal file
19
tests/Feature/Assets/Ui/EditAssetTest.php
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Feature\Assets\Ui;
|
||||
|
||||
use App\Models\Asset;
|
||||
use App\Models\User;
|
||||
use Tests\TestCase;
|
||||
|
||||
class EditAssetTest extends TestCase
|
||||
{
|
||||
public function testPageCanBeAccessed(): void
|
||||
{
|
||||
$asset = Asset::factory()->create();
|
||||
$user = User::factory()->editAssets()->create();
|
||||
$response = $this->actingAs($user)->get(route('hardware.edit', $asset->id));
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue