As far as I know, a boolean column in a migration creates a TINYINT(1) in the database, which stores 1 or 0. When you get the value from the model, it returns that raw value. To get a real boolean, you need to cast it like this:
protected function casts(): array
{
return [
'is_admin' => 'boolean',
];
}
https://laravel.com/docs/12.x/eloquent-mutators#attribute-casting
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.