<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use DateTimeInterface;
class Post extends Model
{
/*---este modelo tem duplicacao de estados---STATUS--E---ESTADOS_ID---QUAL DELES VAI SE USAR???----*/
protected $fillable = [
'title', 'description', 'clubs_id', 'photo', 'origin', 'club_default_id', 'status', 'source', 'user_id', 'estados_id'];
public function club(){
return $this->belongsTo('App\Models\Club','clubs_id');
}
public function user(){
return $this->belongsTo('App\User','users_id');
}
public function status(){
return $this->belongsTo('App\Models\Estado','estados_id');
}
public function comments(){
return $this->hasMany('App\Models\PostComment','post_id');
}
protected function serializeDate(DateTimeInterface $date)
{
return $date->format('d-m-Y H:i:s');
}
}