35 lines
		
	
	
		
			772 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			772 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace app\modules\slider\controllers;
 | |
| 
 | |
| use app\modules\slider\models\Slider;
 | |
| use Exception;
 | |
| use kernel\AdminController;
 | |
| 
 | |
| class SliderController extends AdminController
 | |
| {
 | |
|     protected function init(): void
 | |
|     {
 | |
|         parent::init();
 | |
|         $this->cgView->viewPath = KERNEL_APP_MODULES_DIR . "/photo/views/";
 | |
|     }
 | |
| 
 | |
| 
 | |
|     public function actionIndex($page_number = 1): void
 | |
|     {
 | |
|         $this->cgView->render("index.php", ['page_number' => $page_number]);
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * @throws Exception
 | |
|      */
 | |
|     public function actionView($id): void
 | |
|     {
 | |
|         $slide = Slider::find($id);
 | |
| 
 | |
|         if (!$slide){
 | |
|             throw new Exception(message: "The slide not found");
 | |
|         }
 | |
|         $this->cgView->render("view.php", ['slider' => $slide]);
 | |
|     }
 | |
| } |