This file contains 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 | |
use Eloquence\Behaviours\CountCache\CountedBy; | |
use Eloquence\Behaviours\CountCache\HasCounts; | |
use Illuminate\Database\Eloquent\Model; | |
class Post extends Model { | |
use HasCounts; | |
#[CountedBy] |
This file contains 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
class XSSProtection | |
{ | |
/** | |
* The following method loops through all request input and strips out all tags from | |
* the request. This to ensure that users are unable to set ANY HTML within the form | |
* submissions, but also cleans up input. | |
* | |
* @param Request $request | |
* @param callable $next | |
* @return mixed |
This file contains 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
import Unauthorised from './Unauthorised' | |
export default function() { | |
return { | |
response: function(response) { | |
switch (response.status) { | |
case 401: return Unauthorised.handle(); | |
} | |
return response; |
This file contains 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 | |
'cloud' => env('FILESYSTEM_CLOUD', 'do'), | |
.. | |
'do' => [ | |
'driver' => 's3', | |
'key' => env('DO_ACCESS_KEY_ID'), | |
'secret' => env('DO_SECRET_ACCESS_KEY'), |
This file contains 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 | |
class Player | |
{ | |
public function upgrade(Building $building) | |
{ | |
if (!$this->canAfford($building)) { | |
throw new DamnImBroke; | |
} | |
$this->deduct($building->upgradeCosts()); |
This file contains 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 | |
// In model: Ensures values are consistent | |
class User extends Eloquent { | |
public function setEmailAttribute(Email $email) { | |
$this->attributes['email'] = $email; | |
} | |
} | |
// Value object | |
class Email { |
This file contains 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 IronSteel\Construction; | |
use IronSteel\Library\Uuid; | |
class BuildingId extends Uuid | |
{ | |
} |
This file contains 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
/** | |
* Paginator | |
* | |
* The paginator can be used within any controller to easily set up | |
* some pagination options, including number of pages, page navigation | |
* and more. It is built to work with Laravel's own pagination library, | |
* which returns data in a particular format. | |
* | |
* Usage: | |
* Before you can use paginator, make sure you specify the URLs to your pagination |
This file contains 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
// parent | |
<template> | |
<header class="content-header"> | |
<h1 class="h2 first">Track workout</h1> | |
</header> | |
<div> | |
<ul class="exercises"> | |
<li class="exercise" v-for="exercise in exercises" track-by="$index" transition="item"> | |
<div class="col-sm-6 col-xs-12 selector"> | |
<button class="btn btn-default" v-on:click="selectExercise()">Select exercise</button> |
This file contains 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
/** | |
* Typeahead directive for fields. Expects both a typeahead and location attribute. | |
* | |
* @param string typeahead - If a value is provided, this should be a two-way data binding to the model that you would like to utilize in partnership with this plugin. | |
* @param string location - Where the data can be found for remote queries. | |
*/ | |
module.directive( 'typeahead', [ '$window', '$timeout', function( $window, $timeout ) { | |
return { | |
restrict: 'A', | |
scope: { model: '=typeahead', value: '@' }, |
NewerOlder