├── database ├── .gitignore ├── seeders │ ├── Content │ │ ├── PointsSeeder.php │ │ ├── LikesSeeder.php │ │ ├── RepliesSeeder.php │ │ ├── CommentsSeeder.php │ │ ├── VisitsSeeder.php │ │ ├── MembersSeeder.php │ │ └── DiscussionsSeeder.php │ ├── Referential │ │ ├── ConfigurationSeeder.php │ │ └── NotificationSeeder.php │ ├── ContentSeeder.php │ ├── DatabaseSeeder.php │ ├── Permissions │ │ ├── RolesSeeder.php │ │ └── UserRolesSeeder.php │ └── NotificationSeeder.php ├── factories │ ├── DiscussionVisitFactory.php │ ├── ReplyFactory.php │ ├── DiscussionFactory.php │ ├── UserFactory.php │ ├── LikeFactory.php │ └── CommentFactory.php └── migrations │ ├── 2022_12_24_151236_add_description_to_tags.php │ ├── 2022_12_28_183737_add_is_public_to_discussions.php │ ├── 2022_12_29_091049_add_total_points_to_user.php │ ├── 2022_12_30_133311_add_meta_to_visits.php │ ├── 2022_12_28_135432_add_best_answer_to_replies.php │ ├── 2022_12_30_102655_add_locked_flag_to_discussions.php │ ├── 2022_12_22_124442_create_notifications_table.php │ ├── 2022_12_24_141352_add_resolved_flag_to_discussions.php │ ├── 2022_12_23_103652_create_likes_table.php │ ├── 2014_10_12_100000_create_password_resets_table.php │ ├── 2022_12_22_100059_create_user_roles_table.php │ ├── 2022_12_28_182630_create_configurations_table.php │ ├── 2022_12_22_145752_create_discussion_tags_table.php │ ├── 2022_12_22_095913_create_permissions_table.php │ ├── 2022_12_22_100105_create_role_permissions_table.php │ ├── 2022_12_22_143642_create_tags_table.php │ ├── 2022_12_23_082707_create_followers_table.php │ ├── 2022_12_22_095906_create_roles_table.php │ ├── 2022_12_30_122531_create_discussion_visits_table.php │ ├── 2022_12_29_085520_create_points_table.php │ ├── 2022_12_23_081648_create_comments_table.php │ ├── 2022_12_22_145655_create_discussions_table.php │ ├── 2022_12_30_122544_add_visits_to_discussions.php │ ├── 2022_12_29_183445_create_notifications_table.php │ ├── 2022_12_23_081436_create_replies_table.php │ ├── 2014_10_12_000000_create_users_table.php │ ├── 2019_08_19_000000_create_failed_jobs_table.php │ ├── 2022_12_22_124447_create_user_notifications_table.php │ ├── 2022_12_22_133607_create_socials_table.php │ ├── 2022_12_28_142212_add_settings_to_users.php │ ├── 2022_12_22_083621_create_jobs_table.php │ └── 2019_12_14_000001_create_personal_access_tokens_table.php ├── bootstrap ├── cache │ └── .gitignore └── app.php ├── storage ├── logs │ └── .gitignore ├── app │ ├── public │ │ └── .gitignore │ └── .gitignore └── framework │ ├── testing │ └── .gitignore │ ├── views │ └── .gitignore │ ├── cache │ ├── data │ │ └── .gitignore │ └── .gitignore │ ├── sessions │ └── .gitignore │ └── .gitignore ├── public ├── robots.txt ├── img │ └── socials │ │ ├── google.svg │ │ ├── facebook.svg │ │ ├── twitter.svg │ │ └── github.svg ├── .htaccess └── vendor │ └── amcharts │ └── Animated.js ├── github-contents ├── 1.jpg ├── 2.jpg ├── 3.jpg └── 4.png ├── postcss.config.js ├── tests ├── Unit │ └── ExampleTest.php ├── Feature │ ├── ExampleTest.php │ └── AdminBackendUrlTest.php ├── TestCase.php └── CreatesApplication.php ├── app ├── Http │ ├── Controllers │ │ ├── ForgotPasswordController.php │ │ ├── Controller.php │ │ ├── EmailVerificationController.php │ │ └── LogoutController.php │ ├── Livewire │ │ ├── Tags.php │ │ ├── Discussion │ │ │ ├── ReplyBtn.php │ │ │ ├── MarkAsResolved.php │ │ │ └── Header.php │ │ ├── Layout │ │ │ ├── Notifications.php │ │ │ └── Dialogs │ │ │ │ └── Likes.php │ │ ├── JustRegistered.php │ │ └── Profile │ │ │ ├── Likes.php │ │ │ ├── Comments.php │ │ │ ├── Socials.php │ │ │ ├── Replies.php │ │ │ ├── WorldMapVisits.php │ │ │ ├── Discussions.php │ │ │ └── Details.php │ └── Middleware │ │ ├── EncryptCookies.php │ │ ├── VerifyCsrfToken.php │ │ ├── PreventRequestsDuringMaintenance.php │ │ ├── TrustHosts.php │ │ ├── TrimStrings.php │ │ ├── Authenticate.php │ │ ├── ValidateSignature.php │ │ ├── JustRegistered.php │ │ ├── TrustProxies.php │ │ ├── RedirectIfAuthenticated.php │ │ └── DiscussionMiddleware.php ├── Core │ ├── RoleConstants.php │ ├── FollowerConstants.php │ ├── ConfigurationConstants.php │ ├── PermissionConstants.php │ ├── NotificationConstants.php │ ├── SocialConstants.php │ └── PointsConstants.php ├── Filament │ ├── Resources │ │ ├── TagResource │ │ │ └── Pages │ │ │ │ ├── CreateTag.php │ │ │ │ ├── ViewTag.php │ │ │ │ ├── ListTags.php │ │ │ │ └── EditTag.php │ │ ├── RoleResource │ │ │ └── Pages │ │ │ │ ├── CreateRole.php │ │ │ │ ├── ViewRole.php │ │ │ │ ├── ListRoles.php │ │ │ │ └── EditRole.php │ │ ├── UserResource │ │ │ └── Pages │ │ │ │ ├── CreateUser.php │ │ │ │ ├── ViewUser.php │ │ │ │ ├── ListUsers.php │ │ │ │ └── EditUser.php │ │ ├── PermissionResource │ │ │ └── Pages │ │ │ │ ├── CreatePermission.php │ │ │ │ ├── ViewPermission.php │ │ │ │ ├── ListPermissions.php │ │ │ │ └── EditPermission.php │ │ ├── NotificationResource │ │ │ └── Pages │ │ │ │ ├── CreateNotification.php │ │ │ │ ├── ViewNotification.php │ │ │ │ ├── ListNotifications.php │ │ │ │ └── EditNotification.php │ │ └── ConfigurationResource │ │ │ └── Pages │ │ │ ├── CreateConfiguration.php │ │ │ ├── ViewConfiguration.php │ │ │ ├── ListConfigurations.php │ │ │ └── EditConfiguration.php │ └── Widgets │ │ ├── LatestDiscussions.php │ │ └── LatestReplies.php ├── Models │ ├── Configuration.php │ ├── Social.php │ ├── Permission.php │ ├── Tag.php │ ├── UserRole.php │ ├── Point.php │ ├── Notification.php │ ├── DiscussionTag.php │ ├── Follower.php │ ├── RolePermission.php │ ├── Like.php │ ├── UserNotification.php │ ├── Role.php │ ├── Comment.php │ ├── DiscussionVisit.php │ └── Reply.php ├── Providers │ ├── BroadcastServiceProvider.php │ ├── AuthServiceProvider.php │ ├── EventServiceProvider.php │ ├── RouteServiceProvider.php │ └── AppServiceProvider.php ├── Forms │ └── Components │ │ └── MentionsRichEditor.php ├── Helpers │ └── CustomUserAvatar.php ├── View │ └── Components │ │ ├── Layout.php │ │ ├── Home │ │ └── Tags.php │ │ ├── LayoutProfile.php │ │ └── Profile │ │ └── Stats.php ├── Console │ └── Kernel.php ├── Exceptions │ └── Handler.php └── Notifications │ └── EmailNotification.php ├── resources ├── css │ ├── filament.scss │ └── app.scss ├── views │ ├── partials │ │ ├── layouts │ │ │ └── profile │ │ │ │ ├── roles-tags.blade.php │ │ │ │ └── info.blade.php │ │ ├── dialogs │ │ │ ├── socials-icon │ │ │ │ ├── facebook.blade.php │ │ │ │ ├── google.blade.php │ │ │ │ ├── twitter.blade.php │ │ │ │ └── github.blade.php │ │ │ ├── socials.blade.php │ │ │ ├── login.blade.php │ │ │ ├── sign-up.blade.php │ │ │ └── add-discussion.blade.php │ │ ├── loading-page.blade.php │ │ ├── discussions │ │ │ └── tags.blade.php │ │ ├── home │ │ │ └── side-menu.blade.php │ │ └── profile │ │ │ └── dialogs │ │ │ ├── email.blade.php │ │ │ ├── password.blade.php │ │ │ └── username.blade.php │ ├── profile │ │ ├── likes.blade.php │ │ ├── comments.blade.php │ │ ├── replies.blade.php │ │ ├── discussions.blade.php │ │ ├── best-replies.blade.php │ │ ├── ignoring-discussions.blade.php │ │ ├── following-discussions.blade.php │ │ └── not-following-discussions.blade.php │ ├── livewire │ │ ├── discussion │ │ │ ├── reply-btn.blade.php │ │ │ ├── lock.blade.php │ │ │ ├── mark-as-resolved.blade.php │ │ │ └── reply.blade.php │ │ ├── profile │ │ │ ├── details.blade.php │ │ │ ├── dialogs │ │ │ │ ├── email.blade.php │ │ │ │ ├── password.blade.php │ │ │ │ └── username.blade.php │ │ │ ├── notifications.blade.php │ │ │ ├── avatar.blade.php │ │ │ └── discussions.blade.php │ │ ├── layout │ │ │ ├── dialogs │ │ │ │ ├── register.blade.php │ │ │ │ ├── login.blade.php │ │ │ │ ├── discussion.blade.php │ │ │ │ └── likes.blade.php │ │ │ └── notifications.blade.php │ │ ├── forgot-password.blade.php │ │ └── just-registered.blade.php │ ├── password-reset.blade.php │ ├── registered.blade.php │ ├── components │ │ ├── home │ │ │ └── tags.blade.php │ │ └── layout-profile.blade.php │ ├── tags.blade.php │ ├── home.blade.php │ ├── search.blade.php │ ├── tag.blade.php │ └── forms │ │ └── components │ │ └── mentions-rich-editor.blade.php └── js │ ├── app.js │ └── bootstrap.js ├── .gitattributes ├── .gitignore ├── .editorconfig ├── vite.config.js ├── SECURITY.md ├── lang └── en │ ├── pagination.php │ ├── auth.php │ └── passwords.php ├── routes ├── channels.php ├── api.php └── console.php ├── package.json ├── tailwind.config.js ├── config ├── cors.php ├── view.php ├── notifications.php └── hashing.php ├── LICENSE.md └── phpunit.xml /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite* 2 | -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/cache/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !data/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /github-contents/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devaslanphp/forumium/HEAD/github-contents/1.jpg -------------------------------------------------------------------------------- /github-contents/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devaslanphp/forumium/HEAD/github-contents/2.jpg -------------------------------------------------------------------------------- /github-contents/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devaslanphp/forumium/HEAD/github-contents/3.jpg -------------------------------------------------------------------------------- /github-contents/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devaslanphp/forumium/HEAD/github-contents/4.png -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /tests/Unit/ExampleTest.php: -------------------------------------------------------------------------------- 1 | toBeTrue(); 5 | }); 6 | -------------------------------------------------------------------------------- /tests/Feature/ExampleTest.php: -------------------------------------------------------------------------------- 1 | get('/'); 5 | 6 | $response->assertStatus(200); 7 | }); 8 | -------------------------------------------------------------------------------- /app/Http/Controllers/ForgotPasswordController.php: -------------------------------------------------------------------------------- 1 | 2 | @foreach($user->roles as $role) 3 | {{ $role->name }} 4 | @endforeach 5 | 6 | -------------------------------------------------------------------------------- /resources/views/profile/likes.blade.php: -------------------------------------------------------------------------------- 1 | @php($user = $user ?? auth()->user()) 2 | 3 | 4 | Profile - Likes 5 | 6 |
7 | 8 |
9 | 10 |
11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /public/build 3 | /public/hot 4 | /public/storage 5 | /storage/*.key 6 | /vendor 7 | .env 8 | .env.backup 9 | .env.production 10 | .phpunit.result.cache 11 | Homestead.json 12 | Homestead.yaml 13 | auth.json 14 | npm-debug.log 15 | yarn-error.log 16 | /.fleet 17 | /.idea 18 | /.vscode 19 | -------------------------------------------------------------------------------- /resources/views/profile/comments.blade.php: -------------------------------------------------------------------------------- 1 | @php($user = $user ?? auth()->user()) 2 | 3 | 4 | Profile - Comments 5 | 6 |
7 | 8 |
9 | 10 |
11 | -------------------------------------------------------------------------------- /resources/views/profile/replies.blade.php: -------------------------------------------------------------------------------- 1 | @php($user = $user ?? auth()->user()) 2 | 3 | 4 | Profile - Replies 5 | 6 |
7 | 8 |
9 | 10 |
11 | -------------------------------------------------------------------------------- /resources/views/profile/discussions.blade.php: -------------------------------------------------------------------------------- 1 | @php($user = $user ?? auth()->user()) 2 | 3 | 4 | Profile - Discussions 5 | 6 |
7 | 8 |
9 | 10 |
11 | -------------------------------------------------------------------------------- /app/Core/ConfigurationConstants.php: -------------------------------------------------------------------------------- 1 | first()?->is_enabled ?? false; 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /resources/views/profile/best-replies.blade.php: -------------------------------------------------------------------------------- 1 | @php($user = $user ?? auth()->user()) 2 | 3 | 4 | Profile - Best replies 5 | 6 |
7 | 8 |
9 | 10 |
11 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 4 7 | indent_style = space 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.{yml,yaml}] 15 | indent_size = 2 16 | 17 | [docker-compose.yml] 18 | indent_size = 4 19 | -------------------------------------------------------------------------------- /app/Filament/Resources/TagResource/Pages/CreateTag.php: -------------------------------------------------------------------------------- 1 | user()) 2 | 3 | 4 | Profile - Ignoring discussions 5 | 6 |
7 | 8 |
9 | 10 |
11 | -------------------------------------------------------------------------------- /app/Filament/Resources/RoleResource/Pages/CreateRole.php: -------------------------------------------------------------------------------- 1 | user()) 2 | 3 | 4 | Profile - Following discussions 5 | 6 |
7 | 8 |
9 | 10 |
11 | -------------------------------------------------------------------------------- /resources/views/livewire/discussion/reply-btn.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if(!$discussion->is_locked) 3 | 6 | @endif 7 |
8 | -------------------------------------------------------------------------------- /vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite'; 2 | import laravel from 'laravel-vite-plugin'; 3 | 4 | export default defineConfig({ 5 | plugins: [ 6 | laravel({ 7 | input: [ 8 | 'resources/js/app.js', 9 | 'resources/css/filament.scss' 10 | ], 11 | refresh: true, 12 | }), 13 | ], 14 | }); 15 | -------------------------------------------------------------------------------- /resources/views/profile/not-following-discussions.blade.php: -------------------------------------------------------------------------------- 1 | @php($user = $user ?? auth()->user()) 2 | 3 | 4 | Profile - Not following discussions 5 | 6 |
7 | 8 |
9 | 10 |
11 | -------------------------------------------------------------------------------- /app/Http/Livewire/Tags.php: -------------------------------------------------------------------------------- 1 | tags = Tag::all(); 15 | } 16 | 17 | public function render() 18 | { 19 | return view('livewire.tags'); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | | Version | Supported | 6 | | ------- | ------------------ | 7 | | 1.x | :white_check_mark: | 8 | 9 | ## Reporting a Vulnerability 10 | 11 | If you discover a security vulnerability within Help Desk application, please email me via [eloufirhatim@gmail.com](mailto:eloufirhatim@gmail.com). All security vulnerabilities will be promptly addressed. 12 | -------------------------------------------------------------------------------- /app/Filament/Resources/PermissionResource/Pages/CreatePermission.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Models/Configuration.php: -------------------------------------------------------------------------------- 1 | 'bool' 18 | ]; 19 | } 20 | -------------------------------------------------------------------------------- /resources/views/password-reset.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Forgot password 4 | 5 | 6 |
7 |
8 | 9 |
10 |
11 | 12 |
13 | -------------------------------------------------------------------------------- /app/Filament/Resources/NotificationResource/Pages/CreateNotification.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /resources/views/registered.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Registered 4 | 5 | 6 |
7 |
8 | 9 |
10 |
11 | 12 |
13 | -------------------------------------------------------------------------------- /database/seeders/Content/PointsSeeder.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /app/Http/Controllers/EmailVerificationController.php: -------------------------------------------------------------------------------- 1 | fulfill(); 14 | return redirect()->route('home'); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Controllers/LogoutController.php: -------------------------------------------------------------------------------- 1 | route('home'); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /database/seeders/Content/LikesSeeder.php: -------------------------------------------------------------------------------- 1 | count($this->count) 20 | ->create(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /resources/views/livewire/profile/details.blade.php: -------------------------------------------------------------------------------- 1 |
2 | {{ $this->form }} 3 | 6 |
7 | 8 | -------------------------------------------------------------------------------- /database/seeders/Content/RepliesSeeder.php: -------------------------------------------------------------------------------- 1 | count($this->count) 20 | ->create(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /resources/views/components/home/tags.blade.php: -------------------------------------------------------------------------------- 1 | @foreach($tags as $t) 2 | 3 | 4 | {{ $t->name }} 5 | 6 | @endforeach 7 | -------------------------------------------------------------------------------- /resources/views/livewire/layout/dialogs/register.blade.php: -------------------------------------------------------------------------------- 1 |
2 | {{ $this->form }} 3 | 6 |
7 | -------------------------------------------------------------------------------- /resources/views/livewire/profile/dialogs/email.blade.php: -------------------------------------------------------------------------------- 1 |
2 | {{ $this->form }} 3 | 6 |
7 | -------------------------------------------------------------------------------- /resources/views/livewire/profile/dialogs/password.blade.php: -------------------------------------------------------------------------------- 1 |
2 | {{ $this->form }} 3 | 6 |
7 | -------------------------------------------------------------------------------- /resources/views/livewire/profile/dialogs/username.blade.php: -------------------------------------------------------------------------------- 1 |
2 | {{ $this->form }} 3 | 6 |
7 | -------------------------------------------------------------------------------- /app/Http/Middleware/PreventRequestsDuringMaintenance.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustHosts.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | public function hosts() 15 | { 16 | return [ 17 | $this->allSubdomainsOfApplicationUrl(), 18 | ]; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /database/seeders/Content/CommentsSeeder.php: -------------------------------------------------------------------------------- 1 | count($this->count) 20 | ->create(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrimStrings.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | 'current_password', 16 | 'password', 17 | 'password_confirmation', 18 | ]; 19 | } 20 | -------------------------------------------------------------------------------- /resources/views/livewire/profile/notifications.blade.php: -------------------------------------------------------------------------------- 1 |
2 | {{ $this->form }} 3 | 6 |
7 | 8 | -------------------------------------------------------------------------------- /tests/CreatesApplication.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 19 | 20 | return $app; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/Filament/Resources/TagResource/Pages/ViewTag.php: -------------------------------------------------------------------------------- 1 | discussion->refresh(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /public/img/socials/google.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/Filament/Resources/ConfigurationResource/Pages/ViewConfiguration.php: -------------------------------------------------------------------------------- 1 | expectsJson()) { 18 | return route('login'); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/Http/Middleware/ValidateSignature.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 'fbclid', 16 | // 'utm_campaign', 17 | // 'utm_content', 18 | // 'utm_medium', 19 | // 'utm_source', 20 | // 'utm_term', 21 | ]; 22 | } 23 | -------------------------------------------------------------------------------- /resources/views/tags.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Tags 4 | 5 | 6 |
7 |
8 | 11 |
12 | 13 |
14 |
15 |
16 | 17 |
18 | -------------------------------------------------------------------------------- /app/Filament/Resources/PermissionResource/Pages/EditPermission.php: -------------------------------------------------------------------------------- 1 | belongsTo(User::class, 'user_id', 'id'); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /resources/views/home.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Home page 4 | 5 | 6 |
7 |
8 | 11 |
12 | 13 |
14 |
15 |
16 | 17 |
18 | -------------------------------------------------------------------------------- /app/Filament/Resources/NotificationResource/Pages/EditNotification.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Search - {{ request('q') }} 4 | 5 | 6 |
7 |
8 | 11 |
12 | 13 |
14 |
15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /app/Forms/Components/MentionsRichEditor.php: -------------------------------------------------------------------------------- 1 | mentionsItems = $mentionsItems; 16 | 17 | return $this; 18 | } 19 | 20 | public function getMentionsItems(): array 21 | { 22 | return $this->mentionsItems; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /app/Models/Permission.php: -------------------------------------------------------------------------------- 1 | belongsToMany(Role::class, 'role_permissions', 'permission_id', 'role_id'); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /resources/views/livewire/discussion/lock.blade.php: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /resources/views/partials/discussions/tags.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @foreach($tags as $tag) 3 | 5 | {{ $tag->name }} 6 | 7 | @endforeach 8 |
9 | -------------------------------------------------------------------------------- /app/Models/Tag.php: -------------------------------------------------------------------------------- 1 | belongsToMany(Discussion::class, 'discussion_tags', 'tag_id', 'discussion_id'); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 18 | }); 19 | -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | get('/user', function (Request $request) { 18 | return $request->user(); 19 | }); 20 | -------------------------------------------------------------------------------- /app/Http/Livewire/Layout/Notifications.php: -------------------------------------------------------------------------------- 1 | unreadNotificationsCount = auth()->user()?->unreadNotifications()?->count() ?? 0; 14 | return view('livewire.layout.notifications'); 15 | } 16 | 17 | public function openNotifications() 18 | { 19 | $this->dispatchBrowserEvent('open-modal', ['id' => 'database-notifications']); 20 | $this->emit('notificationsSent'); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 19 | })->purpose('Display an inspiring quote'); 20 | -------------------------------------------------------------------------------- /app/Models/UserRole.php: -------------------------------------------------------------------------------- 1 | belongsTo(User::class, 'user_id', 'id'); 22 | } 23 | 24 | public function role(): BelongsTo 25 | { 26 | return $this->belongsTo(Role::class, 'role_id', 'id'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews -Indexes 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Handle Authorization Header 9 | RewriteCond %{HTTP:Authorization} . 10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 11 | 12 | # Redirect Trailing Slashes If Not A Folder... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_URI} (.+)/$ 15 | RewriteRule ^ %1 [L,R=301] 16 | 17 | # Send Requests To Front Controller... 18 | RewriteCond %{REQUEST_FILENAME} !-d 19 | RewriteCond %{REQUEST_FILENAME} !-f 20 | RewriteRule ^ index.php [L] 21 | 22 | -------------------------------------------------------------------------------- /app/Helpers/CustomUserAvatar.php: -------------------------------------------------------------------------------- 1 | {$field}) { 21 | return asset('storage/' . $user->{$field}); 22 | } 23 | return (new UiAvatarsProvider())->get($user); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /app/Models/Point.php: -------------------------------------------------------------------------------- 1 | belongsTo(User::class, 'user_id', 'id'); 21 | } 22 | 23 | public function source(): MorphTo 24 | { 25 | return $this->morphTo(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/View/Components/Layout.php: -------------------------------------------------------------------------------- 1 | title = $title; 19 | } 20 | 21 | /** 22 | * Get the view / contents that represent the component. 23 | * 24 | * @return \Illuminate\Contracts\View\View|\Closure|string 25 | */ 26 | public function render() 27 | { 28 | return view('components.layout'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /resources/views/livewire/layout/notifications.blade.php: -------------------------------------------------------------------------------- 1 | @if(auth()->user() && auth()->user()->hasVerifiedEmail()) 2 | 13 | @endif 14 | -------------------------------------------------------------------------------- /app/Models/Notification.php: -------------------------------------------------------------------------------- 1 | belongsToMany(User::class, 'user_notifications', 'notification_id', 'user_id')->withPivot(['via_web', 'via_email']); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /app/Models/DiscussionTag.php: -------------------------------------------------------------------------------- 1 | belongsTo(Tag::class, 'tag_id', 'id'); 22 | } 23 | 24 | public function discussion(): BelongsTo 25 | { 26 | return $this->belongsTo(Discussion::class, 'discussion_id', 'id'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /database/factories/DiscussionVisitFactory.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | class DiscussionVisitFactory extends Factory 13 | { 14 | /** 15 | * Define the model's default state. 16 | * 17 | * @return array 18 | */ 19 | public function definition() 20 | { 21 | return [ 22 | 'user_id' => User::all()->random()->id, 23 | 'discussion_id' => Discussion::all()->random()->id 24 | ]; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/Http/Livewire/JustRegistered.php: -------------------------------------------------------------------------------- 1 | userObj = User::where('id', $this->user)->first(); 17 | } 18 | 19 | public function render() 20 | { 21 | return view('livewire.just-registered'); 22 | } 23 | 24 | public function resend() 25 | { 26 | $this->userObj->sendEmailVerificationNotification(); 27 | Filament::notify('success', 'Verification link sent'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/Models/Follower.php: -------------------------------------------------------------------------------- 1 | belongsTo(User::class, 'user_id', 'id'); 22 | } 23 | 24 | public function discussion(): BelongsTo 25 | { 26 | return $this->belongsTo(Discussion::class, 'discussion_id', 'id'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Models/RolePermission.php: -------------------------------------------------------------------------------- 1 | belongsTo(Role::class, 'role_id', 'id'); 22 | } 23 | 24 | public function permission(): BelongsTo 25 | { 26 | return $this->belongsTo(Permission::class, 'permission_id', 'id'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Models/Like.php: -------------------------------------------------------------------------------- 1 | belongsTo(User::class, 'user_id', 'id'); 22 | } 23 | 24 | public function source(): MorphTo 25 | { 26 | return $this->morphTo(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Http/Middleware/JustRegistered.php: -------------------------------------------------------------------------------- 1 | has('registered')) { 20 | return redirect()->route('home'); 21 | } 22 | return $next($request); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/Core/NotificationConstants.php: -------------------------------------------------------------------------------- 1 | 'These credentials do not match our records.', 17 | 'password' => 'The provided password is incorrect.', 18 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 19 | 20 | ]; 21 | -------------------------------------------------------------------------------- /app/Models/UserNotification.php: -------------------------------------------------------------------------------- 1 | belongsTo(User::class, 'user_id', 'id'); 22 | } 23 | 24 | public function notification(): BelongsTo 25 | { 26 | return $this->belongsTo(Notification::class, 'notification_id', 'id'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/View/Components/Home/Tags.php: -------------------------------------------------------------------------------- 1 | tag = $tag; 21 | $this->tags = Tag::all(); 22 | } 23 | 24 | /** 25 | * Get the view / contents that represent the component. 26 | * 27 | * @return \Illuminate\Contracts\View\View|\Closure|string 28 | */ 29 | public function render() 30 | { 31 | return view('components.home.tags'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/Providers/AuthServiceProvider.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | protected $policies = [ 16 | // 'App\Models\Model' => 'App\Policies\ModelPolicy', 17 | ]; 18 | 19 | /** 20 | * Register any authentication / authorization services. 21 | * 22 | * @return void 23 | */ 24 | public function boot() 25 | { 26 | $this->registerPolicies(); 27 | 28 | // 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustProxies.php: -------------------------------------------------------------------------------- 1 | |string|null 14 | */ 15 | protected $proxies; 16 | 17 | /** 18 | * The headers that should be used to detect proxies. 19 | * 20 | * @var int 21 | */ 22 | protected $headers = 23 | Request::HEADER_X_FORWARDED_FOR | 24 | Request::HEADER_X_FORWARDED_HOST | 25 | Request::HEADER_X_FORWARDED_PORT | 26 | Request::HEADER_X_FORWARDED_PROTO | 27 | Request::HEADER_X_FORWARDED_AWS_ELB; 28 | } 29 | -------------------------------------------------------------------------------- /app/Models/Role.php: -------------------------------------------------------------------------------- 1 | belongsToMany(User::class, 'user_roles', 'role_id', 'user_id'); 21 | } 22 | 23 | public function permissions(): BelongsToMany 24 | { 25 | return $this->belongsToMany(Permission::class, 'role_permissions', 'role_id', 'permission_id'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /public/img/socials/facebook.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /database/migrations/2022_12_24_151236_add_description_to_tags.php: -------------------------------------------------------------------------------- 1 | longText('description'); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | * 24 | * @return void 25 | */ 26 | public function down() 27 | { 28 | Schema::table('tags', function (Blueprint $table) { 29 | $table->dropColumn('description'); 30 | }); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /database/factories/ReplyFactory.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | class ReplyFactory extends Factory 13 | { 14 | /** 15 | * Define the model's default state. 16 | * 17 | * @return array 18 | */ 19 | public function definition() 20 | { 21 | return [ 22 | 'content' => '

' . fake()->paragraphs(3, true) . '

', 23 | 'user_id' => User::all()->random()->id, 24 | 'discussion_id' => Discussion::all()->random()->id, 25 | 'is_best' => collect([true, false])->random(), 26 | ]; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire')->hourly(); 19 | } 20 | 21 | /** 22 | * Register the commands for the application. 23 | * 24 | * @return void 25 | */ 26 | protected function commands() 27 | { 28 | $this->load(__DIR__.'/Commands'); 29 | 30 | require base_path('routes/console.php'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /database/migrations/2022_12_28_183737_add_is_public_to_discussions.php: -------------------------------------------------------------------------------- 1 | boolean('is_public'); 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | * 23 | * @return void 24 | */ 25 | public function down() 26 | { 27 | Schema::table('discussions', function (Blueprint $table) { 28 | $table->dropColumn('is_public'); 29 | }); 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /database/migrations/2022_12_29_091049_add_total_points_to_user.php: -------------------------------------------------------------------------------- 1 | bigInteger('total_points')->default(0); 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | * 23 | * @return void 24 | */ 25 | public function down() 26 | { 27 | Schema::table('users', function (Blueprint $table) { 28 | $table->dropColumn('total_points'); 29 | }); 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /database/migrations/2022_12_30_133311_add_meta_to_visits.php: -------------------------------------------------------------------------------- 1 | longText('meta')->nullable(); 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | * 23 | * @return void 24 | */ 25 | public function down() 26 | { 27 | Schema::table('discussion_visits', function (Blueprint $table) { 28 | $table->dropColumn('meta'); 29 | }); 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /database/migrations/2022_12_28_135432_add_best_answer_to_replies.php: -------------------------------------------------------------------------------- 1 | boolean('is_best')->default(false); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | * 24 | * @return void 25 | */ 26 | public function down() 27 | { 28 | Schema::table('replies', function (Blueprint $table) { 29 | $table->dropColumn('is_best'); 30 | }); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /lang/en/passwords.php: -------------------------------------------------------------------------------- 1 | 'Your password has been reset!', 17 | 'sent' => 'We have emailed your password reset link!', 18 | 'throttled' => 'Please wait before retrying.', 19 | 'token' => 'This password reset token is invalid.', 20 | 'user' => "We can't find a user with that email address.", 21 | 22 | ]; 23 | -------------------------------------------------------------------------------- /database/migrations/2022_12_30_102655_add_locked_flag_to_discussions.php: -------------------------------------------------------------------------------- 1 | boolean('is_locked')->default(false); 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | * 23 | * @return void 24 | */ 25 | public function down() 26 | { 27 | Schema::table('discussions', function (Blueprint $table) { 28 | $table->dropColumn('is_locked'); 29 | }); 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /database/migrations/2022_12_22_124442_create_notifications_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('name'); 18 | $table->timestamps(); 19 | $table->softDeletes(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('app_notifications'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /database/migrations/2022_12_24_141352_add_resolved_flag_to_discussions.php: -------------------------------------------------------------------------------- 1 | boolean('is_resolved')->default(false); 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | * 23 | * @return void 24 | */ 25 | public function down() 26 | { 27 | Schema::table('discussions', function (Blueprint $table) { 28 | $table->dropColumn('is_resolved'); 29 | }); 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /database/migrations/2022_12_23_103652_create_likes_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->foreignId('user_id')->constrained('users'); 19 | $table->morphs('source'); 20 | $table->timestamps(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::dropIfExists('likes'); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_100000_create_password_resets_table.php: -------------------------------------------------------------------------------- 1 | string('email')->index(); 18 | $table->string('token'); 19 | $table->timestamp('created_at')->nullable(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('password_resets'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /database/migrations/2022_12_22_100059_create_user_roles_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->foreignId('user_id')->constrained('users'); 19 | $table->foreignId('role_id')->constrained('roles'); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('user_roles'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /database/migrations/2022_12_28_182630_create_configurations_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('name'); 19 | $table->boolean('is_enabled'); 20 | $table->timestamps(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::dropIfExists('configurations'); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /database/seeders/Referential/ConfigurationSeeder.php: -------------------------------------------------------------------------------- 1 | "Enable registration", 13 | "is_enabled" => true 14 | ], 15 | [ 16 | "name" => "Enable public discussions", 17 | "is_enabled" => true 18 | ], 19 | ]; 20 | 21 | /** 22 | * Run the database seeds. 23 | * 24 | * @return void 25 | */ 26 | public function run() 27 | { 28 | foreach ($this->data as $item) { 29 | if (!Configuration::where('name', $item['name'])->count()) { 30 | Configuration::create($item); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /resources/views/livewire/layout/dialogs/login.blade.php: -------------------------------------------------------------------------------- 1 |
2 | {{ $this->form }} 3 | 6 |
7 | 10 |
11 |
12 | -------------------------------------------------------------------------------- /database/migrations/2022_12_22_145752_create_discussion_tags_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->foreignId('discussion_id')->constrained('discussions'); 19 | $table->foreignId('tag_id')->constrained('tags'); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('discussion_tags'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /database/migrations/2022_12_22_095913_create_permissions_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('name'); 18 | $table->longText('description'); 19 | $table->timestamps(); 20 | $table->softDeletes(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::dropIfExists('permissions'); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /database/migrations/2022_12_22_100105_create_role_permissions_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->foreignId('role_id')->constrained('roles'); 19 | $table->foreignId('permission_id')->constrained('permissions'); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('role_permissions'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /database/migrations/2022_12_22_143642_create_tags_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('name'); 19 | $table->string('color'); 20 | $table->string('icon'); 21 | $table->timestamps(); 22 | $table->softDeletes(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('tags'); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /database/migrations/2022_12_23_082707_create_followers_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->foreignId('user_id')->constrained('users'); 18 | $table->foreignId('discussion_id')->constrained('discussions'); 19 | $table->string('type'); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('followers'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /database/migrations/2022_12_22_095906_create_roles_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('name'); 19 | $table->string('color'); 20 | $table->longText('description'); 21 | $table->timestamps(); 22 | $table->softDeletes(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('roles'); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /app/Http/Livewire/Discussion/MarkAsResolved.php: -------------------------------------------------------------------------------- 1 | discussion->is_resolved = !$this->discussion->is_resolved; 21 | $this->discussion->save(); 22 | Filament::notify( 23 | 'success', 24 | match ($this->discussion->is_resolved) { 25 | true => 'Discussion marked as resolved.', 26 | false => 'Discussion reopened.' 27 | } 28 | ); 29 | $this->emit('resolvedFlagUpdated'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /database/migrations/2022_12_30_122531_create_discussion_visits_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->foreignId('user_id')->constrained('users'); 19 | $table->foreignId('discussion_id')->constrained('discussions'); 20 | $table->timestamps(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::dropIfExists('discussion_visits'); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "vite", 5 | "build": "vite build" 6 | }, 7 | "devDependencies": { 8 | "@awcodes/alpine-floating-ui": "^3.4.0", 9 | "@fortawesome/fontawesome-free": "^6.2.1", 10 | "@tailwindcss/forms": "^0.5.3", 11 | "@tailwindcss/jit": "^0.1.18", 12 | "@tailwindcss/typography": "^0.5.8", 13 | "alpinejs": "^3.10.5", 14 | "autoprefixer": "^10.4.13", 15 | "axios": "^1.1.2", 16 | "flowbite": "^1.5.5", 17 | "laravel-vite-plugin": "^0.7.2", 18 | "lodash": "^4.17.19", 19 | "postcss": "^8.4.20", 20 | "sass": "^1.57.1", 21 | "tailwindcss": "^3.2.4", 22 | "tailwindcss-textshadow": "^2.1.3", 23 | "vite": "^4.0.0" 24 | }, 25 | "dependencies": { 26 | "@thoughtbot/trix-mentions-element": "^0.1.2", 27 | "tributejs": "^5.1.3" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | const colors = require('tailwindcss/colors') 3 | 4 | module.exports = { 5 | mode: 'jit', 6 | content: [ 7 | './resources/**/*.blade.php', 8 | './resources/**/*.js', 9 | './node_modules/flowbite/**/*.js', 10 | './vendor/filament/**/*.blade.php', 11 | './app/Http/Livewire/**/*.php', 12 | './app/Filament/Resources/**/*.php' 13 | ], 14 | theme: { 15 | extend: { 16 | colors: { 17 | danger: colors.rose, 18 | primary: colors.blue, 19 | success: colors.green, 20 | warning: colors.yellow, 21 | }, 22 | }, 23 | }, 24 | plugins: [ 25 | require('flowbite/plugin'), 26 | require('@tailwindcss/forms'), 27 | require('@tailwindcss/typography'), 28 | require('tailwindcss-textshadow') 29 | ], 30 | } 31 | -------------------------------------------------------------------------------- /database/factories/DiscussionFactory.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | class DiscussionFactory extends Factory 13 | { 14 | /** 15 | * Define the model's default state. 16 | * 17 | * @return array 18 | */ 19 | public function definition() 20 | { 21 | return [ 22 | 'name' => fake()->text(100), 23 | 'content' => '

' . fake()->paragraphs(3, true) . '

', 24 | 'user_id' => User::all()->random()->id, 25 | 'is_resolved' => collect([true, false])->random(), 26 | 'is_public' => collect([true, false])->random(), 27 | 'is_locked' => collect([true, false])->random(), 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /database/migrations/2022_12_29_085520_create_points_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->foreignId('user_id')->constrained('users'); 19 | $table->string('type'); 20 | $table->morphs('source'); 21 | $table->integer('value'); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('points'); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /app/Models/Comment.php: -------------------------------------------------------------------------------- 1 | belongsTo(User::class, 'user_id', 'id'); 23 | } 24 | 25 | public function source(): MorphTo 26 | { 27 | return $this->morphTo(); 28 | } 29 | 30 | public function likes(): MorphMany 31 | { 32 | return $this->morphMany(Like::class, 'source'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /database/migrations/2022_12_23_081648_create_comments_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->longText('content'); 19 | $table->foreignId('user_id')->constrained('users'); 20 | $table->morphs('source'); 21 | $table->timestamps(); 22 | $table->softDeletes(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('comments'); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /database/migrations/2022_12_22_145655_create_discussions_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('name'); 18 | $table->longText('content'); 19 | $table->foreignId('user_id')->constrained('users'); 20 | $table->timestamps(); 21 | $table->softDeletes(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::dropIfExists('discussions'); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /database/migrations/2022_12_30_122544_add_visits_to_discussions.php: -------------------------------------------------------------------------------- 1 | bigInteger('visits')->default(0); 18 | $table->bigInteger('unique_visits')->default(0); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | * 25 | * @return void 26 | */ 27 | public function down() 28 | { 29 | Schema::table('discussions', function (Blueprint $table) { 30 | $table->dropColumn('visits'); 31 | $table->dropColumn('unique_visits'); 32 | }); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /app/Http/Livewire/Layout/Dialogs/Likes.php: -------------------------------------------------------------------------------- 1 | initData(); 22 | } 23 | 24 | public function render() 25 | { 26 | return view('livewire.layout.dialogs.likes'); 27 | } 28 | 29 | public function likesUpdated(int $id) 30 | { 31 | if ($this->model->id == $id) { 32 | $this->model->refresh(); 33 | $this->initData(); 34 | } 35 | } 36 | 37 | private function initData() 38 | { 39 | $this->likes = $this->model->likes->sortByDesc('created_at'); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /resources/views/livewire/forgot-password.blade.php: -------------------------------------------------------------------------------- 1 |
3 | 4 | Reset your password 5 | 6 | 7 | Choose a new password to your account and submit the form to reset your password. 8 | 9 |
10 | {{ $this->form }} 11 | 15 |
16 |
17 | -------------------------------------------------------------------------------- /database/migrations/2022_12_29_183445_create_notifications_table.php: -------------------------------------------------------------------------------- 1 | uuid('id')->primary(); 18 | $table->string('type'); 19 | $table->morphs('notifiable'); 20 | $table->text('data'); 21 | $table->timestamp('read_at')->nullable(); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('notifications'); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /database/seeders/Content/VisitsSeeder.php: -------------------------------------------------------------------------------- 1 | count($this->count) 21 | ->create() 22 | ->each(function (DiscussionVisit $visit) { 23 | $ip = fake()->ipv4(); 24 | $location = Location::get($ip); 25 | $visit->meta = [ 26 | 'ip' => $ip, 27 | 'browser' => fake()->userAgent(), 28 | 'location' => $location ? $location->toArray() : [] 29 | ]; 30 | $visit->save(); 31 | }); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /database/migrations/2022_12_23_081436_create_replies_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->longText('content'); 19 | $table->foreignId('user_id')->constrained('users'); 20 | $table->foreignId('discussion_id')->constrained('discussions'); 21 | $table->timestamps(); 22 | $table->softDeletes(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('replies'); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /config/cors.php: -------------------------------------------------------------------------------- 1 | ['api/*', 'sanctum/csrf-cookie'], 19 | 20 | 'allowed_methods' => ['*'], 21 | 22 | 'allowed_origins' => ['*'], 23 | 24 | 'allowed_origins_patterns' => [], 25 | 26 | 'allowed_headers' => ['*'], 27 | 28 | 'exposed_headers' => [], 29 | 30 | 'max_age' => 0, 31 | 32 | 'supports_credentials' => false, 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /resources/views/components/layout-profile.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{ $title }} 4 | 5 |
6 |
7 | 8 | @include('partials.layouts.profile.info', compact('user')) 9 |
10 |
11 | 12 |
13 |
14 |
15 | @include('partials.layouts.profile.side-menu', compact('user')) 16 |
17 |
18 | 19 | {{ $slot }} 20 | 21 |
22 |
23 |
24 | 25 |
26 | -------------------------------------------------------------------------------- /app/View/Components/LayoutProfile.php: -------------------------------------------------------------------------------- 1 | user = $user ?? auth()->user(); 22 | $this->title = $title; 23 | $this->bestAnswers = $this->user->replies()->where('is_best', true)->count(); 24 | } 25 | 26 | /** 27 | * Get the view / contents that represent the component. 28 | * 29 | * @return \Illuminate\Contracts\View\View|\Closure|string 30 | */ 31 | public function render() 32 | { 33 | return view('components.layout-profile'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('name'); 19 | $table->string('email')->unique(); 20 | $table->timestamp('email_verified_at')->nullable(); 21 | $table->string('password'); 22 | $table->rememberToken(); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('users'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /resources/css/app.scss: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | @import 'flash.css'; 6 | 7 | @import '../../vendor/filament/forms/dist/module.esm.css'; 8 | 9 | @import '@fortawesome/fontawesome-free/css/all.min.css'; 10 | 11 | [x-cloack] { 12 | display: none; 13 | } 14 | 15 | *::-webkit-scrollbar-track { 16 | @apply bg-slate-200; 17 | 18 | &:hover { 19 | @apply hover:bg-slate-300; 20 | } 21 | } 22 | 23 | *::-webkit-scrollbar { 24 | @apply bg-slate-200; 25 | 26 | width: 8px; 27 | height: 8px; 28 | 29 | &:hover { 30 | @apply hover:bg-slate-300; 31 | } 32 | } 33 | 34 | *::-webkit-scrollbar-thumb { 35 | @apply bg-slate-400; 36 | 37 | &:hover { 38 | @apply hover:bg-slate-500; 39 | } 40 | } 41 | 42 | .hovered-section { 43 | .hover-action { 44 | @apply hidden; 45 | } 46 | 47 | &:hover { 48 | .hover-action { 49 | @apply flex; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/Models/DiscussionVisit.php: -------------------------------------------------------------------------------- 1 | 'object' 19 | ]; 20 | 21 | public static function boot() 22 | { 23 | parent::boot(); 24 | 25 | static::created(function (DiscussionVisit $item) { 26 | $item->discussion->updateVisits(); 27 | }); 28 | } 29 | 30 | public function user(): BelongsTo 31 | { 32 | return $this->belongsTo(User::class, 'user_id', 'id'); 33 | } 34 | 35 | public function discussion(): BelongsTo 36 | { 37 | return $this->belongsTo(Discussion::class, 'discussion_id', 'id'); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /database/seeders/ContentSeeder.php: -------------------------------------------------------------------------------- 1 | call(MembersSeeder::class); 25 | $this->call(DiscussionsSeeder::class); 26 | $this->call(RepliesSeeder::class); 27 | $this->call(CommentsSeeder::class); 28 | $this->call(LikesSeeder::class); 29 | $this->call(PointsSeeder::class); 30 | $this->call(VisitsSeeder::class); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /database/migrations/2019_08_19_000000_create_failed_jobs_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('uuid')->unique(); 19 | $table->text('connection'); 20 | $table->text('queue'); 21 | $table->longText('payload'); 22 | $table->longText('exception'); 23 | $table->timestamp('failed_at')->useCurrent(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('failed_jobs'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /database/migrations/2022_12_22_124447_create_user_notifications_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->foreignId('user_id')->constrained('users'); 18 | $table->foreignId('notification_id')->constrained('app_notifications'); 19 | $table->boolean('via_web')->default(false); 20 | $table->boolean('via_email')->default(false); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::dropIfExists('user_notifications'); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /database/migrations/2022_12_22_133607_create_socials_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('provider'); 19 | $table->string('token'); 20 | $table->foreignId('user_id')->constrained('users'); 21 | $table->string('name'); 22 | $table->string('email'); 23 | $table->timestamps(); 24 | $table->softDeletes(); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | * 31 | * @return void 32 | */ 33 | public function down() 34 | { 35 | Schema::dropIfExists('socials'); 36 | } 37 | }; 38 | -------------------------------------------------------------------------------- /resources/views/partials/dialogs/socials-icon/twitter.blade.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/views/partials/dialogs/socials.blade.php: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | Or sign up with 5 |
6 |
7 |
8 | @foreach(Socials::enabledCases() as $social) 9 | 11 | @include('partials.dialogs.socials-icon.' . $social) 12 | {{ $social }} 13 | 14 | @endforeach 15 |
16 |
17 | -------------------------------------------------------------------------------- /app/Http/Middleware/RedirectIfAuthenticated.php: -------------------------------------------------------------------------------- 1 | check()) { 26 | return redirect(RouteServiceProvider::HOME); 27 | } 28 | } 29 | 30 | return $next($request); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /database/migrations/2022_12_28_142212_add_settings_to_users.php: -------------------------------------------------------------------------------- 1 | longText('bio')->nullable(); 18 | $table->boolean('is_email_visible')->default(false); 19 | $table->string('picture')->nullable(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::table('users', function (Blueprint $table) { 31 | $table->dropColumn('bio'); 32 | $table->dropColumn('is_email_visible'); 33 | $table->dropColumn('picture'); 34 | }); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /database/migrations/2022_12_22_083621_create_jobs_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 18 | $table->string('queue')->index(); 19 | $table->longText('payload'); 20 | $table->unsignedTinyInteger('attempts'); 21 | $table->unsignedInteger('reserved_at')->nullable(); 22 | $table->unsignedInteger('available_at'); 23 | $table->unsignedInteger('created_at'); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('jobs'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /app/Http/Livewire/Profile/Likes.php: -------------------------------------------------------------------------------- 1 | loadData(); 21 | return view('livewire.profile.likes', compact('likes')); 22 | } 23 | 24 | public function loadMore() 25 | { 26 | $this->limitPerPage = $this->limitPerPage + 6; 27 | } 28 | 29 | public function loadData() 30 | { 31 | $query = Like::query(); 32 | $query->where('user_id', $this->user->id); 33 | 34 | $data = $query->paginate($this->limitPerPage); 35 | if ($data->hasMorePages()) { 36 | $this->disableLoadMore = false; 37 | } else { 38 | $this->disableLoadMore = true; 39 | } 40 | 41 | return $data; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/Models/Reply.php: -------------------------------------------------------------------------------- 1 | belongsTo(User::class, 'user_id', 'id'); 22 | } 23 | 24 | public function discussion(): BelongsTo 25 | { 26 | return $this->belongsTo(Discussion::class, 'discussion_id', 'id'); 27 | } 28 | 29 | public function comments(): MorphMany 30 | { 31 | return $this->morphMany(Comment::class, 'source'); 32 | } 33 | 34 | public function likes(): MorphMany 35 | { 36 | return $this->morphMany(Like::class, 'source'); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /resources/views/livewire/discussion/mark-as-resolved.blade.php: -------------------------------------------------------------------------------- 1 |
2 | @if( 3 | (auth()->user() && auth()->user()->hasVerifiedEmail()) && 4 | ( 5 | auth()->user()->id === $discussion->user_id 6 | || auth()->user()->can(Permissions::EDIT_POSTS->value) 7 | ) 8 | ) 9 | 17 | @endif 18 |
19 | -------------------------------------------------------------------------------- /database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->morphs('tokenable'); 19 | $table->string('name'); 20 | $table->string('token', 64)->unique(); 21 | $table->text('abilities')->nullable(); 22 | $table->timestamp('last_used_at')->nullable(); 23 | $table->timestamp('expires_at')->nullable(); 24 | $table->timestamps(); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | * 31 | * @return void 32 | */ 33 | public function down() 34 | { 35 | Schema::dropIfExists('personal_access_tokens'); 36 | } 37 | }; 38 | -------------------------------------------------------------------------------- /app/Http/Livewire/Profile/Comments.php: -------------------------------------------------------------------------------- 1 | loadData(); 22 | return view('livewire.profile.comments', compact('comments')); 23 | } 24 | 25 | public function loadMore() 26 | { 27 | $this->limitPerPage = $this->limitPerPage + 6; 28 | } 29 | 30 | public function loadData() 31 | { 32 | $query = Comment::query(); 33 | $query->where('user_id', $this->user->id); 34 | 35 | $data = $query->paginate($this->limitPerPage); 36 | if ($data->hasMorePages()) { 37 | $this->disableLoadMore = false; 38 | } else { 39 | $this->disableLoadMore = true; 40 | } 41 | 42 | return $data; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /public/vendor/amcharts/Animated.js: -------------------------------------------------------------------------------- 1 | "use strict";(self.webpackChunk_am5=self.webpackChunk_am5||[]).push([[4837],{9295:function(t,e,i){i.r(e),i.d(e,{am5themes_Animated:function(){return r}});var n=i(5125),a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,n.ZT)(e,t),Object.defineProperty(e.prototype,"setupDefaultRules",{enumerable:!1,configurable:!0,writable:!0,value:function(){t.prototype.setupDefaultRules.call(this),this.rule("Component").setAll({interpolationDuration:600}),this.rule("Hierarchy").set("animationDuration",600),this.rule("Scrollbar").set("animationDuration",600),this.rule("Tooltip").set("animationDuration",300),this.rule("MapChart").set("animationDuration",1e3),this.rule("MapChart").set("wheelDuration",300),this.rule("Entity").setAll({stateAnimationDuration:600}),this.rule("Sprite").states.create("default",{stateAnimationDuration:600}),this.rule("Tooltip",["axis"]).setAll({animationDuration:200}),this.rule("WordCloud").set("animationDuration",500)}}),e}(i(3409).Q);const r=a}},function(t){var e=(9295,t(t.s=9295)),i=window;for(var n in e)i[n]=e[n];e.__esModule&&Object.defineProperty(i,"__esModule",{value:!0})}]); -------------------------------------------------------------------------------- /app/Providers/EventServiceProvider.php: -------------------------------------------------------------------------------- 1 | > 16 | */ 17 | protected $listen = [ 18 | Registered::class => [ 19 | SendEmailVerificationNotification::class, 20 | ], 21 | ]; 22 | 23 | /** 24 | * Register any events for your application. 25 | * 26 | * @return void 27 | */ 28 | public function boot() 29 | { 30 | // 31 | } 32 | 33 | /** 34 | * Determine if events and listeners should be automatically discovered. 35 | * 36 | * @return bool 37 | */ 38 | public function shouldDiscoverEvents() 39 | { 40 | return false; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) shuvroroy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /resources/views/livewire/just-registered.blade.php: -------------------------------------------------------------------------------- 1 |
2 | 3 | Thanks for signing up for {{ config('app.name') }} 4 | 5 | 6 | 7 | We're happy you're here. Check your inbox to verify your email address before you can use your account. 8 | 9 | 12 | 13 | If you've not received the verification email, you can click the button above so we'll send you a new verification email. 14 | 15 |
16 | -------------------------------------------------------------------------------- /app/Core/SocialConstants.php: -------------------------------------------------------------------------------- 1 | value => '3b5998', 19 | self::GITHUB->value => '24292F', 20 | self::GOOGLE->value => 'DB4437', 21 | self::TWITTER->value => '00ACEE', 22 | }; 23 | } 24 | 25 | public static function isEnabled(string $name) 26 | { 27 | $enabledSocials = explode(',', self::ENABLED_SOCIALS->value); 28 | return in_array($name, $enabledSocials); 29 | } 30 | 31 | public static function enabledCases() 32 | { 33 | $socials = []; 34 | foreach (array_column(self::cases(), 'value') as $social) { 35 | if (self::isEnabled($social)) { 36 | $socials[] = $social; 37 | } 38 | } 39 | return $socials; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /app/Http/Livewire/Profile/Socials.php: -------------------------------------------------------------------------------- 1 | providers = SocialConstants::enabledCases(); 18 | $this->user = auth()->user(); 19 | } 20 | 21 | public function render() 22 | { 23 | return view('livewire.profile.socials'); 24 | } 25 | 26 | public function addProvider(string $provider): void 27 | { 28 | if (in_array($provider, $this->providers)) { 29 | session()->push('settings', $this->user->id); 30 | $this->redirect(route('socialite.redirect', $provider)); 31 | } 32 | } 33 | 34 | public function deleteProvider(string $provider): void 35 | { 36 | $this->user->socials()->where('provider', $provider)->delete(); 37 | Filament::notify('success', 'Social account ' . $provider . ' unlinked successfully.'); 38 | $this->user->refresh(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /resources/views/partials/home/side-menu.blade.php: -------------------------------------------------------------------------------- 1 | @if( 2 | (auth()->user() && auth()->user()->hasVerifiedEmail()) && 3 | auth()->user()->can(Permissions::START_DISCUSSIONS->value) 4 | ) 5 | 8 | @endif 9 | 19 |
20 | 21 |
22 | -------------------------------------------------------------------------------- /tests/Feature/AdminBackendUrlTest.php: -------------------------------------------------------------------------------- 1 | assertStatus(302); 18 | }); 19 | 20 | 21 | it('allows admin user to access admin backend', function ($adminPage) { 22 | asAdmin() 23 | ->get($adminPage) 24 | ->assertStatus(200); 25 | })->with(function (){ 26 | $adminBackendUrl = config("filament.path"); 27 | return [ 28 | $adminBackendUrl, 29 | $adminBackendUrl.'/configurations', 30 | $adminBackendUrl.'/notifications', 31 | $adminBackendUrl.'/tags', 32 | $adminBackendUrl.'/users', 33 | $adminBackendUrl.'/roles', 34 | $adminBackendUrl.'/permissions', 35 | ]; 36 | }); 37 | 38 | -------------------------------------------------------------------------------- /config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | resource_path('views'), 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled View Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This option determines where all the compiled Blade templates will be 26 | | stored for your application. Typically, this is within the storage 27 | | directory. However, as usual, you are free to change this value. 28 | | 29 | */ 30 | 31 | 'compiled' => env( 32 | 'VIEW_COMPILED_PATH', 33 | realpath(storage_path('framework/views')) 34 | ), 35 | 36 | ]; 37 | -------------------------------------------------------------------------------- /resources/views/livewire/layout/dialogs/discussion.blade.php: -------------------------------------------------------------------------------- 1 |
2 |
3 | {{ $this->form }} 4 | 5 |
6 | 9 | @if($discussion?->id) 10 | 13 | @endif 14 |
15 |
16 |
17 | -------------------------------------------------------------------------------- /database/seeders/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call(TagsSeeder::class); 26 | $this->call(NotificationSeeder::class); 27 | $this->call(ConfigurationSeeder::class); 28 | 29 | // Permissions 30 | $this->call(PermissionsSeeder::class); 31 | $this->call(RolesSeeder::class); 32 | $this->call(RolePermissionsSeeder::class); 33 | $this->call(UsersSeeder::class); 34 | $this->call(UserRolesSeeder::class); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/Http/Livewire/Profile/Replies.php: -------------------------------------------------------------------------------- 1 | loadData(); 23 | return view('livewire.profile.replies', compact('replies')); 24 | } 25 | 26 | public function loadMore() 27 | { 28 | $this->limitPerPage = $this->limitPerPage + 6; 29 | } 30 | 31 | public function loadData() 32 | { 33 | $query = Reply::query(); 34 | $query->where('user_id', $this->user->id); 35 | 36 | if ($this->isBest) { 37 | $query->where('is_best', true); 38 | } 39 | 40 | $data = $query->paginate($this->limitPerPage); 41 | if ($data->hasMorePages()) { 42 | $this->disableLoadMore = false; 43 | } else { 44 | $this->disableLoadMore = true; 45 | } 46 | 47 | return $data; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /database/seeders/Permissions/RolesSeeder.php: -------------------------------------------------------------------------------- 1 | "Admin", 17 | "color" => "#e01d1d", 18 | "description" => "

Platform admins

", 19 | ], 20 | [ 21 | "name" => "Mod", 22 | "color" => "#ae1de0", 23 | "description" => "

Platform mods

", 24 | ], 25 | [ 26 | "name" => "Member", 27 | "color" => "#1dc9e0", 28 | "description" => "

Platform members

", 29 | ], 30 | ]; 31 | 32 | /** 33 | * Run the database seeds. 34 | * 35 | * @return void 36 | */ 37 | public function run() 38 | { 39 | foreach ($this->data as $item) { 40 | if (!Role::where('name', $item['name'])->count()) { 41 | Role::create($item); 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | ./tests/Unit 10 | 11 | 12 | ./tests/Feature 13 | 14 | 15 | 16 | 17 | ./app 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /resources/views/tag.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Tag - {{ $tag->name }} 4 | 5 |
6 |
7 |
8 | {{ $tag->name }} 9 |
10 |
11 | {!! nl2br(e($tag->description)) !!} 12 |
13 |
14 |
15 | 16 | 17 |
18 |
19 | 22 |
23 | 24 |
25 |
26 |
27 | 28 |
29 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | , \Psr\Log\LogLevel::*> 14 | */ 15 | protected $levels = [ 16 | // 17 | ]; 18 | 19 | /** 20 | * A list of the exception types that are not reported. 21 | * 22 | * @var array> 23 | */ 24 | protected $dontReport = [ 25 | // 26 | ]; 27 | 28 | /** 29 | * A list of the inputs that are never flashed to the session on validation exceptions. 30 | * 31 | * @var array 32 | */ 33 | protected $dontFlash = [ 34 | 'current_password', 35 | 'password', 36 | 'password_confirmation', 37 | ]; 38 | 39 | /** 40 | * Register the exception handling callbacks for the application. 41 | * 42 | * @return void 43 | */ 44 | public function register() 45 | { 46 | $this->reportable(function (Throwable $e) { 47 | // 48 | }); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class UserFactory extends Factory 12 | { 13 | /** 14 | * Define the model's default state. 15 | * 16 | * @return array 17 | */ 18 | public function definition() 19 | { 20 | return [ 21 | 'name' => fake()->name(), 22 | 'email' => fake()->unique()->safeEmail(), 23 | 'email_verified_at' => now(), 24 | 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 25 | 'remember_token' => Str::random(10), 26 | 'bio' => fake()->paragraph(), 27 | 'is_email_visible' => collect([true, false])->random() 28 | ]; 29 | } 30 | 31 | /** 32 | * Indicate that the model's email address should be unverified. 33 | * 34 | * @return static 35 | */ 36 | public function unverified() 37 | { 38 | return $this->state(fn (array $attributes) => [ 39 | 'email_verified_at' => null, 40 | ]); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | import './bootstrap'; 2 | import '../css/app.scss'; 3 | 4 | import 'flowbite'; 5 | 6 | import './pace.min'; 7 | 8 | import Alpine from 'alpinejs' 9 | import FormsAlpinePlugin from '../../vendor/filament/forms/dist/module.esm' 10 | import AlpineFloatingUI from '@awcodes/alpine-floating-ui' 11 | import NotificationsAlpinePlugin from '../../vendor/filament/notifications/dist/module.esm' 12 | 13 | Alpine.plugin(FormsAlpinePlugin) 14 | Alpine.plugin(AlpineFloatingUI) 15 | Alpine.plugin(NotificationsAlpinePlugin) 16 | 17 | window.Alpine = Alpine 18 | 19 | Alpine.start() 20 | 21 | window.addEventListener('load', function () { 22 | const element = document.getElementById('loading-page'); 23 | element.style.opacity = 0; 24 | setTimeout(() => element.remove(), 500) 25 | }) 26 | 27 | window.openModal = function (id) { 28 | const targetEl = document.getElementById(id); 29 | const options = { 30 | placement: 'center', 31 | backdrop: 'dynamic', 32 | backdropClasses: 'bg-gray-900 bg-opacity-50 dark:bg-opacity-80 fixed inset-0 z-40' 33 | }; 34 | const modal = new Modal(targetEl, options); 35 | modal.show(); 36 | 37 | document.getElementById('hide-' + id).addEventListener('click', function () { 38 | modal.hide(); 39 | }); 40 | } 41 | -------------------------------------------------------------------------------- /public/img/socials/twitter.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/views/livewire/layout/dialogs/likes.blade.php: -------------------------------------------------------------------------------- 1 |
2 |

Likes @if($likes->count()) ({{ $likes->count() }}) @endif

3 |
4 | @if($likes->count()) 5 | @foreach($likes as $like) 6 |
7 | Avatar 9 |
10 | {{ $like->user->name }} 11 | Liked {{ $like->created_at->diffForHumans() }} 12 |
13 |
14 | @endforeach 15 | @else 16 | 17 | No likes available yet! 18 | 19 | @endif 20 |
21 |
22 | -------------------------------------------------------------------------------- /database/factories/LikeFactory.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | class LikeFactory extends Factory 16 | { 17 | /** 18 | * Define the model's default state. 19 | * 20 | * @return array 21 | */ 22 | public function definition() 23 | { 24 | $source = $this->randomSource(); 25 | return [ 26 | 'user_id' => User::all()->random()->id, 27 | 'source_id' => $source->id, 28 | 'source_type' => get_class($source), 29 | ]; 30 | } 31 | 32 | private function randomSource(): Model 33 | { 34 | $sourceType = collect([Discussion::class, Reply::class, Comment::class])->random(); 35 | $data = call_user_func($sourceType . '::all'); 36 | $source = null; 37 | if (!$data->isEmpty()) { 38 | $source = $data->random(); 39 | } 40 | if ($sourceType && $source) { 41 | return $source; 42 | } else { 43 | return $this->randomSource(); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /resources/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | import _ from 'lodash'; 2 | window._ = _; 3 | 4 | /** 5 | * We'll load the axios HTTP library which allows us to easily issue requests 6 | * to our Laravel back-end. This library automatically handles sending the 7 | * CSRF token as a header based on the value of the "XSRF" token cookie. 8 | */ 9 | 10 | import axios from 'axios'; 11 | window.axios = axios; 12 | 13 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 14 | 15 | /** 16 | * Echo exposes an expressive API for subscribing to channels and listening 17 | * for events that are broadcast by Laravel. Echo and event broadcasting 18 | * allows your team to easily build robust real-time web applications. 19 | */ 20 | 21 | // import Echo from 'laravel-echo'; 22 | 23 | // import Pusher from 'pusher-js'; 24 | // window.Pusher = Pusher; 25 | 26 | // window.Echo = new Echo({ 27 | // broadcaster: 'pusher', 28 | // key: import.meta.env.VITE_PUSHER_APP_KEY, 29 | // wsHost: import.meta.env.VITE_PUSHER_HOST ? import.meta.env.VITE_PUSHER_HOST : `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`, 30 | // wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80, 31 | // wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443, 32 | // forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https', 33 | // enabledTransports: ['ws', 'wss'], 34 | // }); 35 | -------------------------------------------------------------------------------- /database/factories/CommentFactory.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | class CommentFactory extends Factory 15 | { 16 | /** 17 | * Define the model's default state. 18 | * 19 | * @return array 20 | */ 21 | public function definition() 22 | { 23 | $source = $this->randomSource(); 24 | return [ 25 | 'content' => fake()->text(300), 26 | 'user_id' => User::all()->random()->id, 27 | 'source_id' => $source->id, 28 | 'source_type' => get_class($source), 29 | ]; 30 | } 31 | 32 | private function randomSource(): Model 33 | { 34 | $sourceType = collect([Discussion::class, Reply::class])->random(); 35 | $data = call_user_func($sourceType . '::all'); 36 | $source = null; 37 | if (!$data->isEmpty()) { 38 | $source = $data->random(); 39 | } 40 | if ($sourceType && $source) { 41 | return $source; 42 | } else { 43 | return $this->randomSource(); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /database/seeders/NotificationSeeder.php: -------------------------------------------------------------------------------- 1 | user, NotificationConstants::POST_IN_DISCUSSION->value, $reply->discussion)); 25 | } 26 | 27 | // Comments 28 | $comments = Comment::all(); 29 | foreach ($comments as $comment) { 30 | dispatch(new DispatchNotificationsJob($comment->user, NotificationConstants::POST_IN_DISCUSSION->value, $comment->discussion)); 31 | dispatch(new DispatchNotificationsJob($comment->user, NotificationConstants::MY_POSTS_COMMENTED->value, $comment)); 32 | } 33 | 34 | // Likes 35 | $likes = Like::all(); 36 | foreach ($likes as $like) { 37 | dispatch(new DispatchNotificationsJob($like->user, NotificationConstants::MY_POSTS_LIKED->value, $like)); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/Http/Livewire/Profile/WorldMapVisits.php: -------------------------------------------------------------------------------- 1 | initVisitsData(); 15 | } 16 | 17 | public function render() 18 | { 19 | return view('livewire.profile.world-map-visits'); 20 | } 21 | 22 | private function initVisitsData(): void 23 | { 24 | $data = collect(); 25 | $visits = $this->user->discussionVisits()->whereNotNull('meta')->get(); 26 | foreach ($visits as $visit) { 27 | if ($visit->meta->location) { 28 | if ($data->where('id', $visit->meta->location->countryCode)->count()) { 29 | $data->filter(fn($item) => $item['id'] == $visit->meta->location->countryCode) 30 | ->each(fn($item) => $item['value'] += 1); 31 | } else { 32 | $data->push(collect([ 33 | 'id' => $visit->meta->location->countryCode, 34 | 'name' => $visit->meta->location->countryName, 35 | 'value' => 1 36 | ])); 37 | } 38 | } 39 | } 40 | $this->data = $data->toArray(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /resources/views/partials/layouts/profile/info.blade.php: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | {{ $user->name }} 5 | 6 | @include('partials.layouts.profile.roles-tags', compact('user')) 7 |
8 |
9 | 10 | {{ $user->updated_at->diffForHumans() }} 11 | 12 | 13 | Joined {{ $user->created_at->diffForHumans() }} 14 | 15 | 16 | {{ $bestAnswers }} best {{ $bestAnswers > 1 ? 'answers' : 'answer' }} 17 | 18 | 19 | {{ $user->total_points }} {{ $user->total_points > 1 ? 'points' : 'point' }} 20 | 21 |
22 |
23 | -------------------------------------------------------------------------------- /resources/views/forms/components/mentions-rich-editor.blade.php: -------------------------------------------------------------------------------- 1 | @include('forms::components.rich-editor') 2 | 3 | @push('scripts') 4 | 5 | 6 | 27 | @endpush 28 | -------------------------------------------------------------------------------- /database/seeders/Content/MembersSeeder.php: -------------------------------------------------------------------------------- 1 | count($this->members) 28 | ->create(); 29 | 30 | // Notifications 31 | User::whereNotIn('email', [UsersSeeder::$admin['email'], UsersSeeder::$mod['email']]) 32 | ->get() 33 | ->each(function ($user) { 34 | Notification::all() 35 | ->each(function ($notification) use ($user) { 36 | UserNotification::create([ 37 | 'notification_id' => $notification->id, 38 | 'user_id' => $user->id, 39 | 'via_web' => collect([true, false])->random(), 40 | 'via_email' => collect([true, false])->random() 41 | ]); 42 | }); 43 | }); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /public/img/socials/github.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/Http/Livewire/Discussion/Header.php: -------------------------------------------------------------------------------- 1 | 'initData', 19 | 'replyUpdated' => 'initData', 20 | 'replyDeleted' => 'initData', 21 | 'discussionEdited' => 'initData', 22 | 'resolvedFlagUpdated' => 'resolvedFlagUpdated' 23 | ]; 24 | 25 | public function mount(): void 26 | { 27 | $this->initData(); 28 | } 29 | 30 | public function render() 31 | { 32 | return view('livewire.discussion.header'); 33 | } 34 | 35 | public function initData(): void 36 | { 37 | $this->replies = $this->discussion->replies()->count(); 38 | $this->comments = $this->discussion->comments()->count(); 39 | $this->isResolved = $this->discussion->is_resolved; 40 | $this->isPublic = $this->discussion->is_public; 41 | $this->isLocked = $this->discussion->is_locked; 42 | } 43 | 44 | public function resolvedFlagUpdated(): void 45 | { 46 | $this->discussion->refresh(); 47 | $this->isResolved = $this->discussion->is_resolved; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /resources/views/partials/profile/dialogs/email.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 17 | -------------------------------------------------------------------------------- /config/notifications.php: -------------------------------------------------------------------------------- 1 | false, 18 | 19 | /* 20 | |-------------------------------------------------------------------------- 21 | | Database notifications 22 | |-------------------------------------------------------------------------- 23 | | 24 | | By enabling this feature, your users are able to open a slide-over within 25 | | the app to view their database notifications. 26 | | 27 | */ 28 | 29 | 'database' => [ 30 | 'enabled' => true, 31 | 'trigger' => null, 32 | 'polling_interval' => '30s', 33 | ], 34 | 35 | /* 36 | |-------------------------------------------------------------------------- 37 | | Layout 38 | |-------------------------------------------------------------------------- 39 | | 40 | | This is the configuration for the general layout of notifications. 41 | | 42 | */ 43 | 44 | 'layout' => [ 45 | 'alignment' => [ 46 | 'horizontal' => 'right', 47 | 'vertical' => 'bottom', 48 | ], 49 | ], 50 | 51 | ]; 52 | -------------------------------------------------------------------------------- /resources/views/partials/profile/dialogs/password.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 17 | -------------------------------------------------------------------------------- /resources/views/partials/profile/dialogs/username.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 17 | -------------------------------------------------------------------------------- /database/seeders/Referential/NotificationSeeder.php: -------------------------------------------------------------------------------- 1 | "Someone edited my discussion", 13 | ], 14 | [ 15 | "name" => "Someone posts in a discussion I'm following", 16 | ], 17 | [ 18 | "name" => "Someone locks my discussion", 19 | ], 20 | [ 21 | "name" => "Someone sets my reply as a best answer", 22 | ], 23 | [ 24 | "name" => "Someone commented to one of my posts", 25 | ], 26 | [ 27 | "name" => "Someone likes one of my posts", 28 | ], 29 | [ 30 | "name" => "My account points are updated after an action", 31 | ], 32 | [ 33 | "name" => "My discussion is locked by a moderator / administrator", 34 | ], 35 | [ 36 | "name" => "My discussion is unlocked by a moderator / administrator", 37 | ], 38 | ]; 39 | 40 | /** 41 | * Run the database seeds. 42 | * 43 | * @return void 44 | */ 45 | public function run() 46 | { 47 | foreach ($this->data as $item) { 48 | if (!Notification::where('name', $item['name'])->count()) { 49 | Notification::create($item); 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/Http/Livewire/Profile/Discussions.php: -------------------------------------------------------------------------------- 1 | loadData(); 23 | return view('livewire.profile.discussions', compact('discussions')); 24 | } 25 | 26 | public function loadMore() 27 | { 28 | $this->limitPerPage = $this->limitPerPage + 6; 29 | } 30 | 31 | public function loadData() 32 | { 33 | $query = Discussion::query(); 34 | 35 | if ($this->follow) { 36 | $query->whereHas('followers', function ($query) { 37 | return $query->where('followers.user_id', $this->user->id) 38 | ->where('type', $this->follow); 39 | }); 40 | } else { 41 | $query->where('user_id', $this->user->id); 42 | } 43 | 44 | $data = $query->paginate($this->limitPerPage); 45 | if ($data->hasMorePages()) { 46 | $this->disableLoadMore = false; 47 | } else { 48 | $this->disableLoadMore = true; 49 | } 50 | 51 | $this->totalCount = $data->total(); 52 | 53 | return $data; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/Http/Middleware/DiscussionMiddleware.php: -------------------------------------------------------------------------------- 1 | route('discussion'); 22 | if ($discussion && !$discussion->is_public && (!auth()->user() || !auth()->user()->hasVerifiedEmail())) { 23 | return redirect()->route('home'); 24 | } 25 | if (auth()->user() && auth()->user()->hasVerifiedEmail() && $discussion) { 26 | $location = Location::get($request->ip()); 27 | DiscussionVisit::create([ 28 | 'user_id' => auth()->user()->id, 29 | 'discussion_id' => $discussion->id, 30 | 'meta' => [ 31 | 'ip' => $request->ip(), 32 | 'browser' => $request->header('User-Agent'), 33 | 'location' => $location ? $location->toArray() : [] 34 | ] 35 | ]); 36 | } 37 | return $next($request); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /resources/views/partials/dialogs/login.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 18 | -------------------------------------------------------------------------------- /resources/views/partials/dialogs/socials-icon/github.blade.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/views/partials/dialogs/sign-up.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 18 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | configureRateLimiting(); 30 | 31 | $this->routes(function () { 32 | Route::middleware('api') 33 | ->prefix('api') 34 | ->group(base_path('routes/api.php')); 35 | 36 | Route::middleware('web') 37 | ->group(base_path('routes/web.php')); 38 | }); 39 | } 40 | 41 | /** 42 | * Configure the rate limiters for the application. 43 | * 44 | * @return void 45 | */ 46 | protected function configureRateLimiting() 47 | { 48 | RateLimiter::for('api', function (Request $request) { 49 | return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); 50 | }); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /resources/views/livewire/discussion/reply.blade.php: -------------------------------------------------------------------------------- 1 | 2 |
3 |

{{ $reply?->id ? 'Update reply content' : 'Post a reply' }}

4 |
5 | {{ $this->form }} 6 | 7 |
8 | 12 | @if($reply?->id) 13 | 16 | @endif 17 |
18 |
19 |
20 | 21 | @push('scripts') 22 | 28 | @endpush 29 | -------------------------------------------------------------------------------- /resources/views/partials/dialogs/add-discussion.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 18 | -------------------------------------------------------------------------------- /app/View/Components/Profile/Stats.php: -------------------------------------------------------------------------------- 1 | user = $user; 27 | $this->discussions = $this->user->discussions()->count(); 28 | $this->replies = $this->user->replies()->count(); 29 | $this->comments = $this->user->comments()->count(); 30 | $this->likes = $this->user->likes()->count(); 31 | $this->followingDiscussions = $this->user->followings()->where('type', FollowerConstants::FOLLOWING->value)->count(); 32 | $this->notFollowingDiscussions = $this->user->followings()->where('type', FollowerConstants::NOT_FOLLOWING->value)->count(); 33 | $this->ignoringDiscussions = $this->user->followings()->where('type', FollowerConstants::IGNORING->value)->count(); 34 | } 35 | 36 | /** 37 | * Get the view / contents that represent the component. 38 | * 39 | * @return \Illuminate\Contracts\View\View|\Closure|string 40 | */ 41 | public function render() 42 | { 43 | return view('components.profile.stats'); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/Http/Livewire/Profile/Details.php: -------------------------------------------------------------------------------- 1 | user = auth()->user(); 21 | $this->form->fill([ 22 | 'bio' => $this->user->bio, 23 | 'is_email_visible' => $this->user->is_email_visible 24 | ]); 25 | } 26 | 27 | public function render() 28 | { 29 | return view('livewire.profile.details'); 30 | } 31 | 32 | protected function getFormSchema(): array 33 | { 34 | return [ 35 | Textarea::make('bio') 36 | ->label('Bio') 37 | ->rows(4) 38 | ->placeholder('Type a bio to your profile...'), 39 | 40 | Toggle::make('is_email_visible') 41 | ->label('Make your email address visible on the forum') 42 | ]; 43 | } 44 | 45 | public function perform(): void 46 | { 47 | $data = $this->form->getState(); 48 | $this->user->bio = $data['bio']; 49 | $this->user->is_email_visible = $data['is_email_visible']; 50 | $this->user->save(); 51 | $this->user->refresh(); 52 | Filament::notify('success', 'Your notifications were successfully updated.'); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | label('Back to home') 36 | ->url(route('home')) 37 | ->icon('heroicon-s-home'), 38 | UserMenuItem::make() 39 | ->label('Settings') 40 | ->url(route('profile.settings')) 41 | ->icon('heroicon-s-cog'), 42 | ]); 43 | }); 44 | 45 | // Register tippy styles 46 | Filament::registerStyles([ 47 | 'https://unpkg.com/tippy.js@6/dist/tippy.css', 48 | ]); 49 | 50 | // Add custom meta (favicon) 51 | Filament::pushMeta([ 52 | new HtmlString(''), 53 | ]); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/Filament/Widgets/LatestDiscussions.php: -------------------------------------------------------------------------------- 1 | withCount('replies') 19 | ->withCount('comments') 20 | ->withCount('likes') 21 | ->latest(); 22 | } 23 | 24 | protected function getTableColumns(): array 25 | { 26 | return [ 27 | Tables\Columns\TextColumn::make('name') 28 | ->label('Discussion'), 29 | 30 | Tables\Columns\TextColumn::make('replies_count') 31 | ->label('Replies'), 32 | 33 | Tables\Columns\TextColumn::make('comments_count') 34 | ->label('Comments'), 35 | 36 | Tables\Columns\TextColumn::make('likes_count') 37 | ->label('Likes') 38 | ]; 39 | } 40 | 41 | protected function getTableActions(): array 42 | { 43 | return [ 44 | Tables\Actions\Action::make('view') 45 | ->label('View') 46 | ->icon('heroicon-s-eye') 47 | ->color('secondary') 48 | ->url(fn ($record) => route('discussion', [ 49 | 'discussion' => $record, 50 | 'slug' => Str::slug($record->name) 51 | ]), true) 52 | ]; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/Filament/Widgets/LatestReplies.php: -------------------------------------------------------------------------------- 1 | withCount('comments') 19 | ->withCount('likes') 20 | ->with(['discussion', 'user']) 21 | ->latest(); 22 | } 23 | 24 | protected function getTableColumns(): array 25 | { 26 | return [ 27 | Tables\Columns\TextColumn::make('user.name') 28 | ->label('User'), 29 | 30 | Tables\Columns\TextColumn::make('discussion.name') 31 | ->label('Discussion'), 32 | 33 | Tables\Columns\TextColumn::make('comments_count') 34 | ->label('Comments'), 35 | 36 | Tables\Columns\TextColumn::make('likes_count') 37 | ->label('Likes') 38 | ]; 39 | } 40 | 41 | protected function getTableActions(): array 42 | { 43 | return [ 44 | Tables\Actions\Action::make('view') 45 | ->label('View') 46 | ->icon('heroicon-s-eye') 47 | ->color('secondary') 48 | ->url(fn ($record) => route('discussion', [ 49 | 'discussion' => $record->discussion, 50 | 'slug' => Str::slug($record->discussion->name) 51 | ]), true) 52 | ]; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /database/seeders/Content/DiscussionsSeeder.php: -------------------------------------------------------------------------------- 1 | count($this->count) 23 | ->create() 24 | ->each(function (Discussion $discussion) { 25 | // Link tags 26 | $tagsCount = collect([1, 2, 3])->random(); 27 | $tags = Tag::all(); 28 | $tags->random($tagsCount) 29 | ->each(function ($tag) use ($discussion) { 30 | $discussion 31 | ->tags() 32 | ->attach($tag->id); 33 | }); 34 | 35 | // Link followers 36 | $usersCount = collect([1, 2, 3])->random(); 37 | $users = User::all(); 38 | $users->random($usersCount) 39 | ->each(function ($user) use ($discussion) { 40 | $discussion 41 | ->followers() 42 | ->attach( 43 | $user->id, 44 | [ 45 | 'type' => collect(array_column(FollowerConstants::cases(), 'value'))->random(1)[0] 46 | ] 47 | ); 48 | }); 49 | }); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /resources/views/livewire/profile/avatar.blade.php: -------------------------------------------------------------------------------- 1 |
2 |
3 | @if($user->id == auth()->user()->id) 4 | 7 |
8 | 9 |
10 | 11 | @endif 12 | Avatar 13 |
14 | @if($user->picture && $user->id == auth()->user()->id) 15 | 21 | @endif 22 |
23 | -------------------------------------------------------------------------------- /config/hashing.php: -------------------------------------------------------------------------------- 1 | 'bcrypt', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Bcrypt Options 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may specify the configuration options that should be used when 26 | | passwords are hashed using the Bcrypt algorithm. This will allow you 27 | | to control the amount of time it takes to hash the given password. 28 | | 29 | */ 30 | 31 | 'bcrypt' => [ 32 | 'rounds' => env('BCRYPT_ROUNDS', 10), 33 | ], 34 | 35 | /* 36 | |-------------------------------------------------------------------------- 37 | | Argon Options 38 | |-------------------------------------------------------------------------- 39 | | 40 | | Here you may specify the configuration options that should be used when 41 | | passwords are hashed using the Argon algorithm. These will allow you 42 | | to control the amount of time it takes to hash the given password. 43 | | 44 | */ 45 | 46 | 'argon' => [ 47 | 'memory' => 65536, 48 | 'threads' => 1, 49 | 'time' => 4, 50 | ], 51 | 52 | ]; 53 | -------------------------------------------------------------------------------- /resources/views/livewire/profile/discussions.blade.php: -------------------------------------------------------------------------------- 1 |
2 |
3 | @if(auth()->user()->id == $user->id) 4 | Your discussions 5 | @else 6 | Discussions 7 | @endif 8 |
9 |
10 |
11 | @if($discussions->count()) 12 | @foreach($discussions as $discussion) 13 | @include('partials.layouts.discussion-item', [ 14 | 'discussion' => $discussion, 15 | 'type' => $follow 16 | ]) 17 | @endforeach 18 | @else 19 | 20 | You haven't started a discussion yet. You can start a new discussion from home page 21 | 22 | @endif 23 |
24 |
25 | @if(!$disableLoadMore) 26 | 30 | @endif 31 | @if($totalCount) 32 | 33 | Showing {{ min($limitPerPage, $totalCount) }} of {{ $totalCount }} {{ $totalCount > 1 ? 'discussions' : 'discussion' }} 34 | 35 | @endif 36 |
37 |
38 | -------------------------------------------------------------------------------- /app/Core/PointsConstants.php: -------------------------------------------------------------------------------- 1 | value => 10, 29 | self::DISCUSSION_DELETED->value => -10, 30 | self::DISCUSSION_LIKED->value => 5, 31 | self::DISCUSSION_DISLIKED->value => -5, 32 | 33 | self::NEW_REPLY->value => 2, 34 | self::REPLY_DELETED->value => -2, 35 | self::BEST_REPLY->value => 10, 36 | self::BEST_REPLY_REMOVED->value => -10, 37 | self::REPLY_LIKED->value => 2, 38 | self::REPLY_DISLIKED->value => -2, 39 | 40 | self::NEW_COMMENT->value => 1, 41 | self::COMMENT_DELETED->value => -1, 42 | self::COMMENT_LIKED->value => 1, 43 | self::COMMENT_DISLIKED->value => -1, 44 | ]; 45 | return $points[$name] ?? 0; 46 | } 47 | 48 | public static function caseToDelete(string $name): bool 49 | { 50 | return self::value($name) < 0; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /app/Notifications/EmailNotification.php: -------------------------------------------------------------------------------- 1 | title = $title; 25 | $this->body = $body; 26 | $this->url = $url; 27 | } 28 | 29 | /** 30 | * Get the notification's delivery channels. 31 | * 32 | * @param mixed $notifiable 33 | * @return array 34 | */ 35 | public function via($notifiable) 36 | { 37 | return ['mail']; 38 | } 39 | 40 | /** 41 | * Get the mail representation of the notification. 42 | * 43 | * @param mixed $notifiable 44 | * @return \Illuminate\Notifications\Messages\MailMessage 45 | */ 46 | public function toMail($notifiable) 47 | { 48 | $mail = (new MailMessage) 49 | ->subject($this->title) 50 | ->line($this->body); 51 | if ($this->url) { 52 | $mail->action('More details', $this->url); 53 | } 54 | $mail->line('Thank you for using ' . config('app.name') . '!'); 55 | return $mail; 56 | } 57 | 58 | /** 59 | * Get the array representation of the notification. 60 | * 61 | * @param mixed $notifiable 62 | * @return array 63 | */ 64 | public function toArray($notifiable) 65 | { 66 | return [ 67 | // 68 | ]; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /bootstrap/app.php: -------------------------------------------------------------------------------- 1 | singleton( 30 | Illuminate\Contracts\Http\Kernel::class, 31 | App\Http\Kernel::class 32 | ); 33 | 34 | $app->singleton( 35 | Illuminate\Contracts\Console\Kernel::class, 36 | App\Console\Kernel::class 37 | ); 38 | 39 | $app->singleton( 40 | Illuminate\Contracts\Debug\ExceptionHandler::class, 41 | App\Exceptions\Handler::class 42 | ); 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Return The Application 47 | |-------------------------------------------------------------------------- 48 | | 49 | | This script returns the application instance. The instance is given to 50 | | the calling script so we can separate the building of the instances 51 | | from the actual running of the application and sending responses. 52 | | 53 | */ 54 | 55 | return $app; 56 | -------------------------------------------------------------------------------- /database/seeders/Permissions/UserRolesSeeder.php: -------------------------------------------------------------------------------- 1 | first(); 24 | $role = Role::where('name', $adminRole)->first(); 25 | if ($user && $role) { 26 | UserRole::where('user_id', $user->id)->where('role_id', Role::where('name', RoleConstants::MEMBER->value)->first()->id)->delete(); 27 | if (!UserRole::where('user_id', $user->id)->where('role_id', $role)->count()) { 28 | UserRole::create([ 29 | 'user_id' => $user->id, 30 | 'role_id' => $role->id 31 | ]); 32 | } 33 | } 34 | 35 | // Mod 36 | $mod = UsersSeeder::$mod['email']; 37 | $modRole = RolesSeeder::$modRole; 38 | $user = User::where('email', $mod)->first(); 39 | $role = Role::where('name', $modRole)->first(); 40 | if ($user && $role) { 41 | UserRole::where('user_id', $user->id)->where('role_id', Role::where('name', RoleConstants::MEMBER->value)->first()->id)->delete(); 42 | if (!UserRole::where('user_id', $user->id)->where('role_id', $role)->count()) { 43 | UserRole::create([ 44 | 'user_id' => $user->id, 45 | 'role_id' => $role->id 46 | ]); 47 | } 48 | } 49 | } 50 | } 51 | --------------------------------------------------------------------------------