1 | <?php |
||
14 | class BelongsToMorph extends BelongsTo |
||
15 | { |
||
16 | /** |
||
17 | * The name of the polymorphic relation. |
||
18 | * |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $morphName; |
||
22 | |||
23 | /** |
||
24 | * The type of the polymorphic relation. |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $morphType; |
||
29 | |||
30 | /** |
||
31 | * Create a new belongs to relationship instance. |
||
32 | * |
||
33 | * @param \Illuminate\Database\Eloquent\Builder $query |
||
34 | * @param \Illuminate\Database\Eloquent\Model $parent |
||
35 | * @param string $name |
||
36 | * @param string $type |
||
37 | * @param string $foreignKey |
||
38 | * @param string $ownerKey |
||
39 | * @param string $relation |
||
40 | * @return void |
||
|
|||
41 | */ |
||
42 | public function __construct(Builder $query, Model $parent, $name, $type, $foreignKey, $ownerKey, $relation) |
||
49 | |||
50 | /** |
||
51 | * Add the constraints for a relationship query. |
||
52 | * |
||
53 | * @param \Illuminate\Database\Eloquent\Builder $query |
||
54 | * @param \Illuminate\Database\Eloquent\Builder $parent |
||
55 | * @param array|mixed $columns |
||
56 | * |
||
57 | * @return \Illuminate\Database\Eloquent\Builder |
||
58 | */ |
||
59 | public function getRelationQuery(Builder $query, Builder $parent, $columns = ['*']) |
||
66 | |||
67 | /** |
||
68 | * Get the results of the relationship. |
||
69 | * |
||
70 | * @return mixed |
||
71 | */ |
||
72 | public function getResults() |
||
80 | |||
81 | /** |
||
82 | * Get the polymorphic relationship columns. |
||
83 | * |
||
84 | * @param string $name |
||
85 | * @param string $type |
||
86 | * @param string $id |
||
87 | * |
||
88 | * @return array |
||
89 | */ |
||
90 | protected static function getMorphs($name, $type, $id) |
||
98 | |||
99 | /** |
||
100 | * Define an inverse morph relationship. |
||
101 | * |
||
102 | * @param Model $parent |
||
103 | * @param string $related |
||
104 | * @param string $name |
||
105 | * @param string $type |
||
106 | * @param string $id |
||
107 | * @param string $otherKey |
||
108 | * @param string $relation |
||
109 | * |
||
110 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
111 | */ |
||
112 | public static function build(Model $parent, $related, $name, $type = null, $id = null, $otherKey = null, $relation = null) |
||
138 | } |
||
139 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.