PHP code example of bnussbau / laravel-trmnl

1. Go to this page and download the library: Download bnussbau/laravel-trmnl library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bnussbau / laravel-trmnl example snippets


UpdateScreenContentJob::dispatchSync([
    'key' => 'value',
    // ... other variables
]);

UpdateScreenContentJob::dispatchSync(
    Journey::whereNotIn('track', [1, 2])
        ->whereBetween('timestamp_planned', [now()->setTimezone('Europe/Vienna')
            ->addMinutes(15), now()->setTimezone('Europe/Vienna')->addHours(2)])
        ->paginate(8)
        ->toArray()
);

Route::post('/render', function () {

    // validate Authorization
    if (! Auth::guard('trmnl')->validate()) {
        return response()->json(['error' => 'Unauthorized'], 401);
    }

    return response()->json(
        Trmnl::renderScreen(
            'trmnl.full',
            'trmnl.half_horizontal',
            'trmnl.half_vertical',
            'trmnl.quadrant'
        )
    );
})->name('trmnl.render');
// make sure to not verify CSRF Token for this route
// ->withoutMiddleware([Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class])
bash
php artisan vendor:publish --tag="trmnl-config"
bash
php artisan vendor:publish --tag="trmnl-views"
bash
php artisan vendor:publish --tag="trmnl-migrations"
php artisan migrate