It would be wise to add a warning about models being unguarded during seeding.
In a lot of cases I simply just dump my validated data into the model like so:
$data = $request->validated();
And then in turn do something like:
User::create($data)
And my $fillable properties will ensure only that data that should be set will get set.
Due to me having some of this logic into my observer it took quite a while to debug this and adding this to a simple documentation page like the seeding page would help out a lot without adding too much overhead.
I think on the following page:
https://laravel.com/docs/8.x/seeding
It would be wise to add a warning about models being unguarded during seeding.
In a lot of cases I simply just dump my validated data into the model like so:
$data = $request->validated();
And then in turn do something like:
User::create($data)
And my
$fillable
properties will ensure only that data that should be set will get set.Due to me having some of this logic into my observer it took quite a while to debug this and adding this to a simple documentation page like the seeding page would help out a lot without adding too much overhead.