PluginProbe
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments / 4.2.2
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments v4.2.2
4.7.2 4.7.1 4.7.0 4.6.6 4.6.5 4.6.4 4.6.3 4.6.2 4.6.1 4.6.0 4.5.1 4.5.0 4.4.2 4.4.1 4.4.0 4.3.3 4.3.2 4.3.1 4.3.0 4.2.3 4.2.2 4.2.1 1.0.3 1.0.4 1.0.5 All 281 releases
surecart / app / src / Middleware / PurchaseRedirectMiddleware.php
PurchaseRedirectMiddleware.php
39 lines 767 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace SureCart\Middleware;
4
5 use Closure;
6 use SureCartCore\Requests\RequestInterface;
7 use SureCartCore\Responses\RedirectResponse;
8
9 /**
10 * Middleware for handling model archiving.
11 */
12 class PurchaseRedirectMiddleware {
13 /**
14 * Enqueue component assets.
15 *
16 * @param RequestInterface $request Request.
17 * @param Closure $next Next.
18 * @return function
19 */
20 public function handle( RequestInterface $request, Closure $next ) {
21 $id = $request->query( 'purchase_id' );
22
23 if ( $id ) {
24 return ( new RedirectResponse( $request ) )->to(
25 add_query_arg(
26 [
27 'action' => 'show',
28 'model' => 'download',
29 'id' => $id,
30 ],
31 \SureCart::pages()->url( 'dashboard' )
32 )
33 );
34 }
35
36 return $next( $request );
37 }
38 }
39