Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support fix for ebess/advanced-nova-media-library #129

Open
bendadaniel opened this issue Jul 31, 2022 · 3 comments
Open

Support fix for ebess/advanced-nova-media-library #129

bendadaniel opened this issue Jul 31, 2022 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@bendadaniel
Copy link

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

@KasparRosin
Copy link
Member

Pull requests are welcome. 🥳

@yiukamsum
Copy link

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.

  1. Creat a FakeModel wich has implements HasMedia and use InteractsWithMedia
  • code example (app/FakeModel.php)
<?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;
    }
    //
}
  1. change the makeFakeResource functiom
  • code example (vendor_custom/nova-settings/src/Http/Controllers/SettingsController.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);
    }
}

@hayatbiralem
Copy link

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.

@Tarpsvo Tarpsvo added enhancement New feature or request help wanted Extra attention is needed labels Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants