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 | |
// whitelist columns to filter by | |
$filterable = array( | |
'colour', | |
'size', | |
'price' | |
); | |
// build up string for WHERE clause | |
$where = array(); |
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 | |
abstract class Adapter | |
{ | |
protected $config; | |
protected $connection; | |
public function __construct($config) | |
{ | |
$this->config = $config; | |
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 Condition | |
{ | |
protected $field; | |
protected $comparator; | |
protected $value; | |
const EQUALS = '='; | |
const GREATER_THAN = '>'; | |
const LESS_THAN = '<'; |
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
{ | |
"vars": { | |
"@gray-darker": "lighten(#000, 13.5%)", | |
"@gray-dark": "lighten(#000, 20%)", | |
"@gray": "lighten(#000, 33.5%)", | |
"@gray-light": "lighten(#000, 46.7%)", | |
"@gray-lighter": "lighten(#000, 93.5%)", | |
"@brand-primary": "#c00", | |
"@brand-success": "#5cb85c", | |
"@brand-info": "#5bc0de", |
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 | |
trait ValidatorTrait { | |
protected $validator; | |
public function isValid() | |
{ | |
return $this->getValidator()->passes(); | |
} |
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 App\Services; | |
use App\Contracts\UserRepository; | |
use App\User; | |
use Illuminate\Contracts\Auth\Registrar as RegistrarContract; | |
use Illuminate\Contracts\Hashing\Hasher as HasherContract; | |
use Illuminate\Contracts\Validation\Factory as ValidationFactory; | |
use Illuminate\Contracts\Validation\Validator; | |
class Registrar implements RegistrarContract { |
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
// Submit a form via AJAX and return the request object | |
$.fn.ajaxSubmit = function (options) { | |
var settings = $.extend({ | |
submittingText: 'Submitting...' | |
}, options); | |
var form = $(this); | |
var url = form.attr('action'); | |
var data = form.serialize(); | |
var type = form.attr('method'); | |
var submitButton = form.find('[type="submit"]'); |
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 App\Http\Middleware; | |
use Closure; | |
use Illuminate\Http\Request; | |
class Administrator | |
{ | |
/** |
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
(function ($) { | |
$.fn.confirmUnload = function (options) { | |
var settings = $.extend({ | |
message: 'You have unsaved changes.' | |
}, options); | |
return this.filter('form').each(function () { | |
var form = $(this); | |
var dataOnLoad = form.serialize(); |
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 | |
// Definition | |
Validator::extend('hash_matches', function ($attribute, $value, $parameters) { | |
return Hash::check($value, $parameters[0]); | |
}); | |
// Usage | |
'old_password' => 'required|hash_matches:'.$old_password, |