<?php

namespace Modules\Linker\Models;

use App\Models\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\MorphTo;

class LinkerRelation extends Model
{

    protected $table = 'linker_relations';

    protected $casts = [
        'params' => 'json',
    ];

    /**
     * Notes   : 隶属链接
     * @Date   : 2021/6/18 4:47 下午
     * @Author : < Jason.C >
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function linker(): BelongsTo
    {
        return $this->belongsTo(Linker::class);
    }

    /**
     * Notes   : 链接对应的模型
     * @Date   : 2021/6/22 2:11 下午
     * @Author : < Jason.C >
     * @return \Illuminate\Database\Eloquent\Relations\MorphTo
     */
    public function model(): MorphTo
    {
        return $this->morphTo();
    }

}
