Skip to content

[Feature Request]: Guarded attributes when $guarded is changed via self initializing trait #1326

@dsazup

Description

@dsazup

Feature Description

I have Unguarded trait that I sometimes add to models so it keeps them clean, it looks like so:

trait Unguarded
{
    public function initializeUnguarded(): void
    {
        $this->guarded = [];
    }
}

class Person extends Model
{
    use Unguarded;
}
Image

Obviously if I do

protected $guarded = [];

then it all works. Would it be possible to make the plugin recognise this?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions