'boolean', 'design_fee' => 'decimal:2', 'material_cost' => 'decimal:2', 'total_cost' => 'decimal:2', 'deposit_amount' => 'decimal:2', 'balance_amount' => 'decimal:2', 'submitted_at' => 'datetime', 'approved_at' => 'datetime', 'rejected_at' => 'datetime', 'completed_at' => 'datetime', ]; /** * Boot method for model */ protected static function boot() { parent::boot(); static::creating(function ($model) { $model->uuid = \Illuminate\Support\Str::uuid(); $model->order_number = 'CUSTOM-' . now()->format('Ymd') . '-' . strtoupper(uniqid()); $model->submitted_at = now(); }); } /** * Get the user that owns this custom order */ public function user(): BelongsTo { return $this->belongsTo(User::class); } /** * Get the specifications for this custom order */ public function specifications(): HasOne { return $this->hasOne(CustomOrderSpecification::class); } /** * Get the files uploaded for this custom order */ public function files(): HasMany { return $this->hasMany(CustomOrderFile::class); } /** * Get the proofs uploaded for this custom order */ public function proofs(): HasMany { return $this->hasMany(CustomOrderProof::class); } /** * Get route key name for implicit route binding */ public function getRouteKeyName() { return 'uuid'; } }