Did you make surname fillable on the User model, but not the marketing property? What, if any, error messages are you receiving?
It would help us if you shared the relevant Model, Controller (and perhaps view template) code.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi all, very new to Laravel but eager to learn!
I have a new install of Laravel Breeze using Tailwind and I'm trying to add fields to the profile page. I've searched high and low to try and find a solution but I'm stuck :(
The installation came with the following fields: Name, Email
All fine, I've since added the following using artisan migration Surname (varchar), Marketing (boolean / tinyint(1)
The suname field saves with no issue however the marketing boolean is refusing to save and I mean REFUSING.
Steps taken: I've created a cast in the User model for the field, I've done a dd which is showing me the value of 1 being submitted in the form, I've tried changing the field to varchar, I've googled for what feels like an eternity
I'm new to Laracasts too so appologies if I've not done this right or posted in the incorrect place!
My Laravel version is 11.
Thanks!
In the Controller action, did you delete this line which fills the Model with the form data?
$request->user()->fill($request->validated());
Secondly, if an input key is not included in the rules array, then it is not included in the validated data, so update the ProfileUpdateRequest to include marketing in the validation rules even if it is an empty rule, it needs to be included:
public function rules(): array
{
return [
'name' => ['required', 'string', 'max:255'],
'surname' => ['required', 'string', 'max:255', 'min:3'],
'email' => ['required', 'string', 'lowercase', 'email', 'max:255', Rule::unique(User::class)->ignore($this->user()->id)],
'marketing' => '',
];
}
However, since checkboxes are somewhat special (they are not included in the Request payload whenever unchecked), you need an additional step to check if it is present. This can be achieve in a number of different ways, but I like the following whenever using FormRequest classes:
// ProfileUpdateRequest
protected function prepareForValidation(): void
{
$this->merge([
'marketing' => $this->has('marketing'),
]);
}
The has method returns a Boolean which determines if the given key is in the Request - ultimately, was the checkbox checked or unchecked!
Lastly, in the view template, you can show the state of the User property using a ternary to set a checked attribute on the element:
<input id="marketing"
type="checkbox"
value=1
class="rounded border-gold text-gold shadow-sm focus:ring-gold"
name="marketing"
{{ $user->marketing ? 'checked' : '' }}
>
Please or to participate in this conversation.