1 | <?php |
||
11 | abstract class ContentfulModel extends Model |
||
12 | { |
||
13 | use Localable; |
||
14 | |||
15 | /** |
||
16 | * {@inheritdoc} |
||
17 | */ |
||
18 | protected $primaryKey = 'contentful_id'; |
||
19 | |||
20 | |||
21 | /** |
||
22 | * {@inheritdoc} |
||
23 | */ |
||
24 | protected $keyType = 'string'; |
||
25 | |||
26 | /** |
||
27 | * {@inheritdoc} |
||
28 | */ |
||
29 | public $incrementing = false; |
||
30 | |||
31 | /** |
||
32 | * ContentfulModel constructor. |
||
33 | * |
||
34 | * @param array $attributes |
||
35 | * @return void |
||
|
|||
36 | */ |
||
37 | public function __construct(array $attributes = []) |
||
55 | |||
56 | /** |
||
57 | * Return default fillable fields. |
||
58 | * |
||
59 | * @return array |
||
60 | */ |
||
61 | public function defaultFillable() : array |
||
72 | |||
73 | /** |
||
74 | * Return default casted fields. |
||
75 | * |
||
76 | * @return array |
||
77 | */ |
||
78 | public function defaultCasts() : array |
||
84 | |||
85 | |||
86 | // -------------------------------------------------------------------------------- |
||
87 | // -------------------------------------------------------------------------------- |
||
88 | // -------------------------------------------------------------------------------- |
||
89 | |||
90 | /** |
||
91 | * Return Contentful Asset for given link (sys or ID). |
||
92 | * |
||
93 | * @param array|string|null $link |
||
94 | * @return \Distilleries\Contentful\Models\Asset|null |
||
95 | */ |
||
96 | protected function contentfulAsset($link) : ?Asset |
||
112 | |||
113 | /** |
||
114 | * Return Contentful Entry for given link (sys or ID). |
||
115 | * |
||
116 | * @param array|string|null $link |
||
117 | * @return \Distilleries\Contentful\Models\Base\ContentfulModel|null |
||
118 | */ |
||
119 | protected function contentfulEntry($link) : ?ContentfulModel |
||
131 | |||
132 | /** |
||
133 | * Return Contentful Entries for given ID. |
||
134 | * |
||
135 | * @param array $links |
||
136 | * @return \Illuminate\Support\Collection |
||
137 | */ |
||
138 | protected function contentfulEntries(array $links) : Collection |
||
182 | |||
183 | /** |
||
184 | * Return a collection of related models for base Contentful ID. |
||
185 | * |
||
186 | * @param string $contentfulId |
||
187 | * @param string $contentfulType |
||
188 | * @return \Illuminate\Support\Collection |
||
189 | */ |
||
190 | protected function contentfulRelatedEntries(string $contentfulId, string $contentfulType = '') : Collection |
||
224 | |||
225 | /** |
||
226 | * Return Contentful link ID. |
||
227 | * |
||
228 | * @param mixed $link |
||
229 | * @return string|null |
||
230 | */ |
||
231 | protected function contentfulLinkId($link) : ?string |
||
247 | } |
||
248 |
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.