Skip to content

Accessor not working when "snakeAttributes = false" #42703

Answered by hussein4alaa
matsu-motsu asked this question in Q&A
Discussion options

You must be logged in to vote

try this

protected $appends = ['created_on'];
public function getCreatedOnAttribute():
{
        return date('Y-m-d', strtotime($this->attributes['created_at']));
}

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@matsu-motsu
Comment options

Answer selected by matsu-motsu
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants