|
43 | 43 | * @property-read string $username |
44 | 44 | * @property-read string $avatar_type |
45 | 45 | * @property-read string $profile_photo_url |
46 | | - * @property-read string|null $location |
47 | | - * @property-read string|null $phone_number |
48 | | - * @property-read string|null $github_profile |
49 | | - * @property-read string|null $twitter_profile |
50 | | - * @property-read string|null $linkedin_profile |
51 | | - * @property-read string|null $bio |
52 | | - * @property-read string|null $website |
53 | | - * @property-read string|null $banned_reason |
54 | | - * @property-read array<array-key, mixed>|null $settings |
| 46 | + * @property-read ?string $location |
| 47 | + * @property-read ?string $phone_number |
| 48 | + * @property-read ?string $github_profile |
| 49 | + * @property-read ?string $twitter_profile |
| 50 | + * @property-read ?string $linkedin_profile |
| 51 | + * @property-read ?string $bio |
| 52 | + * @property-read ?string $website |
| 53 | + * @property-read ?string $banned_reason |
| 54 | + * @property-read array<string, mixed>|null $settings |
55 | 55 | * @property-read CarbonInterface|null $email_verified_at |
56 | 56 | * @property-read CarbonInterface|null $last_login_at |
57 | 57 | * @property-read CarbonInterface|null $banned_at |
@@ -92,9 +92,9 @@ final class User extends Authenticatable implements FilamentUser, HasAvatar, Has |
92 | 92 | 'last_active_at', |
93 | 93 | ]; |
94 | 94 |
|
95 | | - public static function findByEmailAddress(string $emailAddress): self |
| 95 | + public static function findByEmailAddress(string $emailAddress): ?self |
96 | 96 | { |
97 | | - return self::query()->where('email', $emailAddress)->firstOrFail(); |
| 97 | + return self::query()->where('email', $emailAddress)->first(); |
98 | 98 | } |
99 | 99 |
|
100 | 100 | public static function findOrCreateSocialUserProvider(SocialUser $socialUser, string $provider, string $role = 'user'): self |
@@ -152,11 +152,7 @@ public function isLoggedInUser(): bool |
152 | 152 |
|
153 | 153 | public function canAccessPanel(Panel $panel): bool |
154 | 154 | { |
155 | | - if (str_ends_with($this->email, '@laravel.cm')) { |
156 | | - return true; |
157 | | - } |
158 | | - |
159 | | - if ($this->isModerator()) { |
| 155 | + if (str_ends_with($this->email, '@laravel.cm') && $this->isModerator()) { |
160 | 156 | return true; |
161 | 157 | } |
162 | 158 |
|
@@ -215,6 +211,9 @@ public function deleteReplies(): void |
215 | 211 | } |
216 | 212 | } |
217 | 213 |
|
| 214 | + /** |
| 215 | + * @return Collection<int, Article> |
| 216 | + */ |
218 | 217 | public function latestArticles(int $amount = 10): Collection |
219 | 218 | { |
220 | 219 | return $this->articles()->latest()->limit($amount)->get(); |
|
0 commit comments