Blame view
app/Queries/PreviewQuery.php
1.37 KB
e77200db5 Initial commit |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
<?php namespace FootyRoom\Queries; use Illuminate\Database\Connection; use FootyRoom\Support\MongoClient; class PreviewQuery { /** * @var \FootyRoom\Support\MongoClient */ protected $mongo; /** * @var \Illuminate\Database\Connection */ protected $mysql; /** * Constructor. * * @param FootyRoom\Support\MongoClient $mongo * @param \Illuminate\Database\Connection $mysql */ public function __construct(MongoClient $mongo, Connection $mysql) { $this->mongo = $mongo->footyroom; $this->mysql = $mysql; } /** * Finds one preview by matchId. * * @param int $matchId * * @return object */ public function findOneByMatchId($matchId) { return $this->mongo->previews->findOne(['mysqlMatchId' => $matchId]); } /** * Finds preview post by match id. * * @param int $matchId * * @return object */ // public function findPostByMatchId($matchId) // { // return $this->mysql // ->table('wp_posts as p') // ->select('p.post_title') // ->join('wp_postmeta as pm', 'pm.post_id', '=', 'p.ID') // ->where('p.post_status', '=', 'publish') // ->where('pm.meta_key', '=', 'match_id_preview') // ->where('pm.meta_value', '=', (string) $matchId) // ->first(); // } } |