File manager - Edit - /home/autoph/public_html/projects/aha-api/app/Models/PromoCode.php
Back
<?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use OwenIt\Auditing\Contracts\Auditable; use OwenIt\Auditing\Auditable as AuditableTrait; use App\Models\Dealership; use App\Models\Brand; use App\Models\CarLine; use App\Models\Customer; use App\Models\ServiceBooking; class PromoCode extends Model implements Auditable { use HasFactory, AuditableTrait; protected $table = 'aha_promo_code'; /** * The attributes that are NOT mass assignable. * */ protected $guarded = [ 'deleted_at', ]; /** * The attributes that should be cast. * * @var array<string, string> */ protected $casts = [ 'created_at' => 'datetime', 'updated_at' => 'datetime', 'deleted_at' => 'datetime', ]; /** * Get the Brand where promo code was tagged * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function brand() { return $this->belongsTo(Brand::class); } /** * Get the Car Line / Model where promo code was tagged * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function model() { return $this->belongsTo(CarLine::class); } /** * Get the Dealer where promo code was tagged * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function dealership() { return $this->belongsTo(Dealership::class, 'dealer_id', 'id'); } /** * Get the Dealer where promo code was tagged * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function customer() { return $this->belongsTo(Customer::class, 'aha_owner_id', 'aha_user_id'); } public function bookings() { return $this->hasMany(ServiceBooking::class, 'promo_code', 'promo_code'); } public function filteredBookings() { return $this->bookings() ->leftJoin('vehicles', 'vehicles.id', 'service_bookings.vehicle_id'); } }
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0.05 |
proxy
|
phpinfo
|
Settings