- In your model, add these methods :
public function nextid()
{
// ref is the counter - change it to whatever you want to increment
$this->ref = self::getID();
}
public static function bootUseAutoIncrementID()| /* | |
| * Copyright (c) 2013 Mike King (@micjamking) | |
| * | |
| * jQuery Succinct plugin | |
| * Version 1.0.1 (July 2013) | |
| * | |
| * Licensed under the MIT License | |
| */ | |
| /*global jQuery*/ |
| <?php | |
| namespace App\Traits; | |
| trait UseAutoIncrementID { | |
| /** | |
| * Increment the counter and get the next sequence | |
| * | |
| * @param $collection |
| #!/bin/bash | |
| find . -name "*.php" -exec grep "base64" '{}' \; -print &> b64-detections.txt | |
| find . -name "*.php" -exec grep "eval" '{}' \; -print &> eval-detections.txt |
| add_filter( 'post_type_link', 'my_post_type_link', 10, 3); | |
| function my_post_type_link($permalink, $post, $leavename) { | |
| if ($post->post_type == 'my-post-type') { | |
| $meta = get_post_meta($post->ID, '_my-post-meta', true); | |
| if (isset($meta) && !empty($meta)) | |
| $permalink = home_url( "my-friendly-url/" . $meta . "/" . $post->post_name . "/"); | |
| } | |
| return $permalink; |
public function nextid()
{
// ref is the counter - change it to whatever you want to increment
$this->ref = self::getID();
}
public static function bootUseAutoIncrementID()The Laracasts PHPStorm theme.
https://www.dropbox.com/s/f4l3qc2falnvq61/laracasts_theme_updated.icls
(Add to ~/Library/Preferences/WebIde80/colors on Mac.)
| <?php | |
| // Based on <https://github.com/mecha-cms/x.minify> | |
| namespace x\minify\_ { // start namespace | |
| $n = __NAMESPACE__; | |
| \define($n . "\\token_boolean", '\b(?:true|false)\b'); | |
| \define($n . "\\token_number", '-?(?:(?:\d+)?\.)?\d+'); |
#Laravel 5 Simple ACL manager
Protect your routes with user roles. Simply add a 'role_id' to the User model, install the roles table and seed if you need some example roles to get going.
If the user has a 'Root' role, then they can perform any actions.
Simply copy the files across into the appropriate directories, and register the middleware in App\Http\Kernel.php
| sudo apt-get install -y php-pear php5-dev | |
| sudo pecl install mongo | |
| sudo sh -c "echo 'extension=mongo.so' > /etc/php5/mods-available/mongo.ini" | |
| sudo ln -s /etc/php5/mods-available/mongo.ini /etc/php5/apache2/conf.d/mongo.ini | |
| sudo service apache2 restart |
| proration cost = (period end - API request time) / (period end - period start) * quantity * plan price |