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 ($errors->any()) | |
| <div class="alert alert-danger"> | |
| <button type="button" class="close" data-dismiss="alert">×</button> | |
| <strong>Por favor corrige los siguentes errores:</strong> | |
| <ul> | |
| @foreach ($errors->all() as $error) | |
| <li>{{ $error }}</li> | |
| @endforeach | |
| </ul> | |
| </div> |
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 | |
| /** | |
| * Metodo getDiasHabiles | |
| * | |
| * Permite devolver un arreglo con los dias habiles | |
| * entre el rango de fechas dado excluyendo los | |
| * dias feriados dados (Si existen) | |
| * | |
| * @param string $fechainicio Fecha de inicio en formato Y-m-d | |
| * @param string $fechafin Fecha de fin en formato Y-m-d |
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
| SELECT id, nombre, (6371 * ACOS( | |
| SIN(RADIANS(lat)) * SIN(RADIANS(4.6665578)) | |
| + COS(RADIANS(lng - -74.0524521)) * COS(RADIANS(lat)) | |
| * COS(RADIANS(4.6665578)) | |
| ) | |
| ) AS distance | |
| FROM direcciones | |
| HAVING distance < 1 /* 1 KM a la redonda */ | |
| ORDER BY distance ASC |
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
| SET @center = GeomFromText('POINT(20 20)'); | |
| SET @radius = 30; | |
| SET @bbox = CONCAT('POLYGON((', | |
| X(@center) - @radius, ' ', Y(@center) - @radius, ',', | |
| X(@center) + @radius, ' ', Y(@center) - @radius, ',', | |
| X(@center) + @radius, ' ', Y(@center) + @radius, ',', | |
| X(@center) - @radius, ' ', Y(@center) + @radius, ',', | |
| X(@center) - @radius, ' ', Y(@center) - @radius, '))' | |
| ); | |
| SELECT name, AsText(location), SQRT(POW( ABS( X(location) - X(@center)), 2) + POW( ABS(Y(location) - Y(@center)), 2 )) AS distance |
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 | |
| static public function slugify($text) | |
| { | |
| // replace non letter or digits by - | |
| $text = preg_replace('~[^\\pL\d]+~u', '-', $text); | |
| // trim | |
| $text = trim($text, '-'); | |
| // transliterate |
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 | |
| /* | |
| |-------------------------------------------------------------------------- | |
| | Cache route filter | |
| |-------------------------------------------------------------------------- | |
| | | |
| | This filter must be called 'before' and 'after' any of the front-end | |
| | pages are loaded. | |
| | Before the page is loaded, we return a cached version of the page, if |
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
| Route::filter('cache', function($route, $request, $response = null) | |
| { | |
| $key = 'route-'.Str::slug(Request::url()); | |
| if(is_null($response) && Cache::has($key)) | |
| { | |
| return Cache::get($key); | |
| } | |
| elseif(!is_null($response) && !Cache::has($key)) | |
| { | |
| Cache::put($key, $response->getContent(), 30); |
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
| // Model | |
| class Client extends Eloquent | |
| { | |
| protected $connection = 'masterDb'; | |
| } | |
| // config/database.php | |
| 'masterDb' => array( | |
| 'driver' => 'mysql', |
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
| ugust 23rd 2013 | |
| USING LARAVEL 4′S MODEL EVENTS TO CASCADE DELETION | |
| Cascading deletion in Laravel 4 can be accomplished setting up FOREIGN KEY‘s and adding an ->onDelete('cascade') in your Schema. | |
| Read on for an alternative way to cascade a deletion using Events. | |
| Assume you have a Model called Author which has many Books. |
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
| git clone git://github.com/phalcon/cphalcon.git | |
| cd cphalcon/build/64bits | |
| make clean | |
| phpize --clean | |
| /usr/local/php/bin/ | |
| ./configure --with-php-config=/usr/local/php/bin/php-config | |
| make && sudo make install |