diff options
Diffstat (limited to 'api/Posts/Models/Post.php')
-rw-r--r-- | api/Posts/Models/Post.php | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/api/Posts/Models/Post.php b/api/Posts/Models/Post.php new file mode 100644 index 0000000..321c38c --- /dev/null +++ b/api/Posts/Models/Post.php @@ -0,0 +1,41 @@ +<?php + +namespace Api\Posts\Models; + +use Laravel\Passport\HasApiTokens; +use Illuminate\Notifications\Notifiable; +use Illuminate\Database\Eloquent\Model; + +class Post extends Model +{ + use HasApiTokens, Notifiable; + + /** + * The attributes that are mass assignable. + * + * @var array + */ + protected $fillable = [ + 'post_types_id', 'user_id' + ]; + + public function user() + { + return $this->belongsTo('Api\Users\Models\User'); + } + + public function post_type() + { + return $this->belongsTo('Api\Posts\Models\Post'); + } + + public function media_post() + { + return $this->hasOne('Api\Posts\Models\MediaPost'); + } + + public function text_post() + { + return $this->hasOne('Api\Posts\Models\TextPost'); + } +} |