HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ip-172-26-0-120 6.17.0-1009-aws #9~24.04.2-Ubuntu SMP Fri Mar 6 23:50:29 UTC 2026 x86_64
User: ubuntu (1000)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/www/html/spion/app/Models/UserWebsite.php
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Models\UserSubscription;
use App\Models\Country;
use App\Models\State;
use App\Models\City;

class UserWebsite extends Model
{
    use HasFactory;

    protected $table = 'user_websites';
    protected $fillable = [
        'user_id',
        'first_name',
        'last_name',
        'email',
        'business_name',
        'business_email',
        'business_phone',
        'business_address_1',
        'business_address_2',
        'street',
        'city',
        'state',
        'zip_code',
        'country',
        'domain_name',
        'subdomain_preference',
        'social_urls',
        'logo',
        'media',
        'pages',
        'business_paragraph',
        'services_name',
        'services_description',
        'primary_color',
        'secondary_color',
        'highlight_color',
        'instructions',
        'status',
    ];

    protected $casts = [
        'social_urls' => 'array',
        'media' => 'array',
        'pages' => 'array',
        'services_name' => 'array',
        'services_description' => 'array',
    ];
    
   public function userSubscription()  {
        return $this->hasMany(userSubscription::class, 'website_id');

    }
    public function country()
    {
        return $this->belongsTo(Country::class, 'country', 'name'); // Match name instead of ID
    }

    public function state()
    {
        return $this->belongsTo(State::class, 'state', 'name'); // Match name instead of ID
    }

    public function city()
    {
        return $this->belongsTo(City::class, 'city', 'name'); // Match name instead of ID
    }
}