Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgergo committed Nov 23, 2023
1 parent 3ffb4c2 commit 07d82d9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
28 changes: 14 additions & 14 deletions resources/views/fields/select.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@
<div class="form-group-label">{!! $prefix !!}</div>
@endif
<select {{ $attrs }}>
@if($nullable)
<option value="">--- {{ $label }} ---</option>
@endif
@foreach($options as $option)
@if(isset($option['options']))
<optgroup label="{{ $option['label'] }}">
@foreach($option['options'] as $o)
<option {{ $o['attrs'] }}>{{ $o['label'] }}</option>
@endforeach
</optgroup>
@else
<option {{ $option['attrs'] }}>{{ $option['label'] }}</option>
@if($nullable)
<option value="">--- {{ $label }} ---</option>
@endif
@endforeach
</select>
@foreach($options as $option)
@if(isset($option['options']))
<optgroup label="{{ $option['label'] }}">
@foreach($option['options'] as $o)
<option {{ $o['attrs'] }}>{{ $o['label'] }}</option>
@endforeach
</optgroup>
@else
<option {{ $option['attrs'] }}>{{ $option['label'] }}</option>
@endif
@endforeach
</select>
@if($suffix)
<div class="form-group-label">{!! $suffix !!}</div>
@endif
Expand Down
6 changes: 3 additions & 3 deletions src/Fields/MorphTo.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ public function resolveHydrate(Request $request, Model $model, mixed $value): vo

$model->setAttribute($this->getRelation($model)->getMorphType(), $value[0]);

$related = new $value[0];

$related->forceFill([$related->getKeyName() => $value[1]]);
$related = tap(new $value[0], static function (Model $related) use ($value): void {
$related->forceFill([$related->getKeyName() => $value[1]]);
});

parent::resolveHydrate($request, $model, $related);
}
Expand Down

0 comments on commit 07d82d9

Please sign in to comment.