aboutsummaryrefslogtreecommitdiffhomepage
path: root/api/Posts/Models/Post.php
diff options
context:
space:
mode:
authorMarvin Borner2018-08-24 16:19:39 +0200
committerMarvin Borner2018-08-24 16:19:39 +0200
commitadf07b310bddf751584db0717b8f501b8acda32a (patch)
treec0938cb059337e62c69a5a727dee4808e16cd2bc /api/Posts/Models/Post.php
parent1362cdab92ffd8b8f375f42886e34a6674f2b5af (diff)
Added models for post types
Diffstat (limited to 'api/Posts/Models/Post.php')
-rw-r--r--api/Posts/Models/Post.php41
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');
+ }
+}