Overview

Namespaces

  • rsanchez
    • Deep
      • App
        • EE
        • Laravel
          • Facade
      • Collection
      • Hydrator
      • Model
      • Plugin
      • Relations
      • Repository

Classes

  • AbstractEntity
  • AbstractField
  • AbstractProperty
  • Asset
  • Category
  • CategoryField
  • CategoryPosts
  • Channel
  • Comment
  • Entry
  • Field
  • Fieldtype
  • File
  • GridCol
  • GridRow
  • JoinableScope
  • MatrixCol
  • MatrixRow
  • Member
  • MemberField
  • PlayaEntry
  • RelationshipEntry
  • Site
  • Title
  • UploadPref

Interfaces

  • FileInterface

Traits

  • GlobalAttributeVisibilityTrait
  • JoinableTrait
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: 
 3: /**
 4:  * Deep
 5:  *
 6:  * @package      rsanchez\Deep
 7:  * @author       Rob Sanchez <info@robsanchez.com>
 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:  * {@inheritdoc}
18:  *
19:  * Joins with playa_relationships table
20:  */
21: class PlayaEntry extends Entry
22: {
23:     /**
24:      * {@inheritdoc}
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:      * {@inheritdoc}
30:      */
31:     protected $collectionClass = '\\rsanchez\\Deep\\Collection\\PlayaCollection';
32: 
33:     /**
34:      * {@inheritdoc}
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:      * Filter by Parent Entry ID
47:      *
48:      * @param  \Illuminate\Database\Eloquent\Builder $query
49:      * @param  int|array                             $entryId
50:      * @return \Illuminate\Database\Eloquent\Builder
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: 
API documentation generated by ApiGen 2.8.0