PHP code example of spinen / laravel-browser-filter
1. Go to this page and download the library: Download spinen/laravel-browser-filter 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/ */
// This is only a simple example. You would probably want to route to a controller with a view.
Route::get('incompatible_browser', ['as' => 'incompatible_browser', 'uses' => function() {
return "You are using a blocked browser.";
}]);
Route::get('tablet_page', [
'middleware' => 'browser.allow:Tablet',
'uses' => function () {
return "Special page that is only accessible to tablets";
}
]);
Route::get('ie_is_blocked_page', [
'middleware' => 'browser.block:Other/Ie',
'uses' => function () {
return "Special page that is only accessible to non IE browsers on Desktops";
}
]);