Skip to content

Commit 8cdbeea

Browse files
authored
Merge branch 'SpartnerNL:1.3' into 1.3
2 parents f9cb379 + dd5f4c3 commit 8cdbeea

File tree

11 files changed

+20
-19
lines changed

11 files changed

+20
-19
lines changed

src/Actions/DownloadExcel.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Illuminate\Support\Facades\URL;
77
use Illuminate\Support\Str;
88
use Laravel\Nova\Actions\Action;
9+
use Laravel\Nova\Actions\ActionResponse;
910
use Laravel\Nova\Http\Requests\ActionRequest;
1011
use Maatwebsite\Excel\Facades\Excel;
1112
use Symfony\Component\HttpFoundation\BinaryFileResponse;
@@ -47,9 +48,9 @@ public function handle(ActionRequest $request, Action $exportable): mixed
4748

4849
return \is_callable($this->onSuccess)
4950
? ($this->onSuccess)($request, $response)
50-
: Action::download(
51-
$this->getDownloadUrl($response->getFile()->getPathname()),
52-
$this->getFilename()
51+
: ActionResponse::download(
52+
$this->getFilename(),
53+
$this->getDownloadUrl($response->getFile()->getPathname())
5354
);
5455
}
5556

@@ -71,9 +72,9 @@ public function handleRemoteDisk(ActionRequest $request, Action $exportable): mi
7172

7273
return \is_callable($this->onSuccess)
7374
? ($this->onSuccess)($request, $temporaryFilePath)
74-
: Action::download(
75-
$this->getDownloadUrl($temporaryFilePath),
76-
$this->getFilename()
75+
: ActionResponse::download(
76+
$this->getFilename(),
77+
$this->getDownloadUrl($temporaryFilePath)
7778
);
7879
}
7980

src/Actions/ExportToExcel.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ class ExportToExcel extends Action implements FromQuery, WithCustomChunkSize, Wi
4343
WithWriterType;
4444

4545
/**
46-
* @var ExportActionRequest|ActionRequest
46+
* @var string
4747
*/
48-
protected $request;
48+
public $resource;
4949

5050
/**
51-
* @var string
51+
* @var ExportActionRequest|ActionRequest
5252
*/
53-
protected $resource;
53+
protected $request;
5454

5555
/**
5656
* @var Builder

src/Concerns/WithDisk.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ trait WithDisk
1313
* @param string|null $disk
1414
* @return $this
1515
*/
16-
public function withDisk(string $disk = null)
16+
public function withDisk(?string $disk = null)
1717
{
1818
$this->disk = $disk;
1919

src/Concerns/WithFilename.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ trait WithFilename
1818
* @param string|null $filename
1919
* @return $this
2020
*/
21-
public function withFilename(string $filename = null)
21+
public function withFilename(?string $filename = null)
2222
{
2323
$this->filename = $filename;
2424

src/Concerns/WithWriterType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ trait WithWriterType
1515
* @param string|null $writerType
1616
* @return $this
1717
*/
18-
public function withWriterType(string $writerType = null)
18+
public function withWriterType(?string $writerType = null)
1919
{
2020
$this->writerType = $writerType;
2121

src/Interactions/AskForFilename.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ trait AskForFilename
1313
* @param callable|null $callback
1414
* @return $this
1515
*/
16-
public function askForFilename(string $label = null, callable $callback = null)
16+
public function askForFilename(?string $label = null, ?callable $callback = null)
1717
{
1818
$field = Text::make($label ?? __('Filename'), 'filename');
1919

src/Interactions/AskForWriterType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ trait AskForWriterType
1515
* @param callable|null $callback
1616
* @return $this
1717
*/
18-
public function askForWriterType(array $options = null, string $label = null, callable $callback = null)
18+
public function askForWriterType(?array $options = null, ?string $label = null, ?callable $callback = null)
1919
{
2020
$options = $options ?: [
2121
Excel::XLS => 'XLS',

src/Requests/ExportActionRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ public function resourceFields(Resource $resource): Collection;
3030
* @param string|null $default
3131
* @return string|null
3232
*/
33-
public function findHeading(string $attribute, string $default = null);
33+
public function findHeading(string $attribute, ?string $default = null);
3434
}

src/Requests/ExportLensActionRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function resourceFields(Resource $resource): Collection
5252
*
5353
* @return \Illuminate\Support\Collection
5454
*/
55-
public function availableLenses()
55+
public function availableLenses(): Collection
5656
{
5757
if (!$this->resourceInstance) {
5858
$this->resourceInstance = $this->newResource();

src/Requests/SerializedRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class SerializedRequest
2828
* @param string $resource
2929
* @param string|null $lens
3030
*/
31-
public function __construct(string $className, string $resource, string $lens = null)
31+
public function __construct(string $className, string $resource, ?string $lens = null)
3232
{
3333
$this->className = $className;
3434
$this->resource = $resource;

0 commit comments

Comments
 (0)