| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Database\Eloquent\SoftDeletes;
- use Illuminate\Database\Eloquent\Relations\BelongsTo;
- use Illuminate\Database\Eloquent\Relations\HasMany;
- use Illuminate\Database\Eloquent\Relations\HasOne;
- class CustomSchedule extends Model
- {
- use SoftDeletes;
- protected $fillable = [
- 'schedule_id',
- 'address_type',
- 'service_type_id',
- 'description',
- 'min_price',
- 'max_price',
- 'offers_meal',
- ];
- protected $casts = [
- 'min_price' => 'decimal:2',
- 'max_price' => 'decimal:2',
- 'offers_meal' => 'boolean',
- ];
- public function schedule(): BelongsTo
- {
- return $this->belongsTo(Schedule::class);
- }
- public function serviceType(): HasOne
- {
- return $this->hasOne(ServiceType::class, 'id', 'service_type_id');
- }
- public function specialities(): HasMany
- {
- return $this->hasMany(CustomScheduleSpeciality::class);
- }
- }
|