PHP code example of dartmoon / laravel-route-helpers
1. Go to this page and download the library: Download dartmoon/laravel-route-helpers 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/ */
dartmoon / laravel-route-helpers example snippets
Route::when($condition, function () {
Route::get('/registered/only/when/condition/is/true', fn () => 'Hello World');
});
Route::when(app()->getLocale() == 'en', function () {
Route::get('about', fn () => 'English');
});
Route::when(app()->getLocale() == 'it', function () {
Route::get('about', fn () => 'Italiano');
});