outl1ne / nova-notes-field

This Laravel Nova package adds a notes field to Nova's arsenal of fields.
MIT License
51 stars 36 forks source link

Ignore scopes #32

Closed RomkaLTU closed 2 years ago

RomkaLTU commented 3 years ago

Is there any way to ignore scopes? For example, I have global scope "where published == true" but still want to be able to add comments, because this status only hides the model from the frontend.

Tarpsvo commented 3 years ago

Hi! Can you elaborate a bit please? Ie how'd you add the scope in the first place?

Theoretically you can overwrite the HasNotes' traits notes() method and remove scopes there:

public function notes()
    {
        return $this->morphMany(NotesFieldServiceProvider::getNotesModel(), 'notable')->withoutGlobalScopes();
    }