1 | <?php |
||
12 | class BelongsToMorph extends BelongsTo |
||
13 | { |
||
14 | /** |
||
15 | * The name of the polymorphic relation. |
||
16 | * |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $morphName; |
||
20 | |||
21 | /** |
||
22 | * The type of the polymorphic relation. |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $morphType; |
||
27 | |||
28 | /** |
||
29 | * Create a new belongs to relationship instance. |
||
30 | * |
||
31 | * @param \Illuminate\Database\Eloquent\Builder $query |
||
32 | * @param \Illuminate\Database\Eloquent\Model $parent |
||
33 | * @param string $name |
||
34 | * @param string $type |
||
35 | * @param string $foreignKey |
||
36 | * @param string $ownerKey |
||
37 | * @param string $relation |
||
38 | * |
||
39 | * @return void |
||
|
|||
40 | */ |
||
41 | public function __construct(Builder $query, Model $parent, $name, $type, $foreignKey, $ownerKey, $relation) |
||
48 | |||
49 | /** |
||
50 | * Add the constraints for a relationship query. |
||
51 | * |
||
52 | * @param \Illuminate\Database\Eloquent\Builder $query |
||
53 | * @param \Illuminate\Database\Eloquent\Builder $parent |
||
54 | * @param array|mixed $columns |
||
55 | * |
||
56 | * @return \Illuminate\Database\Eloquent\Builder |
||
57 | */ |
||
58 | public function getRelationQuery(Builder $query, Builder $parent, $columns = ['*']) |
||
65 | |||
66 | /** |
||
67 | * Get the results of the relationship. |
||
68 | * |
||
69 | * @return mixed |
||
70 | */ |
||
71 | public function getResults() |
||
77 | |||
78 | /** |
||
79 | * Get the polymorphic relationship columns. |
||
80 | * |
||
81 | * @param string $name |
||
82 | * @param string $type |
||
83 | * @param string $id |
||
84 | * |
||
85 | * @return array |
||
86 | */ |
||
87 | protected static function getMorphs($name, $type, $id) |
||
95 | |||
96 | /** |
||
97 | * Define an inverse morph relationship. |
||
98 | * |
||
99 | * @param Model $parent |
||
100 | * @param string $related |
||
101 | * @param string $name |
||
102 | * @param string $type |
||
103 | * @param string $id |
||
104 | * @param string $otherKey |
||
105 | * @param string $relation |
||
106 | * |
||
107 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
108 | */ |
||
109 | public static function build(Model $parent, $related, $name, $type = null, $id = null, $otherKey = null, $relation = null) |
||
135 | } |
||
136 |
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.