nikocraft
3 years ago
1075
8
Eloquent

casting to boolean

Posted 3 years ago by nikocraft

I have this:

    protected $casts = [
        'published' => 'boolean',
    ];

However when I do this:

{{$post->published}}

it prints 1 instead of true. Am I doing something wrong? I followed the docs: https://laravel.com/docs/5.3/eloquent-mutators#attribute-casting

Please sign in or create an account to participate in this conversation.