1: <?php
2:
3: 4: 5: 6: 7: 8:
9:
10: namespace rsanchez\Deep\Model;
11:
12: use Illuminate\Database\Eloquent\Model;
13: use Illuminate\Database\Eloquent\Builder;
14: use rsanchez\Deep\Model\Entry;
15:
16: 17: 18: 19: 20:
21: class PlayaEntry extends Entry
22: {
23: 24: 25:
26: protected $hidden = array('channel', 'site_id', 'forum_topic_id', 'ip_address', 'versioning_enabled', 'parent_entry_id', 'parent_field_id', 'parent_col_id', 'parent_row_id', 'parent_var_id', 'parent_is_draft', 'child_entry_id', 'rel_order', 'rel_id');
27:
28: 29: 30:
31: protected $collectionClass = '\\rsanchez\\Deep\\Collection\\PlayaCollection';
32:
33: 34: 35:
36: protected static function joinTables()
37: {
38: return array_merge(parent::joinTables(), array(
39: 'playa_relationships' => function ($query) {
40: $query->join('playa_relationships', 'playa_relationships.child_entry_id', '=', 'channel_titles.entry_id');
41: },
42: ));
43: }
44:
45: 46: 47: 48: 49: 50: 51:
52: public function scopeParentEntryId(Builder $query, $entryId)
53: {
54: $entryId = is_array($entryId) ? $entryId : array($entryId);
55:
56: return $this->requireTable($query, 'playa_relationships', true)->whereIn('playa_relationships.parent_entry_id', $entryId);
57: }
58: }
59: