Categories.php 1.03 KB
Newer Older
1 2 3 4 5
<?php

namespace App\Models\Webprofile;

use App\Http\Traits\UuidTrait;
6
use App\Models\Webprofile\De\Categories as DeCategories;
7
use App\Models\Webprofile\En\Categories as EnCategories;
8
use App\Models\Webprofile\Sa\Categories as SaCategories;
9
use App\Models\Webprofile\Zh\Categories as ZhCategories;
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
use Illuminate\Database\Eloquent\Model;

class Categories extends Model
{
    use UuidTrait;

    public $incrementing = false;
    protected $table = 'swp_categories';

    protected $guarded = [];

    public function berita()
    {
        return $this->hasMany(Posts::class, 'id', 'categories');
    }
25 26 27 28 29

    public function rEn()
    {
        return $this->hasOne(EnCategories::class, 'category_id', 'id');
    }
30 31 32 33 34

    public function rDe()
    {
        return $this->hasOne(DeCategories::class, 'category_id', 'id');
    }
35 36 37 38 39

    public function rSa()
    {
        return $this->hasOne(SaCategories::class, 'category_id', 'id');
    }
40 41 42 43 44

    public function rZh()
    {
        return $this->hasOne(ZhCategories::class, 'category_id', 'id');
    }
45
}