Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

basosneo's avatar

[Symfony\Component\Debug\Exception\FatalThrowableError] Class 'Model' not found

Does anyone know why my laravel makes a mistake when I try to make the seed?

Only when this command gives me the error Model :: unguard ();

When I remove that command, it works for me.

0 likes
2 replies
Jaytee's avatar

It's because you're assigning data that hasn't been set in the $fillable array on your model(s).

The unguard method "bypasses" the mass assignment protection level and the reguard does the inverse.

Make sure you set the fillable fields on your models or set guarded to an empty array.

class MyModel extends Model
{
    protected $fillable = ['my', 'fillable', 'fields'];
    // or
    protected $guarded = [];
}

Also make sure you're importing your models too.

basosneo's avatar

i dont understand your answer.. where i create tis model? i need create the model and after write in all of mmy code?

until now i have been work whitout this command 'Model::unguard' and 'Model::reguard'.

Will this decision affect my entire project?

Please or to participate in this conversation.