Skip to content

Instantly share code, notes, and snippets.

@web-hat
Created March 27, 2017 18:20
Show Gist options
  • Save web-hat/ee947d290d26baee0d3a0de87ae33359 to your computer and use it in GitHub Desktop.
Save web-hat/ee947d290d26baee0d3a0de87ae33359 to your computer and use it in GitHub Desktop.
Accessing WordPress Post through Laravel
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class BlogPostmeta extends Model {
protected $connection = 'wordpress_db_connection';
protected $table = 'postmeta';
protected $primaryKey = 'meta_id';
/**
* Get the postmeta for the blog post.
*/
public function post() {
return $this->belongsTo('App\BlogPost');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment