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
| <label for="country">Country</label><span style="color: red !important; display: inline; float: none;">*</span> | |
| <select id="country" name="country" class="form-control"> | |
| <option value="Afganistán">Afganistán</option> | |
| <option value="Åland Islands">Åland Islands</option> | |
| <option value="Albania">Albania</option> | |
| <option value="Argelia">Argelia</option> | |
| <option value="Samoa Americana">Samoa Americana</option> | |
| <option value="Andorra">Andorra</option> | |
| <option value="Angola">Angola</option> |
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::get('roles', function(){ | |
| \HttpOz\Roles\Models\Role::create([ | |
| 'name' => 'Admin', | |
| 'slug' => 'admin', | |
| 'description' => 'Custodians of the system.' | |
| ]); | |
| \HttpOz\Roles\Models\Role::create([ | |
| 'name' => 'Dealer', | |
| 'slug' => 'dealer', |
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 | |
| #twitter cards hack | |
| if(is_single() || is_page()) { | |
| $twitter_url = get_permalink(); | |
| $twitter_title = get_the_title(); | |
| $twitter_desc = get_the_excerpt(); | |
| $twitter_thumbs = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), full ); | |
| $twitter_thumb = $twitter_thumbs[0]; | |
| if(!$twitter_thumb) { | |
| $twitter_thumb = 'http://www.gravatar.com/avatar/8eb9ee80d39f13cbbad56da88ef3a6ee?rating=PG&size=75'; |
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
| Using a library as Laravel-Date you will just need to set the language of the app in the Laravel app config file and use its functions to format the date as you want. | |
| Set the language in /app/config/app.php | |
| ... | |
| 'locale' => 'es', | |
| ... | |
| I've found this library pretty useful and clean. To use it, you can write something like the example in the library readme file. I leave the results in spanish. | |
| ... | |
| echo Date::now()->format('l j F Y H:i:s'); // domingo 28 abril 2013 21:58:16 | |
| echo Date::parse('-1 day')->diffForHumans(); // 1 día atrás |
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
| Metes la data en un array $data | |
| $data = array( | |
| 'name'=>$contactName, | |
| 'email'=>$contactEmail, | |
| 'message'=>$contactMessage | |
| ); | |
| En tu plantilla "view" podras usar estas variables |
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
| Según lo que dice este post https://github.com/laravel/framework/issues/213 | |
| Si estas obteniendo el siguiente error | |
| FatalErrorException: Error: Call to undefined method | |
| Illuminate\Database\Eloquent\Collection::paginate() | |
| El error se da por querer usar ::all()->paginate(15); la idea es usar por ejemplo si estamos leyendo la tabla users: | |
| User::paginate(15); | |
| Lo que si es aceptable es meter condiciones a la busqueda, como esto: |
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
| function allow_my_post_types($allowed_post_types) { | |
| $allowed_post_types[] = 'my_post_type'; | |
| return $allowed_post_types; | |
| } | |
| add_filter( 'rest_api_allowed_post_types', 'allow_my_post_types'); |