Skip to content

Commit 8c60dc8

Browse files
cklei-carlygithub-actions[bot]
authored andcommitted
Fix styling
1 parent 7dda982 commit 8c60dc8

2 files changed

Lines changed: 30 additions & 18 deletions

File tree

src/Models/Concerns/HasContentVersions.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,25 +100,25 @@ public function getLatestPublishedTime()
100100
public function getLatestPublishedPropertyData()
101101
{
102102
// Already load via ContentVersionDetailScope
103-
if ($this->hasAttribute('__latest_version_publish_data') && is_array($this->__latest_version_publish_data) && !empty($this->__latest_version_publish_data)) {
104-
103+
if ($this->hasAttribute('__latest_version_publish_data') && is_array($this->__latest_version_publish_data) && ! empty($this->__latest_version_publish_data)) {
104+
105105
try {
106106

107107
$propertyData = $this->__latest_version_publish_data['propertyData'];
108-
108+
109109
if (is_string($propertyData)) {
110110
$propertyData = json_decode($propertyData, true);
111111
}
112112

113-
if (is_array($propertyData) && !empty($propertyData)) {
113+
if (is_array($propertyData) && ! empty($propertyData)) {
114114
return $propertyData;
115115
}
116116

117117
} catch (\Throwable $th) {
118118
// Fallback to load via publishedVersions
119119
}
120120
}
121-
121+
122122
$latestContentVersion = $this->getLatestPublishedContentVersion();
123123

124124
return $this->mutateLatestVersionPropertyData($latestContentVersion);
@@ -128,25 +128,25 @@ public function getLatestPublishedPropertyData()
128128
public function getLatestVersionPropertyData()
129129
{
130130
// Already load via ContentVersionDetailScope
131-
if ($this->hasAttribute('__latest_version_data') && is_array($this->__latest_version_data) && !empty($this->__latest_version_data)) {
132-
131+
if ($this->hasAttribute('__latest_version_data') && is_array($this->__latest_version_data) && ! empty($this->__latest_version_data)) {
132+
133133
try {
134134

135135
$propertyData = $this->__latest_version_data['propertyData'];
136-
136+
137137
if (is_string($propertyData)) {
138138
$propertyData = json_decode($propertyData, true);
139139
}
140140

141-
if (is_array($propertyData) && !empty($propertyData)) {
141+
if (is_array($propertyData) && ! empty($propertyData)) {
142142
return $propertyData;
143143
}
144144

145145
} catch (\Throwable $th) {
146146
// Fallback to load via latestContentVersion
147147
}
148148
}
149-
149+
150150
$this->loadMissing('latestContentVersion');
151151

152152
$latestContentVersion = $this->latestContentVersion;

src/Models/Scopes/ContentVersionDetailScope.php

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,11 @@ public function apply($builder, Model $model)
3636
$t2_1TableName = '_cv_t2_publish';
3737
$t2_2TableName = '_cv_t2_all';
3838
$t2_1Q = DB::table($related->getTable(), $t2_1TableName)
39-
->joinSub($t1Q, $t1TableName, fn (JoinClause $join) => $join
40-
->on("$t1TableName.latest_version_id", '=', "$t2_1TableName.$relatedPK")
39+
->joinSub(
40+
$t1Q,
41+
$t1TableName,
42+
fn (JoinClause $join) => $join
43+
->on("$t1TableName.latest_version_id", '=', "$t2_1TableName.$relatedPK")
4144
)
4245
->where("$t2_1TableName.publish_state", 'publish')
4346
->select([
@@ -48,8 +51,11 @@ public function apply($builder, Model $model)
4851
"$t2_1TableName.to_data AS data",
4952
]);
5053
$t2_2Q = DB::table($related->getTable(), $t2_2TableName)
51-
->joinSub($t1Q, $t1TableName, fn (JoinClause $join) => $join
52-
->on("$t1TableName.latest_version_id", '=', "$t2_2TableName.$relatedPK")
54+
->joinSub(
55+
$t1Q,
56+
$t1TableName,
57+
fn (JoinClause $join) => $join
58+
->on("$t1TableName.latest_version_id", '=', "$t2_2TableName.$relatedPK")
5359
)
5460
->whereNot("$t2_2TableName.publish_state", 'publish')
5561
->select([
@@ -61,11 +67,17 @@ public function apply($builder, Model $model)
6167
]);
6268

6369
$query
64-
->leftJoinSub($t2_1Q, $t2_1TableName, fn (JoinClause $join) => $join
65-
->on($model->getQualifiedKeyName(), '=', "{$t2_1TableName}.{$relatedFK}")
70+
->leftJoinSub(
71+
$t2_1Q,
72+
$t2_1TableName,
73+
fn (JoinClause $join) => $join
74+
->on($model->getQualifiedKeyName(), '=', "{$t2_1TableName}.{$relatedFK}")
6675
)
67-
->leftJoinSub($t2_2Q, $t2_2TableName, fn (JoinClause $join) => $join
68-
->on($model->getQualifiedKeyName(), '=', "{$t2_2TableName}.{$relatedFK}")
76+
->leftJoinSub(
77+
$t2_2Q,
78+
$t2_2TableName,
79+
fn (JoinClause $join) => $join
80+
->on($model->getQualifiedKeyName(), '=', "{$t2_2TableName}.{$relatedFK}")
6981
)
7082
->addSelect($model->qualifyColumn('*'))
7183
->addSelect([

0 commit comments

Comments
 (0)