First, Lets find out what version of PHP we're running (To find out if it's the default version).
To do that, Within the terminal, Fire this command:
which php
| <?php | |
| $address = 'avenida+gustavo+paiva,maceio,alagoas,brasil'; | |
| $geocode = file_get_contents('http://maps.google.com/maps/api/geocode/json?address='.$address.'&sensor=false'); | |
| $output= json_decode($geocode); | |
| $lat = $output->results[0]->geometry->location->lat; | |
| $long = $output->results[0]->geometry->location->lng; |
| <?php | |
| $file = '/path/to/file.png'; | |
| $filename = basename($file); | |
| $upload_file = wp_upload_bits($filename, null, file_get_contents($file)); | |
| if (!$upload_file['error']) { | |
| $wp_filetype = wp_check_filetype($filename, null ); | |
| $attachment = array( | |
| 'post_mime_type' => $wp_filetype['type'], | |
| 'post_parent' => $parent_post_id, |
| <?php | |
| /** | |
| * All custom functions should be defined in this class | |
| * and tied to WP hooks/filters w/in the constructor method | |
| */ | |
| class Custom_Functions { | |
| // Custom metaboxes and fields configuration |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Wheel of Fortune Bingo</title> | |
| <!-- | |
| MIT License |
| <?php | |
| //edit with your data | |
| $repo_dir = '~/repository.git'; | |
| $web_root_dir = '~/project'; | |
| $post_script = '~/project/scripts/post_deploy.sh'; | |
| $onbranch = 'master'; | |
| // A simple php script for deploy using bitbucket webhook | |
| // Remember to use the correct user:group permisions and ssh keys for apache user!! | |
| // Dirs used here must exists on server and have owner permisions to www-data |
| <?php | |
| add_action( 'gform_after_submission', 'braums_after_submission', 10, 2 ); | |
| function braums_after_submission( $entry, $form ) { | |
| ?> | |
| <script> | |
| function braums_datalayer_push() { | |
| var form_submission = sessionStorage.getItem('entry_<?php echo absint( $entry[ 'id' ] ); ?>'); | |
| if ( null == form_submission ) { | |
| if ( typeof( dataLayer ) != 'undefined' ) { | |
| dataLayer.push({'event': 'BWTrackEvent', |
Laravel - Eloquent - query many to many relationship
Example:
Table 1: posts
Table 2: categories
Pivot Table: category_post with foreign keys category_id, post_id