<?php namespace App; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Carbon\Carbon; class Recipe extends Model { protected $fillable = ['name','maintainer','author','servings','date_entered','date_modified','instructions']; protected $dates = ['date_entered','date_modified']; public function setDateEnteredAttribute($value){ $this->attributes['date_entered']=Carbon::parse($value); } public function setDateModifiedAttribute($value){ $this->attributes['date_modified']=Carbon::parse($value); } public function user() { return $this->belongsTo('App\User'); } public function ingredients() { return $this->hasMany('App\RecipeIngredient'); } public function categories() { return $this->hasMany('App\RecipeCategory'); } }