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

Lines changed: 6 additions & 0 deletions
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

Lines changed: 5 additions & 0 deletions
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy