Skip to content

Commit 8b9cc69

Browse files
committed
5.5.2
1 parent 48a95af commit 8b9cc69

File tree

10 files changed

+35
-18
lines changed

10 files changed

+35
-18
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,5 +170,5 @@
170170
},
171171
"minimum-stability": "dev",
172172
"prefer-stable": true,
173-
"version": "5.5.0"
173+
"version": "5.5.2"
174174
}

public/app.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/mix-manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"/app.js": "/app.js?id=b683c7f17bf61009ff003bf3f85bb388",
2+
"/app.js": "/app.js?id=e185a578441e1252fba67ff67fa4d2eb",
33
"/ui.js": "/ui.js?id=592866a715b1c20b43fff6ca7980b279",
44
"/manifest.js": "/manifest.js?id=3267e5c99fd7b729e2f38ec55b50397d",
55
"/app.css": "/app.css?id=4ac240e9b4c482451bf95d4161751414",

resources/js/components/CreateForm.vue

+4-3
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,15 @@ export default {
225225
226226
async submitViaCreateResource(e) {
227227
e.preventDefault()
228+
this.isWorking = true
228229
this.submittedViaCreateResource = true
229230
this.submittedViaCreateResourceAndAddAnother = false
230231
await this.createResource()
231232
},
232233
233-
async submitViaCreateResourceAndAddAnother() {
234+
async submitViaCreateResourceAndAddAnother(e) {
235+
e.preventDefault()
236+
this.isWorking = true
234237
this.submittedViaCreateResourceAndAddAnother = true
235238
this.submittedViaCreateResource = false
236239
await this.createResource()
@@ -240,8 +243,6 @@ export default {
240243
* Create a new resource instance using the provided data.
241244
*/
242245
async createResource() {
243-
this.isWorking = true
244-
245246
if (this.$refs.form.reportValidity()) {
246247
try {
247248
const {

resources/js/views/Attach.vue

+8-3
Original file line numberDiff line numberDiff line change
@@ -433,11 +433,13 @@ export default {
433433
* Attach the selected resource.
434434
*/
435435
async attachResource() {
436+
this.isWorking = true
436437
this.submittedViaAttachResource = true
437438
438439
try {
439440
await this.attachRequest()
440441
442+
this.isWorking = false
441443
this.submittedViaAttachResource = false
442444
443445
await this.fetchPolicies(),
@@ -447,6 +449,7 @@ export default {
447449
} catch (error) {
448450
window.scrollTo(0, 0)
449451
452+
this.isWorking = false
450453
this.submittedViaAttachResource = false
451454
452455
this.handleOnCreateResponseError(error)
@@ -457,6 +460,7 @@ export default {
457460
* Attach a new resource and reset the form
458461
*/
459462
async attachAndAttachAnother() {
463+
this.isWorking = true
460464
this.submittedViaAttachAndAttachAnother = true
461465
462466
try {
@@ -466,15 +470,16 @@ export default {
466470
467471
this.disableNavigateBackUsingHistory()
468472
469-
Nova.success(this.__('The resource was attached!'))
470-
473+
this.isWorking = false
471474
this.submittedViaAttachAndAttachAnother = false
472475
473-
await this.fetchPolicies()
476+
await this.fetchPolicies(),
477+
Nova.success(this.__('The resource was attached!'))
474478
475479
// Reset the form by refetching the fields
476480
this.initializeComponent()
477481
} catch (error) {
482+
this.isWorking = false
478483
this.submittedViaAttachAndAttachAnother = false
479484
480485
this.handleOnCreateResponseError(error)

resources/js/views/Update.vue

+5-4
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,15 @@ export default {
210210
211211
async submitViaUpdateResource(e) {
212212
e.preventDefault()
213+
this.isWorking = true
213214
this.submittedViaUpdateResource = true
214215
this.submittedViaUpdateResourceAndContinueEditing = false
215216
await this.updateResource()
216217
},
217218
218219
async submitViaUpdateResourceAndContinueEditing(e) {
219220
e.preventDefault()
221+
this.isWorking = true
220222
this.submittedViaUpdateResourceAndContinueEditing = true
221223
this.submittedViaUpdateResource = false
222224
await this.updateResource()
@@ -236,8 +238,6 @@ export default {
236238
* Update the resource using the provided data.
237239
*/
238240
async updateResource() {
239-
this.isWorking = true
240-
241241
if (this.$refs.form.reportValidity()) {
242242
try {
243243
const {
@@ -273,26 +273,27 @@ export default {
273273
this.getFields()
274274
275275
this.resetErrors()
276+
this.isWorking = false
276277
this.submittedViaUpdateResource = false
277278
this.submittedViaUpdateResourceAndContinueEditing = false
278-
this.isWorking = false
279279
}
280280
281281
return
282282
}
283283
} catch (error) {
284284
window.scrollTo(0, 0)
285285
286+
this.isWorking = false
286287
this.submittedViaUpdateResource = false
287288
this.submittedViaUpdateResourceAndContinueEditing = false
288289
289290
this.handleOnUpdateResponseError(error)
290291
}
291292
}
292293
294+
this.isWorking = false
293295
this.submittedViaUpdateResource = false
294296
this.submittedViaUpdateResourceAndContinueEditing = false
295-
this.isWorking = false
296297
},
297298
298299
/**

resources/js/views/UpdateAttached.vue

+6
Original file line numberDiff line numberDiff line change
@@ -375,11 +375,13 @@ export default {
375375
* Update the attached resource.
376376
*/
377377
async updateAttachedResource() {
378+
this.isWorking = true
378379
this.submittedViaUpdateAttachedResource = true
379380
380381
try {
381382
await this.updateRequest()
382383
384+
this.isWorking = false
383385
this.submittedViaUpdateAttachedResource = false
384386
385387
await this.fetchPolicies(),
@@ -389,6 +391,7 @@ export default {
389391
} catch (error) {
390392
window.scrollTo(0, 0)
391393
394+
this.isWorking = false
392395
this.submittedViaUpdateAttachedResource = false
393396
394397
this.handleOnUpdateResponseError(error)
@@ -399,6 +402,7 @@ export default {
399402
* Update the resource and reset the form
400403
*/
401404
async updateAndContinueEditing() {
405+
this.isWorking = true
402406
this.submittedViaUpdateAndContinueEditing = true
403407
404408
try {
@@ -408,13 +412,15 @@ export default {
408412
409413
this.disableNavigateBackUsingHistory()
410414
415+
this.isWorking = false
411416
this.submittedViaUpdateAndContinueEditing = false
412417
413418
Nova.success(this.__('The resource was updated!'))
414419
415420
// Reset the form by refetching the fields
416421
this.initializeComponent()
417422
} catch (error) {
423+
this.isWorking = false
418424
this.submittedViaUpdateAndContinueEditing = false
419425
420426
this.handleOnUpdateResponseError(error)

src/Fields/HasDownload.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
use Illuminate\Http\Response;
77
use Laravel\Nova\Http\Requests\NovaRequest;
88
use Laravel\Nova\Resource;
9+
use Symfony\Component\HttpFoundation\BinaryFileResponse;
910
use Symfony\Component\HttpFoundation\StreamedResponse;
1011

1112
/**
1213
* @phpstan-type TResourceModel \Illuminate\Database\Eloquent\Model|\Laravel\Nova\Support\Fluent|\stdClass
13-
* @phpstan-type TDownloadResponse \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse|\Symfony\Component\HttpFoundation\StreamedResponse
14+
* @phpstan-type TDownloadResponse \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse|\Symfony\Component\HttpFoundation\BinaryFileResponse|\Symfony\Component\HttpFoundation\StreamedResponse
1415
* @phpstan-type TDownloadResponseCallback (callable(\Laravel\Nova\Http\Requests\NovaRequest, TResourceModel, ?string, ?string):(TDownloadResponse))
1516
*/
1617
trait HasDownload
@@ -61,7 +62,7 @@ public function download(callable $downloadResponseCallback)
6162
/**
6263
* Create an HTTP response to download the underlying field.
6364
*/
64-
public function toDownloadResponse(NovaRequest $request, Resource $resource): Response|RedirectResponse|StreamedResponse
65+
public function toDownloadResponse(NovaRequest $request, Resource $resource): Response|RedirectResponse|BinaryFileResponse|StreamedResponse
6566
{
6667
return \call_user_func(
6768
$this->downloadResponseCallback,

src/Fields/Password.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,11 @@ public function resolveForDisplay($resource, ?string $attribute = null): void
7272
#[\Override]
7373
public function fillModelWithData(object $model, mixed $value, string $attribute): void
7474
{
75-
$attributes = [str_replace('.', '->', $attribute) => Hash::make($value)];
75+
if (! empty($value)) {
76+
$attributes = [str_replace('.', '->', $attribute) => Hash::make($value)];
7677

77-
$model->forceFill($attributes);
78+
$model->forceFill($attributes);
79+
}
7880
}
7981

8082
/**

src/Http/Controllers/FieldDownloadController.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
use Illuminate\Http\Response;
77
use Illuminate\Routing\Controller;
88
use Laravel\Nova\Http\Requests\NovaRequest;
9+
use Symfony\Component\HttpFoundation\BinaryFileResponse;
910
use Symfony\Component\HttpFoundation\StreamedResponse;
1011

1112
class FieldDownloadController extends Controller
1213
{
1314
/**
1415
* Download the given field's contents.
1516
*/
16-
public function __invoke(NovaRequest $request): Response|RedirectResponse|StreamedResponse
17+
public function __invoke(NovaRequest $request): Response|RedirectResponse|BinaryFileResponse|StreamedResponse
1718
{
1819
$resource = $request->findResourceOrFail();
1920

0 commit comments

Comments
 (0)