0

I'm seeding my database with laravel but i get this error. To remove it i need to comment the mutator part of the model

public function setBirthdayAttribute($value)
    {   
        $this->attributes['birthday'] = Carbon::createFromFormat('d-m-Y',$value)->format('Y-m-d');
    }

    public function setFirstHireAttribute($value)
    {
        $this->attributes['first_hire'] = Carbon::createFromFormat('d-m-Y',$value)->format('Y-m-d');
    }

How can i fix it? I'm getting crazy

Thank you

Valerio

netnull
  • 201
  • 1
  • 3
  • 13

1 Answers1

0

Try this.

public function setBirthdayAttribute($value)
    {   
        $this->attributes['birthday'] = date('Y-m-d',strtotime($value));
    }

    public function setFirstHireAttribute($value)
    {
        $this->attributes['first_hire'] = date('Y-m-d',strtotime($value));
    }
Rajen Trivedi
  • 1,225
  • 2
  • 5
  • 10