Scripts
3 years ago
SubscriptionScriptsController.php
3 years ago
SubscriptionsController.php
3 years ago
SubscriptionsListTable.php
3 years ago
SubscriptionsController.php
58 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SureCart\Controllers\Admin\Subscriptions; |
| 4 | |
| 5 | use SureCart\Controllers\Admin\AdminController; |
| 6 | use SureCart\Controllers\Admin\Subscriptions\SubscriptionsListTable; |
| 7 | use SureCart\Controllers\Admin\Subscriptions\Scripts\EditScriptsController; |
| 8 | use SureCart\Controllers\Admin\Subscriptions\Scripts\ShowScriptsController; |
| 9 | |
| 10 | /** |
| 11 | * Handles product admin requests. |
| 12 | */ |
| 13 | class SubscriptionsController extends AdminController { |
| 14 | /** |
| 15 | * Orders index. |
| 16 | */ |
| 17 | public function index() { |
| 18 | $table = new SubscriptionsListTable(); |
| 19 | $table->prepare_items(); |
| 20 | $this->withHeader( |
| 21 | [ |
| 22 | 'subscriptions' => [ |
| 23 | 'title' => __( 'Subscriptions', 'surecart' ), |
| 24 | ], |
| 25 | ] |
| 26 | ); |
| 27 | return \SureCart::view( 'admin/subscriptions/index' )->with( |
| 28 | [ |
| 29 | 'table' => $table, |
| 30 | ] |
| 31 | ); |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Edit |
| 36 | * |
| 37 | * @return string |
| 38 | */ |
| 39 | public function edit() { |
| 40 | // enqueue needed script. |
| 41 | add_action( 'admin_enqueue_scripts', \SureCart::closure()->method( EditScriptsController::class, 'enqueue' ) ); |
| 42 | // return view. |
| 43 | return '<div id="app"></div>'; |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Show |
| 48 | * |
| 49 | * @return string |
| 50 | */ |
| 51 | public function show() { |
| 52 | // enqueue needed script. |
| 53 | add_action( 'admin_enqueue_scripts', \SureCart::closure()->method( ShowScriptsController::class, 'enqueue' ) ); |
| 54 | // return view. |
| 55 | return '<div id="app"></div>'; |
| 56 | } |
| 57 | } |
| 58 |