<?php

namespace App\Admin\Models;

use Illuminate\Database\Eloquent\Model;

class Feedback extends Model
{
    //
    protected $table = 'feedback';
    public $timestamps = false;
    protected $fillable = [
        'id','content', 'handler', 'mobile',
    ];
    protected $hidden = [];
    protected $casts = [
        'create_time' => 'datetime',
    ];

    public function tags()
    {
        return $this->belongsToMany(Tag::class);
        // return $this->belongsToMany(Tag::class, 'feedback_tag', 'feedback_id', 'tag_id', 'tag', 'id');
    }
}

class Tag extends Model
{
    protected $table = 'tag';
    public $timestamps = false;

    protected $fillable = [
        'id','name'
    ];

    public function feedbacks()
    {
        return $this->belongsToMany(Feedback::class);
        // return $this->belongsToMany(Feedback::class, 'feedback_tag', 'feedback_id', 'tag_id', 'tag', 'id');
    }
}

