Skip to content

Commit

Permalink
Fix check if model uses trait in observer
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Stoimenov committed Sep 1, 2016
1 parent 19dc6d3 commit 7454f39
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion resources/views/admin/formElements/select.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="form-group">
{!! Form::label($fieldName, $options['label']) !!}
{!! Form::select($fieldName, [null => 'Select '.$options['label']] + $options['select_options'], $record->{$fieldName}, ['class' => 'form-control']) !!}
{!! Form::select($fieldName, [null => 'Select '.$options['label']] + $record->{$options['selectOptions']}(), $record->{$fieldName}, ['class' => 'form-control']) !!}
<div class="text-red">
{{ join($errors->get($fieldName), '<br />') }}
</div>
Expand Down
5 changes: 3 additions & 2 deletions src/Admin/Observers/AdminObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ class AdminObserver
*/
public function saving(Model $model)
{
if ($model instanceof UploadImagesTrait) {
if (in_array(UploadImagesTrait::class, class_uses($model))) {
$model->saveImages();
}
if ($model instanceof UploadFilesTrait) {

if (in_array(UploadFilesTrait::class, class_uses($model))) {
$model->saveFiles();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Commands/Compilers/ResourceCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public function render_config($template)
{
if ($this->options['image_uploads']) {
$this->configReplacements[':image_fields'] = "'image_fields' => [
'image' => [
'image' => [
'thumbnails' => [
'admin' => [
'width' => 150,
Expand Down

0 comments on commit 7454f39

Please sign in to comment.