CartItem.php 962 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. use Illuminate\Database\Eloquent\Model;
  5. /**
  6. * @property-read \App\Models\Cart|null $cart
  7. * @property-read \App\Models\Schedule|null $schedule
  8. * @method static \Illuminate\Database\Eloquent\Builder<static>|CartItem newModelQuery()
  9. * @method static \Illuminate\Database\Eloquent\Builder<static>|CartItem newQuery()
  10. * @method static \Illuminate\Database\Eloquent\Builder<static>|CartItem query()
  11. * @mixin \Eloquent
  12. */
  13. class CartItem extends Model
  14. {
  15. use HasFactory;
  16. protected $table = 'cart_items';
  17. protected $fillable = [
  18. 'cart_id',
  19. 'schedule_id',
  20. ];
  21. protected $casts = [
  22. 'created_at' => 'datetime',
  23. 'updated_at' => 'datetime',
  24. ];
  25. public function cart()
  26. {
  27. return $this->belongsTo(Cart::class);
  28. }
  29. public function schedule()
  30. {
  31. return $this->belongsTo(Schedule::class);
  32. }
  33. }