@@ -55,6 +55,18 @@ public function you_can_find_a_model_by_its_uuid()
55
55
$ this ->assertSame ($ uuid , $ post ->uuid );
56
56
}
57
57
58
+ /** @test */
59
+ public function you_can_exclude_a_model_by_its_uuid ()
60
+ {
61
+ $ uuid = '55635d83-10bc-424f-bf3f-395ea7a5b47f ' ;
62
+
63
+ Post::create (['title ' => 'test post ' , 'uuid ' => $ uuid ]);
64
+
65
+ $ this ->assertNull (
66
+ Post::whereNotUuid ($ uuid )->first ()
67
+ );
68
+ }
69
+
58
70
/** @test */
59
71
public function you_can_find_a_model_by_custom_uuid_parameter ()
60
72
{
@@ -88,6 +100,24 @@ public function you_can_search_by_array_of_uuids()
88
100
])->count ());
89
101
}
90
102
103
+ /** @test */
104
+ public function you_can_exclude_by_array_of_uuids ()
105
+ {
106
+ Post::create (['title ' => 'first post ' , 'uuid ' => '8ab48e77-d9cd-4fe7-ace5-a5a428590c18 ' ]);
107
+ Post::create (['title ' => 'second post ' , 'uuid ' => 'c7c26456-ddb0-45cd-9b1c-318296cce7a3 ' ]);
108
+ Post::create (['title ' => 'third post ' , 'uuid ' => 'e99d440e-fa25-45f2-ba2f-7c4c48f6fb5d ' ]);
109
+
110
+ $ uuids = [
111
+ '8ab48e77-d9cd-4fe7-ace5-A5A428590C18 ' ,
112
+ 'c7c26456-ddb0-45cd-9b1c-318296cce7a3 ' ,
113
+ ];
114
+
115
+ $ posts = Post::whereNotUuid ($ uuids )->get ();
116
+
117
+ $ this ->assertEquals (1 , $ posts ->count ());
118
+ $ this ->assertEquals ('e99d440e-fa25-45f2-ba2f-7c4c48f6fb5d ' , $ posts ->get (0 )->uuid );
119
+ }
120
+
91
121
/** @test */
92
122
public function you_can_search_by_array_of_efficient_uuids ()
93
123
{
@@ -100,6 +130,24 @@ public function you_can_search_by_array_of_efficient_uuids()
100
130
], 'efficient_uuid ' )->count ());
101
131
}
102
132
133
+ /** @test */
134
+ public function you_can_exclude_by_array_of_efficient_uuids ()
135
+ {
136
+ EfficientUuidPost::create (['title ' => 'first post ' , 'efficient_uuid ' => '8ab48e77-d9cd-4fe7-ace5-a5a428590c18 ' ]);
137
+ EfficientUuidPost::create (['title ' => 'second post ' , 'efficient_uuid ' => 'c7c26456-ddb0-45cd-9b1c-318296cce7a3 ' ]);
138
+ EfficientUuidPost::create (['title ' => 'third post ' , 'efficient_uuid ' => 'e99d440e-fa25-45f2-ba2f-7c4c48f6fb5d ' ]);
139
+
140
+ $ uuids = [
141
+ '8ab48e77-d9cd-4fe7-ace5-A5A428590C18 ' ,
142
+ 'c7c26456-ddb0-45cd-9b1c-318296cce7a3 ' ,
143
+ ];
144
+
145
+ $ posts = EfficientUuidPost::whereNotUuid ($ uuids , 'efficient_uuid ' )->get ();
146
+
147
+ $ this ->assertEquals (1 , $ posts ->count ());
148
+ $ this ->assertSame ('e99d440e-fa25-45f2-ba2f-7c4c48f6fb5d ' , $ posts ->get (0 )->efficient_uuid );
149
+ }
150
+
103
151
/** @test */
104
152
public function you_can_search_by_array_of_uuids_for_custom_column ()
105
153
{
@@ -112,6 +160,24 @@ public function you_can_search_by_array_of_uuids_for_custom_column()
112
160
], 'custom_uuid ' )->count ());
113
161
}
114
162
163
+ /** @test */
164
+ public function you_can_exclude_by_array_of_uuids_for_custom_column ()
165
+ {
166
+ CustomCastUuidPost::create (['title ' => 'first post ' , 'custom_uuid ' => '8ab48e77-d9cd-4fe7-ace5-a5a428590c18 ' ]);
167
+ CustomCastUuidPost::create (['title ' => 'second post ' , 'custom_uuid ' => 'c7c26456-ddb0-45cd-9b1c-318296cce7a3 ' ]);
168
+ CustomCastUuidPost::create (['title ' => 'third post ' , 'custom_uuid ' => 'e99d440e-fa25-45f2-ba2f-7c4c48f6fb5d ' ]);
169
+
170
+ $ uuids = [
171
+ '8ab48e77-d9cd-4fe7-ace5-A5A428590C18 ' ,
172
+ 'c7c26456-ddb0-45cd-9b1c-318296cce7a3 ' ,
173
+ ];
174
+
175
+ $ posts = CustomCastUuidPost::whereNotUuid ($ uuids , 'custom_uuid ' )->get ();
176
+
177
+ $ this ->assertEquals (1 , $ posts ->count ());
178
+ $ this ->assertSame ('e99d440e-fa25-45f2-ba2f-7c4c48f6fb5d ' , $ posts ->get (0 )->custom_uuid );
179
+ }
180
+
115
181
/** @test */
116
182
public function you_can_search_by_array_of_uuids_which_contains_an_invalid_uuid ()
117
183
{
@@ -125,6 +191,25 @@ public function you_can_search_by_array_of_uuids_which_contains_an_invalid_uuid(
125
191
])->count ());
126
192
}
127
193
194
+ /** @test */
195
+ public function you_can_exclude_by_array_of_uuids_which_contains_an_invalid_uuid ()
196
+ {
197
+ Post::create (['title ' => 'first post ' , 'uuid ' => '8ab48e77-d9cd-4fe7-ace5-a5a428590c18 ' ]);
198
+ Post::create (['title ' => 'second post ' , 'uuid ' => 'c7c26456-ddb0-45cd-9b1c-318296cce7a3 ' ]);
199
+ Post::create (['title ' => 'third post ' , 'uuid ' => 'e99d440e-fa25-45f2-ba2f-7c4c48f6fb5d ' ]);
200
+
201
+ $ uuids = [
202
+ '8ab48e77-d9cd-4fe7-ace5-A5A428590C18 ' ,
203
+ 'c7c26456-ddb0-45cd-9b1c-318296cce7a3 ' ,
204
+ 'this is invalid ' ,
205
+ ];
206
+
207
+ $ posts = Post::whereNotUuid ($ uuids )->get ();
208
+
209
+ $ this ->assertEquals (1 , $ posts ->count ());
210
+ $ this ->assertEquals ('e99d440e-fa25-45f2-ba2f-7c4c48f6fb5d ' , $ posts ->get (0 )->uuid );
211
+ }
212
+
128
213
/** @test */
129
214
public function you_can_generate_a_uuid_without_casting ()
130
215
{
@@ -164,6 +249,18 @@ public function you_can_find_a_model_by_uuid_without_casting()
164
249
$ this ->assertSame ($ uuid , $ post ->uuid );
165
250
}
166
251
252
+ /** @test */
253
+ public function you_can_exclude_a_model_by_uuid_without_casting ()
254
+ {
255
+ $ uuid = 'b270f651-4db8-407b-aade-8666aca2750e ' ;
256
+
257
+ UncastPost::create (['title ' => 'test-post ' , 'uuid ' => $ uuid ]);
258
+
259
+ $ post = UncastPost::whereNotUuid ($ uuid )->first ();
260
+
261
+ $ this ->assertNull ($ post );
262
+ }
263
+
167
264
/** @test */
168
265
public function you_can_find_a_model_by_uuid_with_casting ()
169
266
{
@@ -177,6 +274,18 @@ public function you_can_find_a_model_by_uuid_with_casting()
177
274
$ this ->assertSame ($ uuid , $ post ->uuid );
178
275
}
179
276
277
+ /** @test */
278
+ public function you_can_exclude_a_model_by_uuid_with_casting ()
279
+ {
280
+ $ uuid = 'b270f651-4db8-407b-aade-8666aca2750e ' ;
281
+
282
+ EfficientUuidPost::create (['title ' => 'efficient uuid ' , 'uuid ' => $ uuid ]);
283
+
284
+ $ post = EfficientUuidPost::whereNotUuid ($ uuid )->first ();
285
+
286
+ $ this ->assertNull ($ post );
287
+ }
288
+
180
289
/** @test */
181
290
public function it_handles_time_ordered_uuids ()
182
291
{
0 commit comments