get('story.json').then(function(response) {
return JSON.parse(response);
}).then(function(response) {
console.log("Yey JSON!", response);
});
But, Since JSON.parse takes a single argument and returns a transformed value, we can make a shortcut:
get('story.json').then(function(response) {
return JSON.parse(response);
}).then(function(response) {
console.log("Yey JSON!", response);
});
But, Since JSON.parse takes a single argument and returns a transformed value, we can make a shortcut:
<?php | |
# turn on admin routing | |
Router::prefix('admin', function ($routes) { | |
$routes->connect('/', ['controller'=>'Pages', 'action'=>'dashboard']); | |
$routes->fallbacks('InflectedRoute'); | |
}); | |
# tell Cake that /admin (which is NOT a prefix, it's a 'page' in the main route set) into our prefix | |
# /admin/* is a prefix, /admin is a page on the main (non-prefixed) site | |
Router::connect('/admin', ['prefix'=>'admin']); |
<? | |
/** | |
* Custom finder method to only return items that are considered 'available' | |
* An item is available if it is 'visible' and it's quantity on hand is greater than 0 | |
* @param Cake\ORM\Query $query | |
* @param array $options | |
* @return Cake\ORM\Query | |
*/ | |
public function findAvailable(Query $query, array $options){ | |
return $query->find('visible')->where(["{$this->_table->alias()}.quantity_on_hand >=" => 1]); |
<?php | |
public function resetPassword($code = null){ | |
if(empty($code)): | |
throw new NotFoundException; | |
endif; | |
// Recupero l'utente ha cui è associato il codice di autorizzazione | |
$user = $this->Users | |
->find() |
<?php | |
// code ... | |
#change base on environment (e.g. 'DEV', 'UAT', 'PROD') | |
Configure::write('activeEnvironment', 'DEV'); | |
// code ... |