File tree Expand file tree Collapse file tree 2 files changed +5
-21
lines changed Expand file tree Collapse file tree 2 files changed +5
-21
lines changed Original file line number Diff line number Diff line change @@ -26,8 +26,12 @@ public static function form(Form $form): Form
26
26
return $ form
27
27
->schema ([
28
28
Forms \Components \TextInput::make ('name ' )
29
- ->required ()
30
29
->live (onBlur: true )
30
+ ->required ()
31
+ ->unique ()
32
+ ->validationMessages ([
33
+ 'unique ' => 'Cette valeur existe déjà ' ,
34
+ ])
31
35
->afterStateUpdated (function (string $ operation , $ state , Forms \Set $ set ): void {
32
36
$ set ('slug ' , Str::slug ($ state ));
33
37
})
Original file line number Diff line number Diff line change 52
52
->assertStatus (200 );
53
53
});
54
54
55
- it ('Generate tag if tag already exist ' , function (): void {
56
-
57
- $ name = fake ()->name ();
58
- Tag::factory ()->create ([
59
- 'name ' => $ name ,
60
- 'slug ' => Str::slug ($ name ),
61
- 'concerns ' => ['discussion ' ],
62
- ]);
63
-
64
- Livewire::test (ListTags::class)
65
- ->callAction (CreateAction::class, data: [
66
- 'name ' => $ name ,
67
- 'concerns ' => ['post ' , 'tutorial ' ],
68
- 'description ' => 'Description du tag ' .$ name ,
69
- ]);
70
-
71
- expect (Tag::orderByDesc ('id ' )->first ()->slug )
72
- ->toBe (Str::slug ($ name ).'-1 ' );
73
- });
74
-
75
55
it ('Admin can edit tag ' , function (): void {
76
56
$ tag = Tag::factory ()->create ();
77
57
You can’t perform that action at this time.
0 commit comments