<?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class CartItem extends Model { use HasFactory; protected $fillable = [ 'cart_id', 'attribute_id', 'attribute_option_id', ]; protected $dates = [ 'created_at', 'updated_at', ]; protected $casts = [ 'created_at' => 'date:m-d-Y', 'updated_at' => 'date:m-d-Y', ]; public function attribute() { return $this->belongsTo(Attribute::class, 'attribute_id'); } public function attributeOption() { return $this->belongsTo(AttributeOption::class, 'attribute_option_id'); } }