antonioribeiro / antonioribeiro/nova-boolean-datetime-field

Getting 'DateTime field must cast to 'datetime' in Eloquent model.'

Open
#5 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
21
Forks
5
PR merge metrics
No merged PRs in 30d

Description

Hello,

I am getting 'DateTime field must cast to 'datetime' in Eloquent model.' when I create, update or show a user.

My casts in the user model:

    protected $casts = [
        'email_verified_at' => 'datetime',
        'accepted_terms_at' => 'datetime',
        'date_of_birth' => 'date',
    ];

The field where i get this error:
BooleanDatetime::make('Akkoord met voorwaarden', 'accepted_terms_at')->onlyOnDetail()

Versions:

  • Laravel: 6.6.2
  • Nova: 2.9.2

Already thanks for your help.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the error on Laravel 6.6.2 and Nova 2.9.2 using the User model casts and the BooleanDatetime::make field for accepted_terms_at. Trace why the error appears during user creation, update, or detail display; the issue is done when those operations work without the datetime-cast error.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.