Skip to content

Commit 839f43e

Browse files
style changes
1 parent bf53c09 commit 839f43e

File tree

3 files changed

+26
-27
lines changed

3 files changed

+26
-27
lines changed

src/Form.php

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -424,9 +424,9 @@ protected function ajaxResponse($message)
424424
// ajax but not pjax
425425
if ($request->ajax() && !$request->pjax()) {
426426
return response()->json([
427-
'status' => true,
428-
'message' => $message,
429-
'display' => $this->applayFieldDisplay(),
427+
'status' => true,
428+
'message' => $message,
429+
'display' => $this->applayFieldDisplay(),
430430
]);
431431
}
432432

@@ -516,9 +516,9 @@ protected function getRelationInputs($inputs = []): array
516516
$relations = [];
517517

518518
foreach ($inputs as $column => $value) {
519-
if ((method_exists($this->model, $column) ||
520-
method_exists($this->model, $column = Str::camel($column))) &&
521-
!method_exists(Model::class, $column)
519+
if ((method_exists($this->model, $column)
520+
|| method_exists($this->model, $column = Str::camel($column)))
521+
&& !method_exists(Model::class, $column)
522522
) {
523523
$relation = call_user_func([$this->model, $column]);
524524

@@ -605,7 +605,7 @@ public function update($id, $data = null)
605605
protected function redirectAfterStore()
606606
{
607607
$resourcesPath = $this->resource(0);
608-
$key = $this->model->getKey();
608+
$key = $this->model->getKey();
609609

610610
return $this->redirectAfterSaving($resourcesPath, $key);
611611
}
@@ -702,7 +702,7 @@ protected function handleColumnUpdates($id, $data)
702702
protected function handleEditable(array $input = []): array
703703
{
704704
if (array_key_exists('_editable', $input)) {
705-
$name = $input['name'];
705+
$name = $input['name'];
706706
$value = $input['value'];
707707

708708
Arr::forget($input, ['pk', 'value', 'name']);
@@ -768,7 +768,7 @@ protected function updateRelation($relationsData)
768768
|| $relation instanceof Relations\BelongsTo;
769769

770770
$isRelationUpdate = true;
771-
$prepared = $this->prepareUpdate([$name => $values], $oneToOneRelation, $isRelationUpdate);
771+
$prepared = $this->prepareUpdate([$name => $values], $oneToOneRelation, $isRelationUpdate);
772772

773773
if (empty($prepared)) {
774774
continue;
@@ -851,8 +851,8 @@ protected function prepareUpdate(array $updates, $oneToOneRelation = false, $isR
851851
foreach ($this->fields() as $field) {
852852
$columns = $field->column();
853853

854-
if ($this->isInvalidColumn($columns, $oneToOneRelation || $field->isJsonType) ||
855-
(in_array($columns, $this->relation_fields) && !$isRelationUpdate)) {
854+
if ($this->isInvalidColumn($columns, $oneToOneRelation || $field->isJsonType)
855+
|| (in_array($columns, $this->relation_fields) && !$isRelationUpdate)) {
856856
continue;
857857
}
858858

@@ -883,8 +883,8 @@ protected function prepareUpdate(array $updates, $oneToOneRelation = false, $isR
883883
protected function isInvalidColumn($columns, $containsDot = false): bool
884884
{
885885
foreach ((array) $columns as $column) {
886-
if ((!$containsDot && Str::contains($column, '.')) ||
887-
($containsDot && !Str::contains($column, '.'))) {
886+
if ((!$containsDot && Str::contains($column, '.'))
887+
|| ($containsDot && !Str::contains($column, '.'))) {
888888
return true;
889889
}
890890
}
@@ -1089,7 +1089,6 @@ public function validationMessages($input)
10891089
if (!$validator = $field->getValidator($input)) {
10901090
continue;
10911091
}
1092-
10931092
if (($validator instanceof Validator) && !$validator->passes()) {
10941093
$failedValidators[] = $validator;
10951094
}
@@ -1136,14 +1135,14 @@ public function getRelations(): array
11361135
if (Str::contains($column, '.')) {
11371136
list($relation) = explode('.', $column);
11381137

1139-
if (method_exists($this->model, $relation) &&
1140-
!method_exists(Model::class, $relation) &&
1141-
$this->model->$relation() instanceof Relations\Relation
1138+
if (method_exists($this->model, $relation)
1139+
&& !method_exists(Model::class, $relation)
1140+
&& $this->model->$relation() instanceof Relations\Relation
11421141
) {
11431142
$relations[] = $relation;
11441143
}
1145-
} elseif (method_exists($this->model, $column) &&
1146-
!method_exists(Model::class, $column)
1144+
} elseif (method_exists($this->model, $column)
1145+
&& !method_exists(Model::class, $column)
11471146
) {
11481147
$relations[] = $column;
11491148
}
@@ -1448,7 +1447,7 @@ public function input($key, $value = null)
14481447
*
14491448
* @return $this
14501449
*/
1451-
public function column($width, \Closure $closure): self
1450+
public function column($width, Closure $closure): self
14521451
{
14531452
$width = $width < 1 ? round(12 * $width) : $width;
14541453

src/Form/Field/File.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class File extends Field
2121
'/vendor/open-admin/fields/file-upload/file-upload.js',
2222
];
2323

24-
public $type = 'file';
24+
public $type = 'file';
2525
public $readonly = false;
2626

2727
/**
@@ -48,7 +48,7 @@ public function defaultDirectory()
4848
}
4949

5050
/**
51-
* {@inheritdoc}
51+
* @inheritdoc
5252
*/
5353
public function getValidator(array $input)
5454
{
@@ -81,7 +81,7 @@ public function getValidator(array $input)
8181
return false;
8282
}
8383

84-
$rules[$this->column] = $fieldRules;
84+
$rules[$this->column] = $fieldRules;
8585
$attributes[$this->column] = $this->label;
8686

8787
return \validator($input, $rules, $this->getValidationMessages(), $attributes);
@@ -214,8 +214,8 @@ protected function setupScripts()
214214
$this->setType();
215215
$this->attribute('id', $id);
216216
$this->options['storageUrl'] = $this->storageUrl();
217-
$json_options = json_encode($this->options);
218-
$this->script = <<<JS
217+
$json_options = json_encode($this->options);
218+
$this->script = <<<JS
219219
var FileUpload_{$id} = new FileUpload(document.querySelector('#{$id}'),{$json_options});
220220
JS;
221221
}

src/Form/Field/Image.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Image extends File
1111
use ImageField;
1212

1313
/**
14-
* {@inheritdoc}
14+
* @inheritdoc
1515
*/
1616
protected $view = 'admin::form.file';
1717

@@ -71,7 +71,7 @@ public function prepare($file)
7171
*/
7272
public function guessPreviewType($file)
7373
{
74-
$extra = parent::guessPreviewType($file);
74+
$extra = parent::guessPreviewType($file);
7575
$extra['type'] = 'image';
7676

7777
return $extra;

0 commit comments

Comments
 (0)