Merge remote-tracking branch 'origin/develop'

This commit is contained in:
snipe 2024-07-24 10:36:23 +01:00
commit a781f84aea
2 changed files with 32 additions and 4 deletions

View file

@ -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;
}
/**

View 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);
}
}