Skip to content

Commit e51f64e

Browse files
committed
add screenshots 1
1 parent ab3ed26 commit e51f64e

17 files changed

+17
-1
lines changed

app/Models/Tag.php

+6
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@
44

55
use Illuminate\Database\Eloquent\Factories\HasFactory;
66
use Illuminate\Database\Eloquent\Model;
7+
use Illuminate\Database\Eloquent\Relations\HasMany;
78

89
class Tag extends Model
910
{
1011
use HasFactory;
12+
13+
public function posts(): HasMany
14+
{
15+
return $this->hasMany(Post::class, "tag");
16+
}
1117
}

app/Models/User.php

+5
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,9 @@ public function posts(): HasMany
4949
{
5050
return $this->hasMany(Post::class, "author");
5151
}
52+
53+
public function notifications(): HasMany
54+
{
55+
return $this->hasMany(Notification::class, "user_id");
56+
}
5257
}

graphql/post.graphql

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ extend type Query {
33
post(id: ID! @eq): Post @find
44
search(key: String!): [Post]! @all
55
popularPosts: [Post]! @all
6-
myPosts: [Post]! @guard
6+
# myPosts: [Post]! @guard
7+
postsByLike(likes: Int! @eq): [Post] @find
78
}

graphql/tag.graphql

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
extend type Query {
22
tags: [Tag!]! @all
3+
tag(id: ID! @eq): Tag @find
34
}

graphql/types.graphql

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ type User {
88
created_at: String!
99
updated_at: String!
1010
posts: [Post]! @hasMany
11+
notifications: [Notification]! @hasMany
1112
}
1213

1314

@@ -39,6 +40,7 @@ type Tag {
3940
description: String!
4041
created_at: String
4142
updated_at: String
43+
posts: [Post]! @hasMany
4244
}
4345

4446
type Notification {

graphql/user.graphql

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
extend type Query {
22
users: [User!]! @paginate @guard
3+
user(id: ID! @eq): User @find
34
}
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)