Open bendadaniel opened 2 years ago
Pull requests are welcome. 🥳
Here is my workaround.
I have no idea how to apply this workaround to this plugin. Any pull requests based on this workaround are welcome.
FakeModel
wich has implements HasMedia
and use InteractsWithMedia
<?php
namespace App;
use Illuminate\Database\Eloquent\Model; use Spatie\MediaLibrary\HasMedia; use Spatie\MediaLibrary\InteractsWithMedia; use Ebess\AdvancedNovaMediaLibrary\Fields\Media;
class Setting extends FakeModel implements HasMedia { use InteractsWithMedia;
public function __construct($key, $value)
{
$this->{$key} = $value;
}
//
}
2. change the `makeFakeResource` functiom
- code example (vendor_custom/nova-settings/src/Http/Controllers/SettingsController.php)
```php
<?php
namespace OptimistDigital\NovaSettings\Http\Controllers;
.
.
.
use App\FakeModel;
.
.
.
class SettingsController extends Controller
{
protected function makeFakeResource(string $fieldName, $fieldValue)
{
return new Setting($fieldName, $fieldValue);
}
}
I decided to drop outl1ne/nova-settings from my stack and used whitecube/nova-flexible-content to store my settings in an aditional resource named Setting and then I created a custom Nova menu which contains a menu item for the edit view of the very first setting instance. It works like a charm so far.
Did someone find way to make it works with package ebess/advanced-nova-media-library?
https://github.com/ebess/advanced-nova-media-library
Thank you Daniel