Current File : //home/tradevaly/prioyshi.com/project/app/Models/Comment.php |
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Comment extends Model
{
protected $fillable = ['product_id', 'user_id','text'];
public function user()
{
return $this->belongsTo('App\Models\User')->withDefault(function ($data) {
foreach($data->getFillable() as $dt){
$data[$dt] = __('Deleted');
}
});
}
public function product()
{
return $this->belongsTo('App\Models\Product')->withDefault(function ($data) {
foreach($data->getFillable() as $dt){
$data[$dt] = __('Deleted');
}
});
}
public function replies()
{
return $this->hasMany('App\Models\Reply');
}
}