Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions App/Config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
use Cake\Error\ErrorHandler;
use Cake\Log\Log;
use Cake\Network\Email\Email;
use Cake\Network\Request;
use Cake\Utility\Inflector;

/**
Expand Down Expand Up @@ -126,6 +127,17 @@
Email::config(Configure::consume('Email'));
Log::config(Configure::consume('Log'));

/**
* Setup detectors for mobile and tablet.
*/
Request::addDetector('mobile', function($request) {
return (new \Detection\MobileDetect())->isMobile();
});

Request::addDetector('tablet', function($request) {
return (new \Detection\MobileDetect())->isTablet();
});

/**
* Custom Inflector rules, can be set to correctly pluralize or singularize table, model, controller names or whatever other
* string is passed to the inflection functions
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
"type": "project",
"license": "MIT",
"require": {
"php": ">=5.4",
"cakephp/cakephp": "3.0.*-dev",
"php": ">=5.4"
"mobiledetect/mobiledetectlib": "2.*"
},
"require-dev": {
"d11wtq/boris": "1.0.*"
Expand Down