Reviewed-on: https://gitea.subcultureofone.org/greg/tkr/pulls/62 Co-authored-by: Greg Sarjeant <greg@subcultureofone.org> Co-committed-by: Greg Sarjeant <greg@subcultureofone.org>
		
			
				
	
	
		
			30 lines
		
	
	
		
			963 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			963 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| declare(strict_types=1);
 | |
| 
 | |
| class TickController extends Controller{
 | |
|     public function index(int $id){
 | |
|         global $app;
 | |
| 
 | |
|         Log::debug("Fetching tick with ID: {$id}");
 | |
| 
 | |
|         try {
 | |
|             $tickModel = new TickModel($app['db'], $app['settings']);
 | |
|             $vars = $tickModel->get($id);
 | |
| 
 | |
|             if (empty($vars) || !isset($vars['tick'])) {
 | |
|                 Log::warning("Tick not found for ID: {$id}");
 | |
|                 http_response_code(404);
 | |
|                 echo '<h1>404 - Tick Not Found</h1>';
 | |
|                 return;
 | |
|             }
 | |
| 
 | |
|             Log::info("Successfully loaded tick {$id}: " . substr($vars['tick'], 0, 50) . (strlen($vars['tick']) > 50 ? '...' : ''));
 | |
|             $this->render('tick.php', $vars);
 | |
| 
 | |
|         } catch (Exception $e) {
 | |
|             Log::error("Failed to load tick {$id}: " . $e->getMessage());
 | |
|             http_response_code(500);
 | |
|             echo '<h1>500 - Internal Server Error</h1>';
 | |
|         }
 | |
|     }
 | |
| } |