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
}
}