HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux ip-172-31-42-149 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 07:00:04 UTC 2025 aarch64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/vhost/disk-apps/qas.sports-crowd.com/app/Models/Experience/Experience.php
<?php

namespace App\Models\Experience;

use App\Models\Mailing\EmailTemplate;
use App\Models\Payment\PaymentGateway;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
// use Spatie\Activitylog\Traits\LogsActivity;

class Experience extends Model
{
    use SoftDeletes;
    protected $dates = ['deleted_at'];

    // use LogsActivity;
    // protected static $logAttributes = ['*'];
    // protected static $logOnlyDirty = true;
    // protected static $logName = 'experiences';

    protected $fillable = [
        'id',
        'name',
        'icon',
        'short_description',
        'description',
        'term_cons_url',
        'image',
        'apply_to',
        'includes',
        'when',
        'experience_type',
        'plan_scheme',
        'is_sponsored',
        'start_datetime',
        'total_capacity',
        'available_slots',
        'buy_limit',
        'active',
        'show_in',
        'enable_raffle',
    ];

    public function plans()
    {
        return $this->hasMany(ExperiencePlan::class)
            ->select([
                'id',
                'name',
                'description',
                'experience_id',
                'type',
                'available_slots',
                'entries_per_purchase',
                'buy_limit',
                'display_index'
            ])
            ->where('type', 'experience')
            ->whereHas('prices')
            ->with(['prices' => function ($query) {
                $query->orderBy('price', 'asc');
            }])
            ->orderBy(
                ExperiencePlanPrice::select('display_index')
                    ->whereColumn('experience_plan_id', 'experience_plans.id')
                    ->orderBy('display_index', 'asc')
                    ->limit(1)
            );
    }

    public function academy_plans()
    {
        return $this->hasMany(ExperiencePlan::class)
            ->select([
                'id',
                'name',
                'description',
                'experience_id',
                'type',
                'available_slots',
                'entries_per_purchase',
                'display_index'
            ])
            ->where('type', 'academy')
            ->whereHas('prices')
            ->with(['prices' => function ($query) {
                $query->orderBy('price', 'asc');
            }])
            ->orderBy(
                ExperiencePlanPrice::select('price')
                    ->whereColumn('experience_plan_id', 'experience_plans.id')
                    ->orderBy('price', 'asc')
                    ->limit(1)
            );
    }

    public function paymentGateways()
    {
        return $this->belongsToMany(PaymentGateway::class, 'experience_gateway_payments', 'experience_id', 'gateway_payment_id')->withTimestamps();
    }

    public function emailTemplate()
    {
        return $this->belongsTo(EmailTemplate::class);
    }

    public function experience_erp()
    {
        return $this->belongsTo(ExperienceErp::class);
    }
}