This repository was archived by the owner on Oct 20, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
resources/views/functional Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 66 -> mergeVueBinding (' :url' , $url )
77} }
88 @if ($data ) :default =" @js ($data )" @else :default =" {!! $json ! !}" @endif
9+ @if ($headers ) :headers =" @js ($headers )" @else :headers =" {!! $jsonHeaders ! !}" @endif
910 @if ($requestData ) :request =" @js ($requestData )" @else :request =" {!! $requestJson ! !}" @endif >
1011 <template #default =" {!! $scope ! !}" >
1112 {{ $slot } }
Original file line number Diff line number Diff line change @@ -18,6 +18,10 @@ class Defer extends Component
1818
1919 public $ requestJson ;
2020
21+ public $ headers ;
22+
23+ public $ jsonHeaders ;
24+
2125 /**
2226 * Create a new component instance.
2327 *
@@ -32,6 +36,7 @@ public function __construct(
3236 public bool $ manual = false ,
3337 public string $ scope = '{ processing, response, reload } ' ,
3438 public string $ url = '' ,
39+ $ headers = null
3540 ) {
3641 $ parsed = $ this ->parseJsonData ($ default );
3742
@@ -54,6 +59,16 @@ public function __construct(
5459 if (!Str::startsWith ($ url , '` ' ) && !Str::endsWith ($ url , '` ' )) {
5560 $ this ->url = Js::from ($ url );
5661 }
62+
63+ //
64+
65+ $ parsed = $ this ->parseJsonData ($ headers );
66+
67+ if ($ parsed ) {
68+ $ this ->headers = $ parsed ;
69+ } else {
70+ $ this ->jsonHeaders = $ headers ?: '{} ' ;
71+ }
5772 }
5873
5974 /**
@@ -64,8 +79,10 @@ public function __construct(
6479 public function render ()
6580 {
6681 return view ('splade::functional.defer ' , [
67- 'data ' => $ this ->data ,
68- 'json ' => $ this ->json ,
82+ 'data ' => $ this ->data ,
83+ 'json ' => $ this ->json ,
84+ 'headers ' => $ this ->headers ,
85+ 'jsonHeaders ' => $ this ->jsonHeaders ,
6986 ]);
7087 }
7188}
You can’t perform that action at this time.
0 commit comments