This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function getService() | |
{ | |
// Creates and returns the Analytics service object. | |
// Load the Google API PHP Client Library. | |
require_once 'google-api-php-client/src/Google/autoload.php'; | |
// Create and configure a new client object. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If you don't care about IE | |
jsConfig.pageData = Object.assign({}, jsConfig.pageData, { [path]: data.page }) | |
// If you use Underscore.js | |
jsConfig.pageData = _.extend(jsConfig.pageData, { [path]: data.page }); | |
// If you use jQuery | |
jsConfig.pageData = jQuery.extend(true, jsConfig.pageData, { [path]: data.page }); | |
// Just JS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App; | |
use App\Model; | |
class User extends Model | |
{ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// File saved to app/Model.php | |
namespace App; | |
use Illuminate\Database\Eloquent\Model as BaseModel; | |
use App\Database\Query\Builder as QueryBuilder; | |
class Model extends BaseModel | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Unique key for the cache | |
$cacheKey = 'a-key-that-you-decide'; | |
$fan = Fan::find(1); | |
$fan->save([ | |
'first_name' => 'Stephen' | |
]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Unique key for the cache | |
$cacheKey = 'a-key-that-you-decide'; | |
$fan = Cache::get($cacheKey); | |
// If the cache doesn't exist get data and cache | |
if (is_null($fan)) { | |
$fan = Fan::find(1); | |
$expires = 84000; |