Skip to content

Commit cb70804

Browse files
authored
Apply suggestions from code review
1 parent 47ece0f commit cb70804

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/app/Library/CrudPanel/Traits/ColumnsProtectedMethods.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ protected function makeSureColumnHasEntity($column)
193193
// if the first part of the string exists as method in the model
194194
if (method_exists($this->model, $possibleMethodName)) {
195195

196-
// check model method for possibility of beeing a relationship
197-
$column['entity'] = $this->checkMethodPropertiesForRelationship($this->model, $possibleMethodName) ? $column['name'] : false;
196+
// check model method for possibility of being a relationship
197+
$column['entity'] = $this->modelMethodIsRelationship($this->model, $possibleMethodName) ? $column['name'] : false;
198198

199199
if ($column['entity']) {
200200
$parts = explode('.', $column['entity']);
@@ -226,8 +226,8 @@ protected function makeSureColumnHasEntity($column)
226226
// if there's a method on the model with this name
227227
if (method_exists($this->model, $column['name'])) {
228228

229-
// check model method for possibility of beeing a relationship
230-
$column['entity'] = $this->checkMethodPropertiesForRelationship($this->model, $column['name']);
229+
// check model method for possibility of being a relationship
230+
$column['entity'] = $this->modelMethodIsRelationship($this->model, $column['name']);
231231

232232
return $column;
233233
}
@@ -238,8 +238,8 @@ protected function makeSureColumnHasEntity($column)
238238
$possibleMethodName = Str::replaceLast('_id', '', $column['name']);
239239

240240
if (method_exists($this->model, $possibleMethodName)) {
241-
// check model method for possibility of beeing a relationship
242-
$column['entity'] = $this->checkMethodPropertiesForRelationship($this->model, $possibleMethodName);
241+
// check model method for possibility of being a relationship
242+
$column['entity'] = $this->modelMethodIsRelationship($this->model, $possibleMethodName);
243243

244244
return $column;
245245
}

src/app/Library/CrudPanel/Traits/FieldsProtectedMethods.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,16 @@ protected function makeSureFieldHasEntity($field)
142142
//if the name is dot notation we are sure it's a relationship
143143
if (strpos($field['name'], '.') !== false) {
144144
$possibleMethodName = Str::of($field['name'])->before('.');
145-
// check model method for possibility of beeing a relationship
146-
$field['entity'] = $this->checkMethodPropertiesForRelationship($model, $possibleMethodName) ? $field['name'] : false;
145+
// check model method for possibility of being a relationship
146+
$field['entity'] = $this->modelMethodIsRelationship($model, $possibleMethodName) ? $field['name'] : false;
147147

148148
return $field;
149149
}
150150

151151
// if there's a method on the model with this name
152152
if (method_exists($model, $field['name'])) {
153-
// check model method for possibility of beeing a relationship
154-
$field['entity'] = $this->checkMethodPropertiesForRelationship($model, $field['name']);
153+
// check model method for possibility of being a relationship
154+
$field['entity'] = $this->modelMethodIsRelationship($model, $field['name']);
155155

156156
return $field;
157157
}
@@ -162,8 +162,8 @@ protected function makeSureFieldHasEntity($field)
162162
$possibleMethodName = Str::replaceLast('_id', '', $field['name']);
163163

164164
if (method_exists($model, $possibleMethodName)) {
165-
// check model method for possibility of beeing a relationship
166-
$field['entity'] = $this->checkMethodPropertiesForRelationship($model, $possibleMethodName);
165+
// check model method for possibility of being a relationship
166+
$field['entity'] = $this->modelMethodIsRelationship($model, $possibleMethodName);
167167

168168
return $field;
169169
}

src/app/Library/CrudPanel/Traits/Relationships.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ private static function getPivotFieldStructure($field)
324324
* @param $method
325325
* @return bool|string
326326
*/
327-
private function checkMethodPropertiesForRelationship($model, $method)
327+
private function modelMethodIsRelationship($model, $method)
328328
{
329329
$methodReflection = new \ReflectionMethod($model, $method);
330330

0 commit comments

Comments
 (0)