Skip to content
This repository has been archived by the owner on Nov 5, 2021. It is now read-only.

Commit

Permalink
Merge pull request #3 from KosmosKosmos/allow-file-fields
Browse files Browse the repository at this point in the history
[FIX] Allow File/Image Fields to be used
  • Loading branch information
jnbn authored Dec 14, 2019
2 parents c34f16b + 5aed6ee commit 62a0004
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Http/Controllers/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
use Illuminate\Http\Request;
use Epigra\NovaSettings\NovaSettingsTool;
use Laravel\Nova\Contracts\Resolvable;
use Laravel\Nova\Http\Requests\NovaRequest;
use Laravel\Nova\Http\Requests\NovaRequest;

class SettingsController extends Controller
{
public function get(Request $request)
{
$fields = collect(NovaSettingsTool::getSettingsFields());

$fields->whereInstanceOf(Resolvable::class)->each(function (&$field) {
if (!empty($field->attribute)) {
$field->resolve([$field->attribute => setting($field->attribute)]);
Expand All @@ -33,7 +33,10 @@ public function save(NovaRequest $request)
$tempResource = new \stdClass;
$field->fill($request, $tempResource);

setting([$field->attribute => $tempResource->{$field->attribute} ]);
if (property_exists($tempResource, $field->attribute)) {
setting([$field->attribute => $tempResource->{$field->attribute} ]);
}

});

setting()->save();
Expand Down

0 comments on commit 62a0004

Please sign in to comment.