MOON
Server: Apache
System: Linux server.royaltuning.hu 4.18.0-425.13.1.el8_7.x86_64 #1 SMP Tue Feb 21 04:20:52 EST 2023 x86_64
User: royaltuning (1001)
PHP: 8.2.32
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/royaltuning/public_html/public/backoffice.royaltuning.hu/app/Models/ShopCategoryMapping.php
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class ShopCategoryMapping extends Model
{
    protected $fillable = [
        'source_shop_id',
        'source_woo_category_id',
        'target_shop_id',
        'target_woo_category_id',
    ];

    public function sourceShop()
    {
        return $this->belongsTo(Shop::class, 'source_shop_id');
    }

    public function targetShop()
    {
        return $this->belongsTo(Shop::class, 'target_shop_id');
    }

    public function sourceCategory()
    {
        return $this->belongsTo(
            ShopCategory::class,
            'source_woo_category_id',
            'woo_category_id'
        )->whereColumn('shop_categories.shop_id', 'shop_category_mappings.source_shop_id');
    }

    public function targetCategory()
    {
        return $this->belongsTo(
            ShopCategory::class,
            'target_woo_category_id',
            'woo_category_id'
        )->whereColumn('shop_categories.shop_id', 'shop_category_mappings.target_shop_id');
    }
}