A
A
Artem00712019-07-09 17:32:02
Laravel
Artem0071, 2019-07-09 17:32:02

How does '_' work in Laravel?

Why at

SomeClassName::firstOrCreate([
    '_test' => 'test',
]);

the _test attribute is ignored

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Victor, 2019-07-11
@Artem0071

That's how it's intended. Keys that start with "_" are ignored by the fill method, which is what ends up being used by methods like firstOrCreate.
Adding to fillable explicitly or making guarded an empty array should work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question