Posts.php 976 Bytes
Newer Older
1 2 3 4 5
<?php

namespace App\Models\Webprofile;

use App\Http\Traits\UuidTrait;
6
use App\Models\Webprofile\De\Posts as DePosts;
7
use App\Models\Webprofile\En\Posts as EnPosts;
8
use App\Models\Webprofile\Sa\Posts as SaPosts;
9
use App\Models\Webprofile\Zh\Posts as ZhPosts;
10
use Illuminate\Database\Eloquent\Model;
11 12 13 14 15 16 17 18 19 20

class Posts extends Model
{
    use UuidTrait;

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

    protected $guarded = [];

21
    public function rCategory()
22 23 24
    {
        return $this->belongsTo(Categories::class, 'categories', 'id');
    }
25 26 27 28 29

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

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

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

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