> For the complete documentation index, see [llms.txt](https://idt-nida.gitbook.io/developer-guideline/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://idt-nida.gitbook.io/developer-guideline/laravel/template/template-system-check-in-route-on-laravel.md).

# Template System Check in Route on Laravel

```php
<?php

use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Config;

Route::prefix('check')->group(function () {

    // Route to check PHP info
    Route::get('/phpinfo', function () {
        phpinfo();
    });

    // Route to check Laravel version
    Route::get('/version', function () {
        return app()->version();
    });

    // Route to check database connection
    Route::get('/database', function () {
        try {
            DB::connection()->getPdo();
            return 'Database connection is successful!';
        } catch (\Exception $e) {
            return 'Could not connect to the database. Please check your configuration.';
        }
    });

    // Route to check public path
    Route::get('/public', function () {
        return public_path();
    });

    // Route to check date and time
    Route::get('/time', function () {
        return now();
    });

    // Route to check session locale
    Route::get('/session', function () {
        return Session::get('locale', 'No locale set in session');
    });

    // Route to flush all session data
    Route::get('/flush-session', function () {
        Session::flush();
        return 'All session data has been flushed.';
    });

    // Route to check cache driver
    Route::get('/cache', function () {
        return config('cache.default');
    });

    // Route to check storage path
    Route::get('/storage', function () {
        return Storage::path('/');
    });

    // Route to check log file path
    Route::get('/log-path', function () {
        return storage_path('logs/laravel.log');
    });

    // Route to check environment
    Route::get('/environment', function () {
        return app()->environment();
    });

    // Route to check debug mode status
    Route::get('/debug', function () {
        return config('app.debug') ? 'Debug mode is ON' : 'Debug mode is OFF';
    });

    // Route to check config cache status
    Route::get('/config-cache', function () {
        return Cache::has('config') ? 'Config is cached' : 'Config is not cached';
    });

    // Route to check route cache status
    Route::get('/route-cache', function () {
        return Cache::has('routes') ? 'Routes are cached' : 'Routes are not cached';
    });

    // Route to check if storage is writable
    Route::get('/storage-writable', function () {
        return is_writable(storage_path()) ? 'Storage is writable' : 'Storage is not writable';
    });

    // Route to check if app key is set
    Route::get('/app-key', function () {
        return config('app.key') ? 'App key is set' : 'App key is not set';
    });
});
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://idt-nida.gitbook.io/developer-guideline/laravel/template/template-system-check-in-route-on-laravel.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
