├── public ├── favicon.ico ├── robots.txt ├── img │ ├── gemara.jpg │ └── shaddow.png ├── fonts │ ├── SBL_Hbrw.otf │ ├── SBL_Hbrw.woff2 │ ├── SiddurOCGX.woff2 │ ├── Heebo-beta-VF.otf │ └── Heebo-beta-VF.woff2 ├── .htaccess └── index.php ├── bootstrap ├── cache │ └── .gitignore └── app.php ├── storage ├── logs │ └── .gitignore ├── app │ ├── public │ │ └── .gitignore │ └── .gitignore ├── debugbar │ └── .gitignore └── framework │ ├── testing │ └── .gitignore │ ├── views │ └── .gitignore │ ├── cache │ ├── data │ │ └── .gitignore │ └── .gitignore │ ├── sessions │ └── .gitignore │ └── .gitignore ├── database ├── .gitignore ├── factories │ ├── PostFactory.php │ └── UserFactory.php ├── seeds │ ├── PostSeeder.php │ └── DatabaseSeeder.php └── migrations │ ├── 2020_10_12_075016_add_type_column_to_posts.php │ ├── 2020_08_31_071814_increase_post_title_length.php │ ├── 2020_10_05_070952_create_comments_table.php │ ├── 2020_07_19_172606_add_soft_deletes_to_posts_table.php │ ├── 2014_10_12_100000_create_password_resets_table.php │ ├── 2019_08_19_000000_create_failed_jobs_table.php │ ├── 2020_06_25_120842_create_posts_table.php │ ├── 2014_10_12_000000_create_users_table.php │ ├── 2020_06_28_135208_add_love_reacter_id_to_users_table.php │ └── 2020_06_28_135356_add_love_reactant_id_to_posts_table.php ├── .gitattributes ├── resources ├── sass │ ├── forms.scss │ ├── reset.scss │ ├── app.scss │ ├── fonts.scss │ ├── buttons.scss │ ├── transitions.scss │ ├── nprogress.scss │ └── misc.scss ├── views │ ├── mail │ │ └── test.blade.php │ ├── app.blade.php │ └── components │ │ ├── code-logo.blade.php │ │ └── twemoji.blade.php ├── js │ ├── components │ │ ├── ui │ │ │ ├── LoadingButton.vue │ │ │ ├── TrafficLights.vue │ │ │ ├── Loader.vue │ │ │ ├── ProgressCircle.vue │ │ │ ├── Avatar.vue │ │ │ ├── Dropdown.vue │ │ │ ├── BaseButton.vue │ │ │ ├── Badge.vue │ │ │ ├── Notification.vue │ │ │ ├── Logo.vue │ │ │ └── Modal.vue │ │ ├── Comments.vue │ │ ├── CommentsList.vue │ │ ├── CommentContent.vue │ │ ├── Comment.vue │ │ ├── WriteComment.vue │ │ ├── PostsList.vue │ │ ├── SelectPopover.vue │ │ ├── Toolbar.vue │ │ └── WritePost.vue │ ├── helpers │ │ └── modal.js │ ├── Pages │ │ ├── Users │ │ │ ├── Index.vue │ │ │ ├── Edit.vue │ │ │ └── Show.vue │ │ ├── Auth │ │ │ ├── Unapproved.vue │ │ │ ├── Login.vue │ │ │ └── Register.vue │ │ └── Posts │ │ │ └── Index.vue │ ├── app.js │ └── Layouts │ │ └── App.vue ├── lang │ └── en │ │ ├── pagination.php │ │ ├── auth.php │ │ └── passwords.php └── assets │ └── js │ └── ziggy.js ├── .vscode └── settings.json ├── tests ├── TestCase.php ├── Unit │ └── ExampleTest.php ├── CreatesApplication.php └── Feature │ └── ExampleTest.php ├── .styleci.yml ├── .prettierrc ├── .editorconfig ├── .gitignore ├── app ├── Http │ ├── Middleware │ │ ├── Approved.php │ │ ├── EncryptCookies.php │ │ ├── Admin.php │ │ ├── VerifyCsrfToken.php │ │ ├── CheckForMaintenanceMode.php │ │ ├── TrimStrings.php │ │ ├── TrustHosts.php │ │ ├── Authenticate.php │ │ ├── TrustProxies.php │ │ └── RedirectIfAuthenticated.php │ ├── Controllers │ │ ├── UploadController.php │ │ ├── Controller.php │ │ ├── ProfileController.php │ │ ├── ImagesController.php │ │ ├── Auth │ │ │ ├── ForgotPasswordController.php │ │ │ ├── ResetPasswordController.php │ │ │ ├── ConfirmPasswordController.php │ │ │ ├── LoginController.php │ │ │ ├── VerificationController.php │ │ │ └── RegisterController.php │ │ ├── CommentController.php │ │ ├── ReactionController.php │ │ ├── PostController.php │ │ └── UserController.php │ ├── Resources │ │ └── PostResource.php │ └── Kernel.php ├── Mail │ └── TestMail.php ├── Providers │ ├── BroadcastServiceProvider.php │ ├── AuthServiceProvider.php │ ├── EventServiceProvider.php │ ├── RouteServiceProvider.php │ └── AppServiceProvider.php ├── Model.php ├── Post.php ├── Comment.php ├── Policies │ ├── PostPolicy.php │ └── UserPolicy.php ├── Console │ └── Kernel.php ├── Exceptions │ └── Handler.php └── User.php ├── routes ├── channels.php ├── console.php ├── api.php └── web.php ├── server.php ├── config ├── cors.php ├── services.php ├── view.php ├── hashing.php ├── broadcasting.php ├── filesystems.php ├── queue.php ├── logging.php ├── cache.php ├── mail.php ├── auth.php └── database.php ├── .env.example ├── phpunit.xml ├── webpack.mix.js ├── tailwind.config.js ├── package.json ├── artisan ├── composer.json └── README.md /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite 2 | *.sqlite-journal 3 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/debugbar/.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 | -------------------------------------------------------------------------------- /public/img/gemara.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yiddishe-Kop/pninim/HEAD/public/img/gemara.jpg -------------------------------------------------------------------------------- /public/img/shaddow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yiddishe-Kop/pninim/HEAD/public/img/shaddow.png -------------------------------------------------------------------------------- /public/fonts/SBL_Hbrw.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yiddishe-Kop/pninim/HEAD/public/fonts/SBL_Hbrw.otf -------------------------------------------------------------------------------- /public/fonts/SBL_Hbrw.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yiddishe-Kop/pninim/HEAD/public/fonts/SBL_Hbrw.woff2 -------------------------------------------------------------------------------- /public/fonts/SiddurOCGX.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yiddishe-Kop/pninim/HEAD/public/fonts/SiddurOCGX.woff2 -------------------------------------------------------------------------------- /public/fonts/Heebo-beta-VF.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yiddishe-Kop/pninim/HEAD/public/fonts/Heebo-beta-VF.otf -------------------------------------------------------------------------------- /public/fonts/Heebo-beta-VF.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yiddishe-Kop/pninim/HEAD/public/fonts/Heebo-beta-VF.woff2 -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.css linguist-vendored 3 | *.scss linguist-vendored 4 | *.js linguist-vendored 5 | CHANGELOG.md export-ignore 6 | -------------------------------------------------------------------------------- /resources/sass/forms.scss: -------------------------------------------------------------------------------- 1 | textarea.title, 2 | textarea.content { 3 | display: block; 4 | width: 100%; 5 | line-height: 1.2; 6 | resize: none; 7 | } 8 | -------------------------------------------------------------------------------- /storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | config.php 2 | routes.php 3 | schedule-* 4 | compiled.php 5 | services.json 6 | events.scanned.php 7 | routes.scanned.php 8 | down 9 | -------------------------------------------------------------------------------- /resources/sass/reset.scss: -------------------------------------------------------------------------------- 1 | input, 2 | select, 3 | textarea, 4 | button, 5 | div, 6 | a { 7 | &:focus, 8 | &:active { 9 | outline: none; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "[vue, html]": { 3 | "editor.formatOnSave": false, 4 | }, 5 | "vetur.experimental.templateInterpolationService": true, 6 | "vetur.format.defaultFormatter.html": "prettier", 7 | } 8 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | define(Post::class, function (Faker $faker) { 9 | return [ 10 | // 11 | ]; 12 | }); 13 | -------------------------------------------------------------------------------- /resources/views/mail/test.blade.php: -------------------------------------------------------------------------------- 1 | @component('mail::message') 2 | # Order Shipped 3 | 4 | Your order has been shipped! 5 | 6 | @component('mail::button', ['url' => route('home')]) 7 | View Order 8 | @endcomponent 9 | 10 | Thanks,
11 | {{ config('app.name') }} 12 | @endcomponent 13 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | indent_style = space 8 | indent_size = 4 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.{yml,yaml}] 15 | indent_size = 2 16 | -------------------------------------------------------------------------------- /database/seeds/PostSeeder.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/Http/Middleware/Approved.php: -------------------------------------------------------------------------------- 1 | check() || !auth()->user()->is_approved) { 10 | return redirect('access-denied'); 11 | } else { 12 | return $next($request); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | check() || !auth()->user()->is_admin) { 10 | return abort(403, 'Unauthorized. Police is on their way 🚔'); 11 | } else { 12 | return $next($request); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | file('avatar')) { 9 | $fileUrl = request()->file('avatar')->store('users'); 10 | } 11 | 12 | return response()->json([ 13 | 'url' => $fileUrl, 14 | ]); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | markdown('mail.test'); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /database/seeds/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | 'Yehuda Neufeld', 11 | 'email' => 'newgraphil@gmail.com', 12 | 'password' => '12345678', 13 | 'is_admin' => true, 14 | 'is_approved' => true, 15 | ]); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustHosts.php: -------------------------------------------------------------------------------- 1 | allSubdomainsOfApplicationUrl(), 18 | ]; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /resources/sass/app.scss: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | /*! purgecss start ignore */ 3 | @import "reset"; 4 | /*! purgecss end ignore */ 5 | 6 | /* Components */ 7 | @tailwind components; 8 | 9 | /*! purgecss start ignore */ 10 | @import "fonts"; 11 | @import "misc"; 12 | @import "forms"; 13 | @import "vue-formulate-theme"; 14 | @import "buttons"; 15 | @import "transitions"; 16 | @import "nprogress"; 17 | /*! purgecss end ignore */ 18 | 19 | /* Utilities */ 20 | @tailwind utilities; 21 | -------------------------------------------------------------------------------- /tests/CreatesApplication.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 19 | 20 | return $app; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | actingAs(User::create([ 15 | 'name' => 'Test', 16 | 'email' => 'test@test.com', 17 | 'password' => '12345678' 18 | ])); 19 | $this->get('/'); 20 | $this->assertAuthenticated(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /resources/js/components/ui/LoadingButton.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 22 | -------------------------------------------------------------------------------- /app/Model.php: -------------------------------------------------------------------------------- 1 | where($this->getRouteKeyName(), $value)->withTrashed()->first() 17 | : parent::resolveRouteBinding($value); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /resources/views/app.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Pninim 13 | @routes 14 | 15 | 16 | 17 | 18 | @inertia 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | expectsJson()) { 18 | return route('login'); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /resources/js/components/Comments.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 20 | -------------------------------------------------------------------------------- /database/migrations/2020_10_12_075016_add_type_column_to_posts.php: -------------------------------------------------------------------------------- 1 | string('type')->nullable(); 12 | }); 13 | } 14 | 15 | public function down() { 16 | Schema::table('posts', function (Blueprint $table) { 17 | $table->dropColumn('type'); 18 | }); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /resources/lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 18 | }); 19 | -------------------------------------------------------------------------------- /database/migrations/2020_08_31_071814_increase_post_title_length.php: -------------------------------------------------------------------------------- 1 | text('title')->change(); 12 | }); 13 | } 14 | 15 | public function down() { 16 | Schema::table('posts', function (Blueprint $table) { 17 | $table->string('title')->change(); 18 | }); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /server.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | $uri = urldecode( 11 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) 12 | ); 13 | 14 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the 15 | // built-in PHP web server. This provides a convenient way to test a Laravel 16 | // application without having installed a "real" web server software here. 17 | if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) { 18 | return false; 19 | } 20 | 21 | require_once __DIR__.'/public/index.php'; 22 | -------------------------------------------------------------------------------- /resources/js/components/ui/TrafficLights.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | -------------------------------------------------------------------------------- /resources/js/components/ui/Loader.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 24 | -------------------------------------------------------------------------------- /resources/js/helpers/modal.js: -------------------------------------------------------------------------------- 1 | import app from '../app'; 2 | 3 | export default { 4 | // shows a modal confirmation dialog 5 | confirm: (options = {}) => { 6 | return new Promise((resolve, reject) => { 7 | app.$page.modal = { 8 | open: true, 9 | icon: options.icon || 'warning', 10 | color: options.color || 'red', 11 | title: options.title || 'Confirm', 12 | message: options.message || 'Are you sure you want to complete this action?', 13 | action: { 14 | label: options.action.label || 'Confirm', 15 | confirm: resolve, 16 | cancel: reject 17 | } 18 | } 19 | }) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 19 | })->describe('Display an inspiring quote'); 20 | -------------------------------------------------------------------------------- /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/Http/Middleware/TrustProxies.php: -------------------------------------------------------------------------------- 1 | 'These credentials do not match our records.', 17 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /database/migrations/2020_10_05_070952_create_comments_table.php: -------------------------------------------------------------------------------- 1 | id(); 12 | $table->foreignId('user_id'); 13 | $table->foreignId('post_id'); 14 | $table->foreignId('parent_id')->nullable(); 15 | $table->text('content'); 16 | 17 | $table->timestamps(); 18 | }); 19 | } 20 | 21 | public function down() { 22 | Schema::dropIfExists('comments'); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /resources/js/components/CommentsList.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 24 | -------------------------------------------------------------------------------- /app/Http/Resources/PostResource.php: -------------------------------------------------------------------------------- 1 | $this->id, 12 | 'title' => $this->title, 13 | 'content' => $this->content, 14 | 'ref' => $this->ref, 15 | 'created_at' => $this->created_at, 16 | 'username' => $this->user->name, 17 | 'avatar' => $this->user->photoUrl, 18 | 'reactions' => $this->loveReactant->reactionCounters->map->only(['count', 'weight', 'reaction_type_id']), 19 | ]; 20 | 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/Http/Middleware/RedirectIfAuthenticated.php: -------------------------------------------------------------------------------- 1 | check()) { 22 | return redirect(RouteServiceProvider::HOME); 23 | } 24 | 25 | return $next($request); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/Providers/AuthServiceProvider.php: -------------------------------------------------------------------------------- 1 | '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/Controllers/ProfileController.php: -------------------------------------------------------------------------------- 1 | json( 21 | PostResource::collection( 22 | Post::latest()->limit(8)->get() 23 | ) 24 | ); 25 | }); 26 | -------------------------------------------------------------------------------- /app/Http/Controllers/ImagesController.php: -------------------------------------------------------------------------------- 1 | new LaravelResponseFactory($request), 16 | 'source' => $filesystem->getDriver(), 17 | 'cache' => $filesystem->getDriver(), 18 | 'cache_path_prefix' => '.glide-cache', 19 | ]); 20 | 21 | return $server->getImageResponse($path, $request->all()); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ForgotPasswordController.php: -------------------------------------------------------------------------------- 1 | softDeletes(); 16 | }); 17 | } 18 | 19 | /** 20 | * Reverse the migrations. 21 | * 22 | * @return void 23 | */ 24 | public function down() { 25 | Schema::table('posts', function (Blueprint $table) { 26 | $table->dropSoftDeletes(); 27 | }); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /resources/js/components/CommentContent.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 24 | -------------------------------------------------------------------------------- /resources/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 | -------------------------------------------------------------------------------- /resources/views/components/code-logo.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/Providers/EventServiceProvider.php: -------------------------------------------------------------------------------- 1 | [ 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 | parent::boot(); 31 | 32 | // 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /resources/sass/fonts.scss: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: "siddur"; 3 | font-weight: 100 900; 4 | font-style: normal; 5 | src: url("/fonts/SiddurOCGX.woff2") format("woff2"); 6 | } 7 | @font-face { 8 | font-family: "SBLhebrew"; 9 | src: url("/fonts/SBL_Hbrw.otf") format("otf"), url("/fonts/SBL_Hbrw.woff2") format("woff2"); 10 | } 11 | @font-face { 12 | font-family: "Heebo var"; // variable font! [https://github.com/TypeNetwork/heebo] 13 | font-weight: 100 900; 14 | font-style: normal; 15 | font-named-instance: "Regular"; 16 | font-display: swap; 17 | src: url("/fonts/Heebo-beta-VF.otf"); 18 | } 19 | 20 | .font-siddur { 21 | margin-top: -0.4em; // fixes variable-font leading bug 22 | font-weight: 700; 23 | font-variation-settings: "wght" var(--siddur-weight), "wdth" var(--siddur-width); 24 | } 25 | 26 | :root { 27 | --siddur-weight: 600; 28 | --siddur-width: 100; 29 | } 30 | -------------------------------------------------------------------------------- /app/Post.php: -------------------------------------------------------------------------------- 1 | belongsTo(User::class); 23 | } 24 | 25 | public function comments() { 26 | return $this->hasMany(Comment::class)->whereNull('parent_id'); 27 | } 28 | 29 | // accessors 30 | public function getCreatedAtAttribute($date) { 31 | return Carbon::parse($date)->diffForHumans(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /resources/views/components/twemoji.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 19 | -------------------------------------------------------------------------------- /app/Comment.php: -------------------------------------------------------------------------------- 1 | belongsTo(User::class); 13 | } 14 | 15 | public function replies() { 16 | return $this->hasMany(Comment::class, 'parent_id')->latest(); 17 | } 18 | 19 | public function parent() { 20 | return $this->belongsTo(Comment::class, 'parent_id'); 21 | } 22 | 23 | public function post() { 24 | return $this->belongsTo(Post::class)->with('user'); 25 | } 26 | 27 | // accessors 28 | public function getRepliesCountAttribute() { 29 | return $this->replies()->count(); 30 | } 31 | 32 | public function getCreatedAtAttribute($date) { 33 | return Carbon::parse($date)->diffForHumans(); 34 | } 35 | 36 | protected $with = ['user']; 37 | 38 | protected $appends = ['repliesCount']; 39 | } 40 | -------------------------------------------------------------------------------- /config/cors.php: -------------------------------------------------------------------------------- 1 | ['api/*'], 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/js/Pages/Users/Index.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 32 | -------------------------------------------------------------------------------- /database/migrations/2019_08_19_000000_create_failed_jobs_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->text('connection'); 19 | $table->text('queue'); 20 | $table->longText('payload'); 21 | $table->longText('exception'); 22 | $table->timestamp('failed_at')->useCurrent(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('failed_jobs'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME=Laravel 2 | APP_ENV=local 3 | APP_KEY= 4 | APP_DEBUG=true 5 | APP_URL=http://localhost 6 | 7 | LOG_CHANNEL=stack 8 | 9 | DB_CONNECTION=mysql 10 | DB_HOST=127.0.0.1 11 | DB_PORT=3306 12 | DB_DATABASE=laravel 13 | DB_USERNAME=root 14 | DB_PASSWORD= 15 | 16 | BROADCAST_DRIVER=log 17 | CACHE_DRIVER=file 18 | QUEUE_CONNECTION=sync 19 | SESSION_DRIVER=file 20 | SESSION_LIFETIME=120 21 | 22 | REDIS_HOST=127.0.0.1 23 | REDIS_PASSWORD=null 24 | REDIS_PORT=6379 25 | 26 | MAIL_MAILER=smtp 27 | MAIL_HOST=smtp.mailtrap.io 28 | MAIL_PORT=2525 29 | MAIL_USERNAME=null 30 | MAIL_PASSWORD=null 31 | MAIL_ENCRYPTION=null 32 | MAIL_FROM_ADDRESS=null 33 | MAIL_FROM_NAME="${APP_NAME}" 34 | 35 | AWS_ACCESS_KEY_ID= 36 | AWS_SECRET_ACCESS_KEY= 37 | AWS_DEFAULT_REGION=us-east-1 38 | AWS_BUCKET= 39 | 40 | PUSHER_APP_ID= 41 | PUSHER_APP_KEY= 42 | PUSHER_APP_SECRET= 43 | PUSHER_APP_CLUSTER=mt1 44 | 45 | MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 46 | MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 47 | -------------------------------------------------------------------------------- /database/migrations/2020_06_25_120842_create_posts_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->foreignId('user_id')->constrained(); 17 | $table->string('title'); 18 | $table->text('content'); 19 | $table->string('ref'); 20 | $table->string('status')->default('public'); 21 | 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() { 32 | Schema::dropIfExists('posts'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ResetPasswordController.php: -------------------------------------------------------------------------------- 1 | is($post->user) || $user->is_admin; 26 | } 27 | 28 | public function delete(User $user, Post $post) { 29 | return $user->is($post->user) || $user->is_admin; 30 | } 31 | 32 | public function restore(User $user, Post $post) { 33 | return $user->is($post->user) || $user->is_admin; 34 | } 35 | 36 | public function forceDelete(User $user, Post $post) { 37 | return $user->is($post->user) || $user->is_admin; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | define(User::class, function (Faker $faker) { 21 | return [ 22 | 'name' => $faker->name, 23 | 'email' => $faker->unique()->safeEmail, 24 | 'email_verified_at' => now(), 25 | 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 26 | 'remember_token' => Str::random(10), 27 | ]; 28 | }); 29 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire')->hourly(); 28 | } 29 | 30 | /** 31 | * Register the commands for the application. 32 | * 33 | * @return void 34 | */ 35 | protected function commands() 36 | { 37 | $this->load(__DIR__.'/Commands'); 38 | 39 | require base_path('routes/console.php'); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), 21 | ], 22 | 23 | 'postmark' => [ 24 | 'token' => env('POSTMARK_TOKEN'), 25 | ], 26 | 27 | 'ses' => [ 28 | 'key' => env('AWS_ACCESS_KEY_ID'), 29 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 30 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 31 | ], 32 | 33 | ]; 34 | -------------------------------------------------------------------------------- /app/Policies/UserPolicy.php: -------------------------------------------------------------------------------- 1 | is_admin; 13 | } 14 | 15 | public function view(User $user, User $model) { 16 | return $user->is_admin || $user->id == $model->id; 17 | } 18 | 19 | public function create(User $user) { 20 | return $user->is_admin; 21 | } 22 | 23 | public function update(User $user, User $model) { 24 | return $user->is_admin || $user->id == $model->id; 25 | } 26 | 27 | public function delete(User $user, User $model) { 28 | return $user->is_admin; 29 | } 30 | 31 | public function approve(User $user) { 32 | return $user->is_admin; 33 | } 34 | 35 | public function restore(User $user, User $model) { 36 | return $user->is_admin; 37 | } 38 | 39 | public function forceDelete(User $user, User $model) { 40 | return $user->is_admin; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/Http/Controllers/CommentController.php: -------------------------------------------------------------------------------- 1 | validate([ 14 | 'content' => 'string|max:2048', 15 | 'parent_id' => 'nullable|exists:comments,id', 16 | ]); 17 | 18 | $comment = new Comment(); 19 | $comment->content = $data['content']; 20 | $comment->user()->associate($request->user()); 21 | $comment->parent_id = $data['parent_id']; 22 | $post->comments()->save($comment); 23 | 24 | return back()->with('success', 'Your comment has been saved successfully!')->with('new_comment', $comment); 25 | } 26 | 27 | public function replies(Request $request, Comment $comment) { 28 | return response()->json($comment->replies); 29 | } 30 | 31 | public function destroy(Comment $comment) { 32 | $comment->delete(); 33 | return back()->with('success', 'Your comment has been successfully deleted!'); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->string('name'); 17 | $table->string('email')->unique(); 18 | $table->string('photo_path', 100)->nullable(); 19 | $table->boolean('is_admin')->default(false); 20 | $table->boolean('is_approved')->default(false); 21 | $table->timestamp('email_verified_at')->nullable(); 22 | $table->string('password'); 23 | $table->rememberToken(); 24 | $table->timestamps(); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | * 31 | * @return void 32 | */ 33 | public function down() { 34 | Schema::dropIfExists('users'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /resources/sass/buttons.scss: -------------------------------------------------------------------------------- 1 | a, 2 | button { 3 | @apply rounded; 4 | &:focus, 5 | &:active { 6 | @apply shadow-outline-blue; 7 | } 8 | } 9 | 10 | .btn-outline { 11 | @apply inline-block px-6 py-2 font-bold text-gray-800 bg-gray-100 border-2 border-gray-800 rounded-full; 12 | &:hover, 13 | &:focus { 14 | @apply bg-white; 15 | } 16 | } 17 | 18 | .btn-blue { 19 | @apply px-6 py-3 rounded bg-blue-600 text-white text-sm font-bold whitespace-no-wrap; 20 | 21 | &:hover, 22 | &:focus { 23 | @apply bg-blue-500; 24 | } 25 | } 26 | 27 | .btn-spinner, 28 | .btn-spinner:after { 29 | border-radius: 50%; 30 | width: 1.5em; 31 | height: 1.5em; 32 | } 33 | 34 | .btn-spinner { 35 | font-size: 10px; 36 | position: relative; 37 | text-indent: -9999em; 38 | border-top: 0.2em solid white; 39 | border-right: 0.2em solid white; 40 | border-bottom: 0.2em solid white; 41 | border-left: 0.2em solid transparent; 42 | transform: translateZ(0); 43 | animation: spinning 1s infinite linear; 44 | } 45 | 46 | @keyframes spinning { 47 | 0% { 48 | transform: rotate(0deg); 49 | } 50 | 100% { 51 | transform: rotate(360deg); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /database/migrations/2020_06_28_135208_add_love_reacter_id_to_users_table.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | declare(strict_types=1); 13 | 14 | use Illuminate\Database\Migrations\Migration; 15 | use Illuminate\Database\Schema\Blueprint; 16 | use Illuminate\Support\Facades\Schema; 17 | 18 | final class AddLoveReacterIdToUsersTable extends Migration 19 | { 20 | public function up(): void 21 | { 22 | Schema::table('users', function (Blueprint $table) { 23 | $table->unsignedBigInteger('love_reacter_id')->nullable(); 24 | 25 | $table 26 | ->foreign('love_reacter_id') 27 | ->references('id') 28 | ->on('love_reacters'); 29 | }); 30 | } 31 | 32 | public function down(): void 33 | { 34 | Schema::table('users', function (Blueprint $table) { 35 | $table->dropForeign(['love_reacter_id']); 36 | $table->dropColumn('love_reacter_id'); 37 | }); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /database/migrations/2020_06_28_135356_add_love_reactant_id_to_posts_table.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | declare(strict_types=1); 13 | 14 | use Illuminate\Database\Migrations\Migration; 15 | use Illuminate\Database\Schema\Blueprint; 16 | use Illuminate\Support\Facades\Schema; 17 | 18 | final class AddLoveReactantIdToPostsTable extends Migration 19 | { 20 | public function up(): void 21 | { 22 | Schema::table('posts', function (Blueprint $table) { 23 | $table->unsignedBigInteger('love_reactant_id')->nullable(); 24 | 25 | $table 26 | ->foreign('love_reactant_id') 27 | ->references('id') 28 | ->on('love_reactants'); 29 | }); 30 | } 31 | 32 | public function down(): void 33 | { 34 | Schema::table('posts', function (Blueprint $table) { 35 | $table->dropForeign(['love_reactant_id']); 36 | $table->dropColumn('love_reactant_id'); 37 | }); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ConfirmPasswordController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /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/js/components/ui/ProgressCircle.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 52 | -------------------------------------------------------------------------------- /app/Http/Controllers/ReactionController.php: -------------------------------------------------------------------------------- 1 | user()->id == $post->user->id) { 12 | return redirect()->back()->with('error', 'You can\'t react to your own posts.'); 13 | } 14 | 15 | /** @var Cog\Contracts\Love\Reacter\Facades\Reacter $reactorFacade */ 16 | $reactorFacade = request()->user()->viaLoveReacter(); 17 | $reactionType = request('reaction'); 18 | 19 | // if already reacted this reaction: toggle 20 | if ($reactorFacade->hasReactedTo($post, $reactionType)) { 21 | $reactorFacade->unreactTo($post, $reactionType); 22 | } else { 23 | // mutually exclusive reactions 24 | if ($reactionType == 'Like' && $reactorFacade->hasReactedTo($post, 'Dislike')) { 25 | $reactorFacade->unreactTo($post, 'Dislike'); 26 | } else if ($reactionType == 'Dislike' && $reactorFacade->hasReactedTo($post, 'Like')) { 27 | $reactorFacade->unreactTo($post, 'Like'); 28 | } 29 | $reactorFacade->reactTo($post, $reactionType); 30 | } 31 | return redirect()->back(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/LoginController.php: -------------------------------------------------------------------------------- 1 | middleware('guest')->except(['logout', 'unapproved']); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/VerificationController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 39 | $this->middleware('signed')->only('verify'); 40 | $this->middleware('throttle:6,1')->only('verify', 'resend'); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /resources/js/Pages/Auth/Unapproved.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 36 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | {{ initials(user.name) }} 13 | 14 | 15 | 16 | 53 | -------------------------------------------------------------------------------- /resources/js/components/Comment.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 40 | -------------------------------------------------------------------------------- /webpack.mix.js: -------------------------------------------------------------------------------- 1 | const mix = require('laravel-mix') 2 | const path = require('path') 3 | require('laravel-mix-tailwind'); 4 | 5 | /* 6 | |-------------------------------------------------------------------------- 7 | | Mix Asset Management 8 | |-------------------------------------------------------------------------- 9 | | 10 | | Mix provides a clean, fluent API for defining some Webpack build steps 11 | | for your Laravel application. By default, we are compiling the Sass 12 | | file for the application as well as bundling up all the JS files. 13 | | 14 | */ 15 | 16 | // mix.browserSync('http://halpern.test:8000') 17 | let url = process.env.APP_URL.replace(/(^\w+:|^)\/\//, ''); 18 | 19 | mix.js('resources/js/app.js', 'public/js') 20 | .sass('resources/sass/app.scss', 'public/css/app.css') 21 | .options({ 22 | processCssUrls: false, 23 | hmrOptions: { 24 | host: url, 25 | port: 8080 // Can't use 443 here because address already in use 26 | } 27 | }) 28 | .tailwind('./tailwind.config.js') 29 | .webpackConfig({ 30 | output: { chunkFilename: 'js/[name].js?id=[chunkhash]' }, 31 | resolve: { 32 | alias: { 33 | vue$: 'vue/dist/vue.runtime.esm.js', 34 | '@': path.resolve('resources/js'), 35 | }, 36 | }, 37 | optimization: { 38 | concatenateModules: false, 39 | providedExports: false, 40 | usedExports: false 41 | } 42 | }) 43 | 44 | 45 | if (mix.inProduction()) { 46 | mix 47 | .version() 48 | .sourceMaps() 49 | } 50 | -------------------------------------------------------------------------------- /resources/sass/transitions.scss: -------------------------------------------------------------------------------- 1 | .transition { 2 | transition: all 0.3s ease; 3 | } 4 | 5 | // Page transition 6 | .slideUp-enter-active { 7 | transition: all 0.3s ease-in; 8 | } 9 | .slideUp-leave-active { 10 | transition: none; 11 | } 12 | .slideUp-enter, 13 | .slideUp-leave-to { 14 | opacity: 0; 15 | transform: translateY(10px); 16 | } 17 | 18 | // Post-list transition 19 | .postList-enter-active, 20 | .postList-leave-active { 21 | transition: all 0.3s ease-in; 22 | } 23 | 24 | .postList-enter, 25 | .postList-leave-to { 26 | opacity: 0; 27 | transform: translateY(10px); 28 | } 29 | 30 | // Slide transition 31 | .slide-back-enter-active, 32 | .slide-back-leave-active, 33 | .slide-in-enter-active, 34 | .slide-in-leave-active { 35 | transition: all 0.3s ease-in; 36 | } 37 | 38 | .slide-back-enter, 39 | .slide-in-leave-to { 40 | transform: translate(100%, 0); 41 | position: absolute; 42 | } 43 | .slide-back-leave-to, 44 | .slide-in-enter { 45 | transform: translate(-100%, 0); 46 | position: absolute; 47 | } 48 | 49 | // Fade transition 50 | .fade-enter-active, 51 | .fade-leave-active { 52 | transition: all 0.3s ease-in; 53 | opacity: 0.95; 54 | } 55 | 56 | .fade-enter, 57 | .fade-leave-to { 58 | opacity: 0; 59 | } 60 | 61 | // Modal transition 62 | .modal-fade-enter-active, 63 | .modal-fade-leave-active { 64 | opacity: 1; 65 | transition: all 0.3s ease-in; 66 | .modal { 67 | transform: none; 68 | transition: all 0.3s ease; 69 | } 70 | } 71 | .modal-fade-enter, 72 | .modal-fade-leave-to { 73 | opacity: 0; 74 | .modal { 75 | transform: scale(0.8); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | const defaultTheme = require('tailwindcss/defaultTheme') 2 | 3 | module.exports = { 4 | purge: [ 5 | './resources/**/*.blade.php', 6 | './resources/**/*.html', 7 | './resources/**/*.vue', 8 | './resources/**/*.css', 9 | ], 10 | theme: { 11 | extend: { 12 | colors: { 13 | brand: '#ffad1f', 14 | gray: { 15 | 50: '#fbfdfe', 16 | 80: '#EFF4F8', 17 | 100: '#f7fafc', 18 | 200: '#edf2f7', 19 | 300: '#e2e8f0', 20 | 400: '#cbd5e0', 21 | 500: '#a0aec0', 22 | 600: '#718096', 23 | 700: '#4a5568', 24 | 800: '#2d3748', 25 | 900: '#1a202c', 26 | }, 27 | }, 28 | fontFamily: { 29 | sans: ['Heebo var', ...defaultTheme.fontFamily.sans], 30 | siddur: ['siddur', 'Heebo var', ...defaultTheme.fontFamily.sans], 31 | sbl: ['SBLhebrew', 'Heebo var', ...defaultTheme.fontFamily.sans], 32 | }, 33 | fontSize: { 34 | xxs: '0.675rem' 35 | }, 36 | borderRadius: { 37 | xl: '1rem' 38 | }, 39 | boxShadow: theme => ({ 40 | outline: '0 0 0 2px ' + theme('colors.indigo.500'), 41 | }), 42 | fill: theme => theme('colors'), 43 | }, 44 | }, 45 | variants: { 46 | fill: ['responsive', 'hover', 'focus', 'group-hover'], 47 | opacity: ['hover', 'focus', 'group-hover'], 48 | textColor: ['responsive', 'hover', 'focus', 'group-hover'], 49 | zIndex: ['responsive', 'focus'], 50 | display: ['responsive', 'hover', 'group-hover'], 51 | }, 52 | plugins: [ 53 | require('@tailwindcss/ui'), 54 | ], 55 | } 56 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "npm run development", 5 | "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", 6 | "watch": "npm run development -- --watch", 7 | "watch-poll": "npm run watch -- --watch-poll", 8 | "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --https --key /Users/yehudaneufeld/.config/valet/Certificates/pninim.test.key --cert /Users/yehudaneufeld/.config/valet/Certificates/pninim.test.crt --config=node_modules/laravel-mix/setup/webpack.config.js", 9 | "build": "npm run production", 10 | "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" 11 | }, 12 | "devDependencies": { 13 | "axios": "^0.19", 14 | "cross-env": "^7.0", 15 | "laravel-mix": "^5.0.1", 16 | "lodash": "^4.17.19", 17 | "resolve-url-loader": "^5.0.0", 18 | "sass": "^1.15.2", 19 | "sass-loader": "^8.0.0", 20 | "vue-template-compiler": "^2.6.11" 21 | }, 22 | "dependencies": { 23 | "@braid/vue-formulate": "^2.4.1", 24 | "@inertiajs/inertia": "^0.1.9", 25 | "@inertiajs/inertia-vue": "^0.1.2", 26 | "@tailwindcss/ui": "^0.3.0", 27 | "laravel-mix-tailwind": "^0.1.0", 28 | "popper.js": "^1.16.1", 29 | "portal-vue": "^2.1.7", 30 | "tailwindcss": "^1.8.10", 31 | "vue": "^2.6.11", 32 | "vue-auto-resize": "^1.0.1", 33 | "vue-infinite-loading": "^2.4.5", 34 | "vue-slider-component": "^3.2.5" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueFormulate from '@braid/vue-formulate' 3 | import PortalVue from 'portal-vue' 4 | import Axios from 'axios'; 5 | import { InertiaApp } from '@inertiajs/inertia-vue' 6 | import Icon from '@/components/ui/Icon' 7 | import Loader from '@/components/ui/Loader' 8 | import Badge from '@/components/ui/Badge' 9 | import BaseButton from '@/components/ui/BaseButton' 10 | import AutoSize from 'vue-auto-resize' 11 | import 'vue-slider-component/theme/default.css'; 12 | 13 | // Fixes -> https://github.com/JeffreyWay/laravel-mix/issues/2376#issuecomment-665942865 14 | import CssBase from "css-loader/lib/css-base"; 15 | import AddStyles from "style-loader/lib/addStyles"; 16 | 17 | Vue.config.productionTip = false 18 | 19 | const axios = Axios.create({ 20 | baseUrl: 'https://pninim.yiddishe-kop.com' 21 | }) 22 | Vue.use(VueFormulate, { 23 | uploader: axios, 24 | uploadUrl: '/upload' 25 | }) 26 | 27 | Vue.prototype.$axios = axios 28 | 29 | Vue.directive('auto-resize', AutoSize) 30 | 31 | Vue.mixin({ methods: { route: window.route } }) 32 | Vue.use(PortalVue) 33 | Vue.use(InertiaApp) 34 | 35 | Vue.component('BaseButton', BaseButton) 36 | Vue.component('Icon', Icon) 37 | Vue.component('Loader', Loader) 38 | Vue.component('Badge', Badge) 39 | 40 | let appEl = document.getElementById('app') 41 | 42 | const app = new Vue({ 43 | metaInfo: { 44 | titleTemplate: (title) => title ? `${title} - Halpern CRM` : 'Halpern CRM' 45 | }, 46 | render: h => h(InertiaApp, { 47 | props: { 48 | initialPage: JSON.parse(appEl.dataset.page), 49 | resolveComponent: name => import(`@/Pages/${name}`).then(module => module.default), 50 | }, 51 | }), 52 | }).$mount(appEl) 53 | 54 | export default app; 55 | -------------------------------------------------------------------------------- /resources/js/components/ui/Dropdown.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 66 | -------------------------------------------------------------------------------- /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' => 1024, 48 | 'threads' => 2, 49 | 'time' => 2, 50 | ], 51 | 52 | ]; 53 | -------------------------------------------------------------------------------- /resources/sass/nprogress.scss: -------------------------------------------------------------------------------- 1 | /* Make clicks pass-through */ 2 | #nprogress { 3 | pointer-events: none; 4 | } 5 | 6 | #nprogress .bar { 7 | background: #29d; 8 | 9 | position: fixed; 10 | z-index: 1031; 11 | top: 0; 12 | left: 0; 13 | 14 | width: 100%; 15 | height: 2px; 16 | } 17 | 18 | /* Fancy blur effect */ 19 | #nprogress .peg { 20 | display: block; 21 | position: absolute; 22 | right: 0px; 23 | width: 100px; 24 | height: 100%; 25 | box-shadow: 0 0 10px #29d, 0 0 5px #29d; 26 | opacity: 1.0; 27 | 28 | -webkit-transform: rotate(3deg) translate(0px, -4px); 29 | -ms-transform: rotate(3deg) translate(0px, -4px); 30 | transform: rotate(3deg) translate(0px, -4px); 31 | } 32 | 33 | /* Remove these to get rid of the spinner */ 34 | #nprogress .spinner { 35 | display: block; 36 | position: fixed; 37 | z-index: 1031; 38 | top: 15px; 39 | right: 15px; 40 | } 41 | 42 | #nprogress .spinner-icon { 43 | width: 18px; 44 | height: 18px; 45 | box-sizing: border-box; 46 | 47 | border: solid 2px transparent; 48 | border-top-color: #29d; 49 | border-left-color: #29d; 50 | border-radius: 50%; 51 | 52 | -webkit-animation: nprogress-spinner 400ms linear infinite; 53 | animation: nprogress-spinner 400ms linear infinite; 54 | } 55 | 56 | .nprogress-custom-parent { 57 | overflow: hidden; 58 | position: relative; 59 | } 60 | 61 | .nprogress-custom-parent #nprogress .spinner, 62 | .nprogress-custom-parent #nprogress .bar { 63 | position: absolute; 64 | } 65 | 66 | @-webkit-keyframes nprogress-spinner { 67 | 0% { -webkit-transform: rotate(0deg); } 68 | 100% { -webkit-transform: rotate(360deg); } 69 | } 70 | @keyframes nprogress-spinner { 71 | 0% { transform: rotate(0deg); } 72 | 100% { transform: rotate(360deg); } 73 | } 74 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'null'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Broadcast Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the broadcast connections that will be used 26 | | to broadcast events to other systems or over websockets. Samples of 27 | | each available type of connection are provided inside this array. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'pusher' => [ 34 | 'driver' => 'pusher', 35 | 'key' => env('PUSHER_APP_KEY'), 36 | 'secret' => env('PUSHER_APP_SECRET'), 37 | 'app_id' => env('PUSHER_APP_ID'), 38 | 'options' => [ 39 | 'cluster' => env('PUSHER_APP_CLUSTER'), 40 | 'useTLS' => true, 41 | ], 42 | ], 43 | 44 | 'redis' => [ 45 | 'driver' => 'redis', 46 | 'connection' => 'default', 47 | ], 48 | 49 | 'log' => [ 50 | 'driver' => 'log', 51 | ], 52 | 53 | 'null' => [ 54 | 'driver' => 'null', 55 | ], 56 | 57 | ], 58 | 59 | ]; 60 | -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | make(Illuminate\Contracts\Console\Kernel::class); 34 | 35 | $status = $kernel->handle( 36 | $input = new Symfony\Component\Console\Input\ArgvInput, 37 | new Symfony\Component\Console\Output\ConsoleOutput 38 | ); 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Shutdown The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once Artisan has finished running, we will fire off the shutdown events 46 | | so that any final work may be done by the application before we shut 47 | | down the process. This is the last thing to happen to the request. 48 | | 49 | */ 50 | 51 | $kernel->terminate($input, $status); 52 | 53 | exit($status); 54 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "type": "project", 4 | "description": "The Laravel Framework.", 5 | "keywords": [ 6 | "framework", 7 | "laravel" 8 | ], 9 | "license": "MIT", 10 | "require": { 11 | "php": "^8.1", 12 | "cybercog/laravel-love": "^8.4", 13 | "doctrine/dbal": "^2.10", 14 | "fideloper/proxy": "^4.2", 15 | "fruitcake/laravel-cors": "^3.0", 16 | "guzzlehttp/guzzle": "^7.4", 17 | "inertiajs/inertia-laravel": "^0.6.3", 18 | "laravel/framework": "^9.0", 19 | "laravel/tinker": "^2.7", 20 | "laravel/ui": "^4.0", 21 | "league/glide-laravel": "^1.0", 22 | "tightenco/ziggy": "^1.4.0" 23 | }, 24 | "require-dev": { 25 | "barryvdh/laravel-debugbar": "^3.7", 26 | "spatie/laravel-ignition": "^1.0", 27 | "fzaninotto/faker": "^1.9.1", 28 | "mockery/mockery": "^1.3.1", 29 | "nunomaduro/collision": "^6.1", 30 | "phpunit/phpunit": "^9.3" 31 | }, 32 | "config": { 33 | "optimize-autoloader": true, 34 | "preferred-install": "dist", 35 | "sort-packages": true 36 | }, 37 | "extra": { 38 | "laravel": { 39 | "dont-discover": [] 40 | } 41 | }, 42 | "autoload": { 43 | "psr-4": { 44 | "App\\": "app/" 45 | }, 46 | "classmap": [ 47 | "database/seeds", 48 | "database/factories" 49 | ] 50 | }, 51 | "autoload-dev": { 52 | "psr-4": { 53 | "Tests\\": "tests/" 54 | } 55 | }, 56 | "minimum-stability": "dev", 57 | "prefer-stable": true, 58 | "scripts": { 59 | "post-autoload-dump": [ 60 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 61 | "@php artisan package:discover --ansi" 62 | ], 63 | "post-root-package-install": [ 64 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 65 | ], 66 | "post-create-project-cmd": [ 67 | "@php artisan key:generate --ansi" 68 | ] 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /app/User.php: -------------------------------------------------------------------------------- 1 | 'datetime', 29 | 'is_approved' => 'boolean', 30 | 'is_admin' => 'boolean', 31 | ]; 32 | 33 | protected $appends = ['photoUrl']; 34 | 35 | public function profile() 36 | { 37 | return $this->hasOne(Profile::class); 38 | } 39 | 40 | public function posts() 41 | { 42 | return $this->hasMany(Post::class); 43 | } 44 | 45 | public function comments() 46 | { 47 | return $this->hasMany(Comment::class)->latest(); 48 | } 49 | 50 | public function setPasswordAttribute($password) 51 | { 52 | $this->attributes['password'] = Hash::needsRehash($password) ? Hash::make($password) : $password; 53 | } 54 | 55 | public function getPhotoUrlAttribute() 56 | { 57 | return $this->photoUrl(['w' => 100, 'h' => 100, 'fit' => 'crop']); 58 | } 59 | 60 | public function photoUrl(array $attributes) 61 | { 62 | if ($this->photo_path) { 63 | return URL::route('image', ['path' => $this->photo_path, ...$attributes]); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | mapApiRoutes(); 43 | 44 | $this->mapWebRoutes(); 45 | 46 | // 47 | } 48 | 49 | /** 50 | * Define the "web" routes for the application. 51 | * 52 | * These routes all receive session state, CSRF protection, etc. 53 | * 54 | * @return void 55 | */ 56 | protected function mapWebRoutes() { 57 | Route::middleware('web') 58 | ->namespace($this->namespace) 59 | ->group(base_path('routes/web.php')); 60 | } 61 | 62 | /** 63 | * Define the "api" routes for the application. 64 | * 65 | * These routes are typically stateless. 66 | * 67 | * @return void 68 | */ 69 | protected function mapApiRoutes() { 70 | Route::prefix('api') 71 | ->middleware('api') 72 | ->namespace($this->namespace) 73 | ->group(base_path('routes/api.php')); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /resources/assets/js/ziggy.js: -------------------------------------------------------------------------------- 1 | var Ziggy = { 2 | namedRoutes: {"logout":{"uri":"logout","methods":["POST"],"domain":null},"register":{"uri":"register","methods":["GET","HEAD"],"domain":null},"register.attempt":{"uri":"register","methods":["POST"],"domain":null},"login":{"uri":"login","methods":["GET","HEAD"],"domain":null},"login.attempt":{"uri":"login","methods":["POST"],"domain":null},"users.approve":{"uri":"{user}\/approve","methods":["POST"],"domain":null},"users.unapprove":{"uri":"{user}\/unapprove","methods":["POST"],"domain":null},"posts.index":{"uri":"posts","methods":["GET","HEAD"],"domain":null},"posts.create":{"uri":"posts\/create","methods":["GET","HEAD"],"domain":null},"posts.store":{"uri":"posts","methods":["POST"],"domain":null},"posts.show":{"uri":"posts\/{post}","methods":["GET","HEAD"],"domain":null},"posts.edit":{"uri":"posts\/{post}\/edit","methods":["GET","HEAD"],"domain":null},"posts.update":{"uri":"posts\/{post}","methods":["PUT","PATCH"],"domain":null},"posts.destroy":{"uri":"posts\/{post}","methods":["DELETE"],"domain":null},"users.index":{"uri":"users","methods":["GET","HEAD"],"domain":null},"users.create":{"uri":"users\/create","methods":["GET","HEAD"],"domain":null},"users.store":{"uri":"users","methods":["POST"],"domain":null},"users.show":{"uri":"users\/{user}","methods":["GET","HEAD"],"domain":null},"users.edit":{"uri":"users\/{user}\/edit","methods":["GET","HEAD"],"domain":null},"users.update":{"uri":"users\/{user}","methods":["PUT","PATCH"],"domain":null},"users.destroy":{"uri":"users\/{user}","methods":["DELETE"],"domain":null}}, 3 | baseUrl: 'https://pninim.test/', 4 | baseProtocol: 'https', 5 | baseDomain: 'pninim.test', 6 | basePort: false, 7 | defaultParameters: [] 8 | }; 9 | 10 | if (typeof window !== 'undefined' && typeof window.Ziggy !== 'undefined') { 11 | for (var name in window.Ziggy.namedRoutes) { 12 | Ziggy.namedRoutes[name] = window.Ziggy.namedRoutes[name]; 13 | } 14 | } 15 | 16 | export { 17 | Ziggy 18 | } 19 | -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | define('LARAVEL_START', microtime(true)); 11 | 12 | /* 13 | |-------------------------------------------------------------------------- 14 | | Register The Auto Loader 15 | |-------------------------------------------------------------------------- 16 | | 17 | | Composer provides a convenient, automatically generated class loader for 18 | | our application. We just need to utilize it! We'll simply require it 19 | | into the script here so that we don't have to worry about manual 20 | | loading any of our classes later on. It feels great to relax. 21 | | 22 | */ 23 | 24 | require __DIR__.'/../vendor/autoload.php'; 25 | 26 | /* 27 | |-------------------------------------------------------------------------- 28 | | Turn On The Lights 29 | |-------------------------------------------------------------------------- 30 | | 31 | | We need to illuminate PHP development, so let us turn on the lights. 32 | | This bootstraps the framework and gets it ready for use, then it 33 | | will load up this application so that we can run it and send 34 | | the responses back to the browser and delight our users. 35 | | 36 | */ 37 | 38 | $app = require_once __DIR__.'/../bootstrap/app.php'; 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Run The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once we have the application, we can handle the incoming request 46 | | through the kernel, and send the associated response back to 47 | | the client's browser allowing them to enjoy the creative 48 | | and wonderful application we have prepared for them. 49 | | 50 | */ 51 | 52 | $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); 53 | 54 | $response = $kernel->handle( 55 | $request = Illuminate\Http\Request::capture() 56 | ); 57 | 58 | $response->send(); 59 | 60 | $kernel->terminate($request, $response); 61 | -------------------------------------------------------------------------------- /resources/js/Pages/Posts/Index.vue: -------------------------------------------------------------------------------- 1 | 29 | 30 | 65 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/RegisterController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 41 | } 42 | 43 | public function showRegisterForm() { 44 | return Inertia::render('Auth/Register'); 45 | } 46 | 47 | /** 48 | * Get a validator for an incoming registration request. 49 | * 50 | * @param array $data 51 | * @return \Illuminate\Contracts\Validation\Validator 52 | */ 53 | protected function validator(array $data) { 54 | return Validator::make($data, [ 55 | 'name' => ['required', 'string', 'max:255'], 56 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 57 | 'password' => ['required', 'string', 'min:8', 'confirmed'], 58 | ]); 59 | } 60 | 61 | /** 62 | * Create a new user instance after a valid registration. 63 | * 64 | * @param array $data 65 | * @return \App\User 66 | */ 67 | protected function create(array $data) { 68 | return User::create([ 69 | 'name' => $data['name'], 70 | 'email' => $data['email'], 71 | 'password' => Hash::make($data['password']), 72 | ]); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /resources/js/Pages/Users/Edit.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 87 | -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | registerInertia(); 17 | } 18 | 19 | public function boot() 20 | { 21 | Carbon::setLocale('he'); 22 | 23 | Inertia::macro('data', function ($page, $props = []) { 24 | if (request()->wantsJson()) { 25 | return new JsonResponse($props); 26 | } 27 | return Inertia::render($page, $props); 28 | }); 29 | } 30 | 31 | public function registerInertia() 32 | { 33 | Inertia::version(function () { 34 | return md5_file(public_path('mix-manifest.json')); 35 | }); 36 | 37 | Inertia::share([ 38 | 'auth' => function () { 39 | return [ 40 | 'user' => Auth::user() ? [ 41 | 'id' => Auth::user()->id, 42 | 'name' => Auth::user()->name, 43 | 'email' => Auth::user()->email, 44 | 'photoUrl' => Auth::user()->photoUrl(['w' => 100, 'h' => 100, 'fit' => 'crop']), 45 | 'is_approved' => Auth::user()->is_approved, 46 | 'is_admin' => Auth::user()->is_admin, 47 | ] : null, 48 | ]; 49 | }, 50 | 'flash' => function () { 51 | return [ 52 | 'success' => Session::get('success'), 53 | 'errorTitle' => Session::get('errorTitle'), 54 | 'error' => Session::get('error'), 55 | ]; 56 | }, 57 | 'errors' => function () { 58 | return Session::get('errors') 59 | ? Session::get('errors')->getBag('default')->getMessages() 60 | : (object) []; 61 | }, 62 | 'old' => function () { 63 | return session()->getOldInput(); 64 | }, 65 | 'modal' => [ 66 | 'open' => false, 67 | 'icon' => 'warning', 68 | 'color' => 'red', 69 | 'title' => 'פנינים', 70 | 'message' => 'פנינים', 71 | 'action' => [ 72 | 'label' => 'Hey!', 73 | ], 74 | ], 75 | ]); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /routes/web.php: -------------------------------------------------------------------------------- 1 | name('home'); 19 | 20 | // Route::get('/mail', function () { 21 | // Mail::to('newgraphil@gmail.com')->send(new TestMail()); 22 | // return new TestMail(); 23 | // }); 24 | 25 | // Uploads 26 | Route::post('/upload', 'UploadController'); 27 | 28 | // Images 29 | Route::get('/img/{path}', 'ImagesController@show')->where('path', '.*'); 30 | 31 | Route::post('logout', 'Auth\LoginController@logout')->name('logout'); 32 | Route::get('access-denied', 'Auth\LoginController@unapproved'); 33 | 34 | Route::middleware('guest')->group(function () { 35 | Route::get('register', 'Auth\RegisterController@showRegisterForm')->name('register'); 36 | Route::post('register', 'Auth\RegisterController@register')->name('register.attempt'); 37 | Route::get('login', 'Auth\LoginController@showLoginForm')->name('login'); 38 | Route::post('login', 'Auth\LoginController@login')->name('login.attempt'); 39 | }); 40 | 41 | Route::middleware('admin')->group(function () { 42 | Route::post('{user}/approve', 'UserController@approve')->name('users.approve'); 43 | Route::post('{user}/unapprove', 'UserController@unapprove')->name('users.unapprove'); 44 | }); 45 | 46 | Route::middleware('approved')->group(function () { 47 | }); 48 | 49 | Route::middleware('auth')->group(function () { 50 | Route::post('/posts/{post}/react', 'ReactionController')->name('posts.react'); 51 | Route::post('/posts/{post}/comment', 'CommentController@store')->name('comments.store'); 52 | Route::get('/comments/{comment}/replies', 'CommentController@replies')->name('comment.replies'); 53 | Route::delete('/comments/{comment}', 'CommentController@destroy')->name('comment.destroy'); 54 | }); 55 | 56 | Route::put('posts/{post}/restore', 'PostController@restore')->name('posts.restore'); 57 | Route::delete('posts/{post}/force', 'PostController@forceDelete')->name('posts.forceDelete'); 58 | 59 | Route::resources([ 60 | 'posts' => 'PostController', 61 | 'users' => 'UserController', 62 | ]); 63 | 64 | Route::get('/img/{path}', 'ImagesController@show') 65 | ->where('path', '.*') 66 | ->name('image'); 67 | -------------------------------------------------------------------------------- /resources/js/components/ui/BaseButton.vue: -------------------------------------------------------------------------------- 1 | 30 | 31 | 81 | -------------------------------------------------------------------------------- /resources/js/components/ui/Badge.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 91 | -------------------------------------------------------------------------------- /resources/js/Pages/Auth/Login.vue: -------------------------------------------------------------------------------- 1 | 42 | 43 | 80 | -------------------------------------------------------------------------------- /app/Http/Kernel.php: -------------------------------------------------------------------------------- 1 | [ 32 | \App\Http\Middleware\EncryptCookies::class, 33 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 34 | \Illuminate\Session\Middleware\StartSession::class, 35 | // \Illuminate\Session\Middleware\AuthenticateSession::class, 36 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 37 | \App\Http\Middleware\VerifyCsrfToken::class, 38 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 39 | ], 40 | 41 | 'api' => [ 42 | 'throttle:60,1', 43 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 44 | ], 45 | ]; 46 | 47 | /** 48 | * The application's route middleware. 49 | * 50 | * These middleware may be assigned to groups or used individually. 51 | * 52 | * @var array 53 | */ 54 | protected $routeMiddleware = [ 55 | 'auth' => \App\Http\Middleware\Authenticate::class, 56 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 57 | 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, 58 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 59 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 60 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 61 | 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, 62 | 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, 63 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 64 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 65 | 66 | 'admin' => \App\Http\Middleware\Admin::class, 67 | 'approved' => \App\Http\Middleware\Approved::class, 68 | ]; 69 | } 70 | -------------------------------------------------------------------------------- /resources/js/components/WriteComment.vue: -------------------------------------------------------------------------------- 1 | 43 | 44 | 99 | 100 | 102 | -------------------------------------------------------------------------------- /app/Http/Controllers/PostController.php: -------------------------------------------------------------------------------- 1 | middleware('auth', [ 14 | 'except' => ['index', 'show'], 15 | ]); 16 | } 17 | 18 | public function index() { 19 | return Inertia::data('Posts/Index', [ 20 | 'posts' => Post::with([ 21 | 'user', 22 | 'comments.replies.user', 23 | 'comments.user', 24 | 'loveReactant.reactionCounters', 25 | ])->latest() 26 | ->paginate(10), 27 | 'reactionTypes' => ReactionType::select('id', 'name') 28 | ->get() 29 | ->keyBy('id'), 30 | 'newComment' => session('new_comment') 31 | ]); 32 | } 33 | 34 | public function create() { 35 | // 36 | } 37 | 38 | public function store(Request $request) { 39 | 40 | $post = auth()->user()->posts()->create( 41 | $request->validate([ 42 | 'title' => 'required|max:1024|string', 43 | 'content' => 'required|max:5096|string', 44 | 'ref' => 'required', 45 | 'status' => 'nullable', 46 | 'type' => sprintf('nullable|in:%s,%s,%s,%s', 47 | Post::TYPE_BIUR, 48 | Post::TYPE_CHIDDUSH, 49 | Post::TYPE_NOTE, 50 | Post::TYPE_QUESTION 51 | ), 52 | ]) 53 | ); 54 | 55 | return back()->with('success', 'Post created!' . $post->title); 56 | } 57 | 58 | public function show(Post $post) { 59 | // 60 | } 61 | 62 | public function edit(Post $post) { 63 | // 64 | } 65 | 66 | public function update(Request $request, Post $post) { 67 | $this->authorize('update', $post); 68 | $post->update( 69 | $request->validate([ 70 | 'title' => 'required|max:1024|string', 71 | 'content' => 'required|max:5096|string', 72 | ]) 73 | ); 74 | return back()->with('success', 'Post updated!'); 75 | } 76 | 77 | public function destroy(Post $post) { 78 | $this->authorize('delete', $post); 79 | $post->delete(); 80 | return back()->with('success', 'Post deleted!' . $post->title); 81 | } 82 | 83 | public function forceDelete(Post $post) { 84 | $this->authorize('forceDelete', $post); 85 | $post->forceDelete(); 86 | return back()->with('success', 'Post permanently deleted!'); 87 | } 88 | 89 | public function restore(Post $post) { 90 | $this->authorize('restore', $post); 91 | $post->restore(); 92 | return back()->with('success', 'Post restored!' . $post->title); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | env('FILESYSTEM_DRIVER', 'local'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Default Cloud Filesystem Disk 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Many applications store files both locally and in the cloud. For this 24 | | reason, you may specify a default "cloud" driver here. This driver 25 | | will be bound as the Cloud disk implementation in the container. 26 | | 27 | */ 28 | 29 | 'cloud' => env('FILESYSTEM_CLOUD', 's3'), 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Filesystem Disks 34 | |-------------------------------------------------------------------------- 35 | | 36 | | Here you may configure as many filesystem "disks" as you wish, and you 37 | | may even configure multiple disks of the same driver. Defaults have 38 | | been setup for each driver as an example of the required options. 39 | | 40 | | Supported Drivers: "local", "ftp", "sftp", "s3" 41 | | 42 | */ 43 | 44 | 'disks' => [ 45 | 46 | 'local' => [ 47 | 'driver' => 'local', 48 | 'root' => storage_path('app'), 49 | ], 50 | 51 | 'public' => [ 52 | 'driver' => 'local', 53 | 'root' => storage_path('app/public'), 54 | 'url' => env('APP_URL').'/storage', 55 | 'visibility' => 'public', 56 | ], 57 | 58 | 's3' => [ 59 | 'driver' => 's3', 60 | 'key' => env('AWS_ACCESS_KEY_ID'), 61 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 62 | 'region' => env('AWS_DEFAULT_REGION'), 63 | 'bucket' => env('AWS_BUCKET'), 64 | 'url' => env('AWS_URL'), 65 | 'endpoint' => env('AWS_ENDPOINT'), 66 | ], 67 | 68 | ], 69 | 70 | /* 71 | |-------------------------------------------------------------------------- 72 | | Symbolic Links 73 | |-------------------------------------------------------------------------- 74 | | 75 | | Here you may configure the symbolic links that will be created when the 76 | | `storage:link` Artisan command is executed. The array keys should be 77 | | the locations of the links and the values should be their targets. 78 | | 79 | */ 80 | 81 | 'links' => [ 82 | public_path('storage') => storage_path('app/public'), 83 | ], 84 | 85 | ]; 86 | -------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_CONNECTION', 'sync'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Queue Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure the connection information for each server that 24 | | is used by your application. A default configuration has been added 25 | | for each back-end shipped with Laravel. You are free to add more. 26 | | 27 | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'sync' => [ 34 | 'driver' => 'sync', 35 | ], 36 | 37 | 'database' => [ 38 | 'driver' => 'database', 39 | 'table' => 'jobs', 40 | 'queue' => 'default', 41 | 'retry_after' => 90, 42 | ], 43 | 44 | 'beanstalkd' => [ 45 | 'driver' => 'beanstalkd', 46 | 'host' => 'localhost', 47 | 'queue' => 'default', 48 | 'retry_after' => 90, 49 | 'block_for' => 0, 50 | ], 51 | 52 | 'sqs' => [ 53 | 'driver' => 'sqs', 54 | 'key' => env('AWS_ACCESS_KEY_ID'), 55 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 56 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 57 | 'queue' => env('SQS_QUEUE', 'your-queue-name'), 58 | 'suffix' => env('SQS_SUFFIX'), 59 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 60 | ], 61 | 62 | 'redis' => [ 63 | 'driver' => 'redis', 64 | 'connection' => 'default', 65 | 'queue' => env('REDIS_QUEUE', 'default'), 66 | 'retry_after' => 90, 67 | 'block_for' => null, 68 | ], 69 | 70 | ], 71 | 72 | /* 73 | |-------------------------------------------------------------------------- 74 | | Failed Queue Jobs 75 | |-------------------------------------------------------------------------- 76 | | 77 | | These options configure the behavior of failed queue job logging so you 78 | | can control which database and table are used to store the jobs that 79 | | have failed. You may change them to any database / table you wish. 80 | | 81 | */ 82 | 83 | 'failed' => [ 84 | 'driver' => env('QUEUE_FAILED_DRIVER', 'database'), 85 | 'database' => env('DB_CONNECTION', 'mysql'), 86 | 'table' => 'failed_jobs', 87 | ], 88 | 89 | ]; 90 | -------------------------------------------------------------------------------- /resources/js/components/PostsList.vue: -------------------------------------------------------------------------------- 1 | 51 | 52 | 86 | -------------------------------------------------------------------------------- /resources/js/components/SelectPopover.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 103 | -------------------------------------------------------------------------------- /config/logging.php: -------------------------------------------------------------------------------- 1 | env('LOG_CHANNEL', 'stack'), 21 | 22 | /* 23 | |-------------------------------------------------------------------------- 24 | | Log Channels 25 | |-------------------------------------------------------------------------- 26 | | 27 | | Here you may configure the log channels for your application. Out of 28 | | the box, Laravel uses the Monolog PHP logging library. This gives 29 | | you a variety of powerful log handlers / formatters to utilize. 30 | | 31 | | Available Drivers: "single", "daily", "slack", "syslog", 32 | | "errorlog", "monolog", 33 | | "custom", "stack" 34 | | 35 | */ 36 | 37 | 'channels' => [ 38 | 'stack' => [ 39 | 'driver' => 'stack', 40 | 'channels' => ['single'], 41 | 'ignore_exceptions' => false, 42 | ], 43 | 44 | 'single' => [ 45 | 'driver' => 'single', 46 | 'path' => storage_path('logs/laravel.log'), 47 | 'level' => 'debug', 48 | ], 49 | 50 | 'daily' => [ 51 | 'driver' => 'daily', 52 | 'path' => storage_path('logs/laravel.log'), 53 | 'level' => 'debug', 54 | 'days' => 14, 55 | ], 56 | 57 | 'slack' => [ 58 | 'driver' => 'slack', 59 | 'url' => env('LOG_SLACK_WEBHOOK_URL'), 60 | 'username' => 'Laravel Log', 61 | 'emoji' => ':boom:', 62 | 'level' => 'critical', 63 | ], 64 | 65 | 'papertrail' => [ 66 | 'driver' => 'monolog', 67 | 'level' => 'debug', 68 | 'handler' => SyslogUdpHandler::class, 69 | 'handler_with' => [ 70 | 'host' => env('PAPERTRAIL_URL'), 71 | 'port' => env('PAPERTRAIL_PORT'), 72 | ], 73 | ], 74 | 75 | 'stderr' => [ 76 | 'driver' => 'monolog', 77 | 'handler' => StreamHandler::class, 78 | 'formatter' => env('LOG_STDERR_FORMATTER'), 79 | 'with' => [ 80 | 'stream' => 'php://stderr', 81 | ], 82 | ], 83 | 84 | 'syslog' => [ 85 | 'driver' => 'syslog', 86 | 'level' => 'debug', 87 | ], 88 | 89 | 'errorlog' => [ 90 | 'driver' => 'errorlog', 91 | 'level' => 'debug', 92 | ], 93 | 94 | 'null' => [ 95 | 'driver' => 'monolog', 96 | 'handler' => NullHandler::class, 97 | ], 98 | 99 | 'emergency' => [ 100 | 'path' => storage_path('logs/laravel.log'), 101 | ], 102 | ], 103 | 104 | ]; 105 | -------------------------------------------------------------------------------- /resources/js/components/ui/Notification.vue: -------------------------------------------------------------------------------- 1 | 49 | 50 | 90 | -------------------------------------------------------------------------------- /resources/js/Pages/Auth/Register.vue: -------------------------------------------------------------------------------- 1 | 58 | 59 | 100 | -------------------------------------------------------------------------------- /resources/sass/misc.scss: -------------------------------------------------------------------------------- 1 | .logo { 2 | svg { 3 | transition: all 0.2s ease; 4 | animation: rotate-3d 4s ease-in-out 1s 5; 5 | .lamp { 6 | fill: currentColor; 7 | @apply text-brand; 8 | } 9 | .c { 10 | fill: currentColor; 11 | @apply text-gray-300; 12 | } 13 | &:hover { 14 | transform: rotate3d(0, 1, 0, 0deg); 15 | // animation-duration: 8s; 16 | .lamp { 17 | animation: blink 1s ease 0s infinite; 18 | } 19 | } 20 | } 21 | &.dark { 22 | svg .c { 23 | @apply text-gray-900; 24 | } 25 | } 26 | 27 | @keyframes rotate-3d { 28 | 0% { 29 | transform: rotate3d(0, 1, 0, 0deg); 30 | } 31 | 50% { 32 | transform: rotate3d(0, 1, 0, 180deg); 33 | } 34 | 100% { 35 | transform: rotate3d(0, 1, 0, 0deg); 36 | } 37 | } 38 | @keyframes blink { 39 | 0% { 40 | opacity: 1; 41 | } 42 | 15% { 43 | opacity: 0.3; 44 | } 45 | 35% { 46 | opacity: 1; 47 | } 48 | 50% { 49 | opacity: 0.3; 50 | } 51 | 85% { 52 | opacity: 1; 53 | } 54 | 95% { 55 | opacity: 0.3; 56 | } 57 | 100% { 58 | opacity: 1; 59 | } 60 | } 61 | } 62 | 63 | // loader 64 | .loader-wrapper { 65 | width: 100%; 66 | height: 100%; 67 | display: flex; 68 | align-items: center; 69 | justify-content: center; 70 | .loader { 71 | animation: rotate 0.75s linear infinite; 72 | svg { 73 | circle { 74 | @apply text-blue-700; 75 | stroke: currentColor; 76 | } 77 | } 78 | } 79 | &.light { 80 | .loader svg circle { 81 | @apply text-blue-300; 82 | stroke: currentColor; 83 | } 84 | } 85 | } 86 | 87 | @keyframes rotate { 88 | from { 89 | transform: rotate(0deg); 90 | } 91 | 92 | to { 93 | transform: rotate(360deg); 94 | } 95 | } 96 | 97 | // scrollbar 98 | .custom-scrollbar::-webkit-scrollbar { 99 | width: 10px; 100 | height: 10px; 101 | @apply bg-blue-50 rounded-full; 102 | } 103 | .custom-scrollbar::-webkit-scrollbar-thumb { 104 | width: 10px; 105 | @apply bg-blue-600 rounded-full; 106 | 107 | &:hover { 108 | @apply bg-blue-700; 109 | } 110 | } 111 | 112 | .custom-scrollbar::-webkit-scrollbar-resizer { 113 | display: none; 114 | } 115 | .custom-scrollbar::-webkit-scrollbar-button { 116 | height: 0px; 117 | } 118 | 119 | ::selection { 120 | @apply bg-blue-200; /* WebKit/Blink Browsers */ 121 | } 122 | 123 | .no-scrollbar { 124 | scrollbar-width: none; /* Firefox */ 125 | &::-webkit-scrollbar { 126 | display: none; 127 | } 128 | } 129 | 130 | // Twemoji 131 | img.emoji { 132 | display: inline-block; 133 | height: 1em; 134 | width: 1em; 135 | margin: 0 0.05em 0 0.1em; 136 | vertical-align: -0.1em; 137 | } 138 | 139 | .perspective { 140 | transform: 141 | rotateX(51deg) 142 | rotateZ(43deg); 143 | transform-style: preserve-3d; 144 | border-radius: 32px; 145 | box-shadow: 146 | 1px 1px 0 1px #f9f9fb, 147 | -1px 0 28px 0 rgba(34, 33, 81, 0.01), 148 | 28px 28px 28px 0 rgba(34, 33, 81, 0.25); 149 | transition: 150 | .4s ease-in-out transform, 151 | .4s ease-in-out box-shadow; 152 | 153 | &:hover { 154 | transform: 155 | translate3d(0px, -16px, 0px) 156 | rotateX(51deg) 157 | rotateZ(43deg); 158 | box-shadow: 159 | 1px 1px 0 1px #f9f9fb, 160 | -1px 0 28px 0 rgba(34, 33, 81, 0.01), 161 | 54px 54px 28px -10px rgba(34, 33, 81, 0.15); 162 | } 163 | } 164 | -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 22 | 23 | /* 24 | |-------------------------------------------------------------------------- 25 | | Cache Stores 26 | |-------------------------------------------------------------------------- 27 | | 28 | | Here you may define all of the cache "stores" for your application as 29 | | well as their drivers. You may even define multiple stores for the 30 | | same cache driver to group types of items stored in your caches. 31 | | 32 | */ 33 | 34 | 'stores' => [ 35 | 36 | 'apc' => [ 37 | 'driver' => 'apc', 38 | ], 39 | 40 | 'array' => [ 41 | 'driver' => 'array', 42 | 'serialize' => false, 43 | ], 44 | 45 | 'database' => [ 46 | 'driver' => 'database', 47 | 'table' => 'cache', 48 | 'connection' => null, 49 | ], 50 | 51 | 'file' => [ 52 | 'driver' => 'file', 53 | 'path' => storage_path('framework/cache/data'), 54 | ], 55 | 56 | 'memcached' => [ 57 | 'driver' => 'memcached', 58 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 59 | 'sasl' => [ 60 | env('MEMCACHED_USERNAME'), 61 | env('MEMCACHED_PASSWORD'), 62 | ], 63 | 'options' => [ 64 | // Memcached::OPT_CONNECT_TIMEOUT => 2000, 65 | ], 66 | 'servers' => [ 67 | [ 68 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 69 | 'port' => env('MEMCACHED_PORT', 11211), 70 | 'weight' => 100, 71 | ], 72 | ], 73 | ], 74 | 75 | 'redis' => [ 76 | 'driver' => 'redis', 77 | 'connection' => 'cache', 78 | ], 79 | 80 | 'dynamodb' => [ 81 | 'driver' => 'dynamodb', 82 | 'key' => env('AWS_ACCESS_KEY_ID'), 83 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 84 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 85 | 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), 86 | 'endpoint' => env('DYNAMODB_ENDPOINT'), 87 | ], 88 | 89 | ], 90 | 91 | /* 92 | |-------------------------------------------------------------------------- 93 | | Cache Key Prefix 94 | |-------------------------------------------------------------------------- 95 | | 96 | | When utilizing a RAM based store such as APC or Memcached, there might 97 | | be other applications utilizing the same cache. So, we'll specify a 98 | | value to get prefixed to all our keys so we can avoid collisions. 99 | | 100 | */ 101 | 102 | 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'), 103 | 104 | ]; 105 | -------------------------------------------------------------------------------- /resources/js/components/ui/Logo.vue: -------------------------------------------------------------------------------- 1 | 28 | -------------------------------------------------------------------------------- /config/mail.php: -------------------------------------------------------------------------------- 1 | env('MAIL_MAILER', 'smtp'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Mailer Configurations 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure all of the mailers used by your application plus 24 | | their respective settings. Several examples have been configured for 25 | | you and you are free to add your own as your application requires. 26 | | 27 | | Laravel supports a variety of mail "transport" drivers to be used while 28 | | sending an e-mail. You will specify which one you are using for your 29 | | mailers below. You are free to add additional mailers as required. 30 | | 31 | | Supported: "smtp", "sendmail", "mailgun", "ses", 32 | | "postmark", "log", "array" 33 | | 34 | */ 35 | 36 | 'mailers' => [ 37 | 'smtp' => [ 38 | 'transport' => 'smtp', 39 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 40 | 'port' => env('MAIL_PORT', 587), 41 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 42 | 'username' => env('MAIL_USERNAME'), 43 | 'password' => env('MAIL_PASSWORD'), 44 | 'timeout' => null, 45 | 'auth_mode' => null, 46 | ], 47 | 48 | 'ses' => [ 49 | 'transport' => 'ses', 50 | ], 51 | 52 | 'mailgun' => [ 53 | 'transport' => 'mailgun', 54 | ], 55 | 56 | 'postmark' => [ 57 | 'transport' => 'postmark', 58 | ], 59 | 60 | 'sendmail' => [ 61 | 'transport' => 'sendmail', 62 | 'path' => env('MAIL_SENDMAIL', '/usr/sbin/sendmail -bs'), 63 | ], 64 | 65 | 'log' => [ 66 | 'transport' => 'log', 67 | 'channel' => env('MAIL_LOG_CHANNEL'), 68 | ], 69 | 70 | 'array' => [ 71 | 'transport' => 'array', 72 | ], 73 | ], 74 | 75 | /* 76 | |-------------------------------------------------------------------------- 77 | | Global "From" Address 78 | |-------------------------------------------------------------------------- 79 | | 80 | | You may wish for all e-mails sent by your application to be sent from 81 | | the same address. Here, you may specify a name and address that is 82 | | used globally for all e-mails that are sent by your application. 83 | | 84 | */ 85 | 86 | 'from' => [ 87 | 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 88 | 'name' => env('MAIL_FROM_NAME', 'Example'), 89 | ], 90 | 91 | /* 92 | |-------------------------------------------------------------------------- 93 | | Markdown Mail Settings 94 | |-------------------------------------------------------------------------- 95 | | 96 | | If you are using Markdown based email rendering, you may configure your 97 | | theme and component paths here, allowing you to customize the design 98 | | of the emails. Or, you may simply stick with the Laravel defaults! 99 | | 100 | */ 101 | 102 | 'markdown' => [ 103 | 'theme' => 'default', 104 | 105 | 'paths' => [ 106 | resource_path('views/vendor/mail'), 107 | ], 108 | ], 109 | 110 | ]; 111 | -------------------------------------------------------------------------------- /resources/js/Pages/Users/Show.vue: -------------------------------------------------------------------------------- 1 | 62 | 63 | 102 | -------------------------------------------------------------------------------- /config/auth.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'guard' => 'web', 18 | 'passwords' => 'users', 19 | ], 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Authentication Guards 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Next, you may define every authentication guard for your application. 27 | | Of course, a great default configuration has been defined for you 28 | | here which uses session storage and the Eloquent user provider. 29 | | 30 | | All authentication drivers have a user provider. This defines how the 31 | | users are actually retrieved out of your database or other storage 32 | | mechanisms used by this application to persist your user's data. 33 | | 34 | | Supported: "session", "token" 35 | | 36 | */ 37 | 38 | 'guards' => [ 39 | 'web' => [ 40 | 'driver' => 'session', 41 | 'provider' => 'users', 42 | ], 43 | 44 | 'api' => [ 45 | 'driver' => 'token', 46 | 'provider' => 'users', 47 | 'hash' => false, 48 | ], 49 | ], 50 | 51 | /* 52 | |-------------------------------------------------------------------------- 53 | | User Providers 54 | |-------------------------------------------------------------------------- 55 | | 56 | | All authentication drivers have a user provider. This defines how the 57 | | users are actually retrieved out of your database or other storage 58 | | mechanisms used by this application to persist your user's data. 59 | | 60 | | If you have multiple user tables or models you may configure multiple 61 | | sources which represent each model / table. These sources may then 62 | | be assigned to any extra authentication guards you have defined. 63 | | 64 | | Supported: "database", "eloquent" 65 | | 66 | */ 67 | 68 | 'providers' => [ 69 | 'users' => [ 70 | 'driver' => 'eloquent', 71 | 'model' => App\User::class, 72 | ], 73 | 74 | // 'users' => [ 75 | // 'driver' => 'database', 76 | // 'table' => 'users', 77 | // ], 78 | ], 79 | 80 | /* 81 | |-------------------------------------------------------------------------- 82 | | Resetting Passwords 83 | |-------------------------------------------------------------------------- 84 | | 85 | | You may specify multiple password reset configurations if you have more 86 | | than one user table or model in the application and you want to have 87 | | separate password reset settings based on the specific user types. 88 | | 89 | | The expire time is the number of minutes that the reset token should be 90 | | considered valid. This security feature keeps tokens short-lived so 91 | | they have less time to be guessed. You may change this as needed. 92 | | 93 | */ 94 | 95 | 'passwords' => [ 96 | 'users' => [ 97 | 'provider' => 'users', 98 | 'table' => 'password_resets', 99 | 'expire' => 60, 100 | 'throttle' => 60, 101 | ], 102 | ], 103 | 104 | /* 105 | |-------------------------------------------------------------------------- 106 | | Password Confirmation Timeout 107 | |-------------------------------------------------------------------------- 108 | | 109 | | Here you may define the amount of seconds before a password confirmation 110 | | times out and the user is prompted to re-enter their password via the 111 | | confirmation screen. By default, the timeout lasts for three hours. 112 | | 113 | */ 114 | 115 | 'password_timeout' => 10800, 116 | 117 | ]; 118 | -------------------------------------------------------------------------------- /resources/js/Layouts/App.vue: -------------------------------------------------------------------------------- 1 | 83 | 84 | 96 | -------------------------------------------------------------------------------- /resources/js/components/Toolbar.vue: -------------------------------------------------------------------------------- 1 | 65 | 66 | 119 | -------------------------------------------------------------------------------- /app/Http/Controllers/UserController.php: -------------------------------------------------------------------------------- 1 | authorize('viewAny', User::class); 17 | 18 | return Inertia::render('Users/Index', [ 19 | 'users' => User::all(), 20 | ]); 21 | } 22 | 23 | public function create() { 24 | $this->authorize('create', User::class); 25 | return Inertia::render('Users/Create'); 26 | } 27 | 28 | public function store() { 29 | $this->authorize('create', User::class); 30 | Request::validate([ 31 | 'name' => ['required', 'max:50'], 32 | 'email' => ['required', 'max:50', 'email', Rule::unique('users')], 33 | 'password' => ['nullable'], 34 | 'photo' => ['nullable', 'image'], 35 | ]); 36 | 37 | User::create([ 38 | 'name' => Request::get('name'), 39 | 'email' => Request::get('email'), 40 | 'password' => Request::get('password'), 41 | 'photo_path' => Request::file('photo') ? Request::file('photo')->store('users') : null, 42 | ]); 43 | 44 | return Redirect::route('users')->with('success', 'User created.'); 45 | } 46 | 47 | public function show(User $user) { 48 | $posts = $user->posts() 49 | ->when(optional(auth()->user())->is($user), function ($query) { 50 | return $query->withTrashed(); 51 | }) 52 | ->with([ 53 | 'loveReactant.reactionCounters', 54 | 'comments.replies.user', 55 | 'comments.user', 56 | ]) 57 | ->latest() 58 | ->paginate(10); 59 | // manually set the user relation to each post (as no need to refetch from the DB - optimization) 60 | collect($posts->items())->map->setRelation('user', $user); 61 | return Inertia::data('Users/Show', [ 62 | 'user' => $user, 63 | 'posts' => $posts, 64 | 'comments' => $user->comments() 65 | ->with('parent.user')->get() 66 | ->each(fn ($c) => !$c->parent ? $c->setRelation('parent', $c->post) : ''), // if it doesn't have a parent comment - set the post as the parent 67 | 'reactionTypes' => ReactionType::select('id', 'name')->get()->keyBy('id'), 68 | 'counts' => [ 69 | 'posts' => $posts->total(), 70 | 'comments' => $user->comments->count() 71 | ], 72 | ]); 73 | } 74 | 75 | public function edit(User $user) { 76 | $this->authorize('update', $user); 77 | return Inertia::render('Users/Edit', [ 78 | 'user' => [ 79 | 'id' => $user->id, 80 | 'name' => $user->name, 81 | 'email' => $user->email, 82 | 'photo' => $user->photoUrl(['w' => 60, 'h' => 60, 'fit' => 'crop']), 83 | 'is_approved' => $user->is_approved, 84 | 'is_admin' => $user->is_admin, 85 | ], 86 | ]); 87 | } 88 | 89 | public function update(User $user) { 90 | $this->authorize('update', $user); 91 | Request::validate([ 92 | 'name' => ['required', 'max:255'], 93 | 'email' => ['required', 'max:255', 'email', Rule::unique('users')->ignore($user->id)], 94 | 'password' => ['nullable', 'confirmed', 'string', 'min:8'], 95 | 'avatar' => ['nullable'], 96 | ]); 97 | 98 | $user->update(Request::only('name', 'email')); 99 | 100 | if (Request::get('avatar')) { 101 | $user->update(['photo_path' => request('avatar')]); 102 | } 103 | 104 | if (Request::get('password')) { 105 | $user->update(['password' => Request::get('password')]); 106 | } 107 | 108 | return Redirect::back()->with('success', 'User updated.'); 109 | } 110 | 111 | public function approve(User $user) { 112 | $this->authorize('approve', User::class); 113 | $user->update([ 114 | 'is_approved' => true, 115 | ]); 116 | return Redirect::back()->with('success', 'User has been approved.'); 117 | } 118 | 119 | public function unapprove(User $user) { 120 | $this->authorize('approve', User::class); 121 | $user->update([ 122 | 'is_approved' => false, 123 | ]); 124 | return Redirect::back()->with('success', 'User has been denied access.'); 125 | } 126 | 127 | public function destroy(User $user) { 128 | $this->authorize('delete', $user); 129 | $user->delete(); 130 | 131 | return Redirect::back()->with('success', 'User deleted.'); 132 | } 133 | 134 | public function restore(User $user) { 135 | 136 | $this->authorize('restore', $user); 137 | $user->restore(); 138 | 139 | return Redirect::back()->with('success', 'User restored.'); 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | Build Status 5 | Total Downloads 6 | Latest Stable Version 7 | License 8 |

9 | 10 | ## About Laravel 11 | 12 | Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as: 13 | 14 | - [Simple, fast routing engine](https://laravel.com/docs/routing). 15 | - [Powerful dependency injection container](https://laravel.com/docs/container). 16 | - Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage. 17 | - Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent). 18 | - Database agnostic [schema migrations](https://laravel.com/docs/migrations). 19 | - [Robust background job processing](https://laravel.com/docs/queues). 20 | - [Real-time event broadcasting](https://laravel.com/docs/broadcasting). 21 | 22 | Laravel is accessible, powerful, and provides tools required for large, robust applications. 23 | 24 | ## Learning Laravel 25 | 26 | Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework. 27 | 28 | If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library. 29 | 30 | ## Laravel Sponsors 31 | 32 | We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell). 33 | 34 | ### Premium Partners 35 | 36 | - **[Vehikl](https://vehikl.com/)** 37 | - **[Tighten Co.](https://tighten.co)** 38 | - **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)** 39 | - **[64 Robots](https://64robots.com)** 40 | - **[Cubet Techno Labs](https://cubettech.com)** 41 | - **[Cyber-Duck](https://cyber-duck.co.uk)** 42 | - **[Many](https://www.many.co.uk)** 43 | - **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)** 44 | - **[DevSquad](https://devsquad.com)** 45 | 46 | ### Community Sponsors 47 | 48 | 49 | 50 | - [UserInsights](https://userinsights.com) 51 | - [Fragrantica](https://www.fragrantica.com) 52 | - [SOFTonSOFA](https://softonsofa.com/) 53 | - [User10](https://user10.com) 54 | - [Soumettre.fr](https://soumettre.fr/) 55 | - [CodeBrisk](https://codebrisk.com) 56 | - [1Forge](https://1forge.com) 57 | - [TECPRESSO](https://tecpresso.co.jp/) 58 | - [Runtime Converter](http://runtimeconverter.com/) 59 | - [WebL'Agence](https://weblagence.com/) 60 | - [Invoice Ninja](https://www.invoiceninja.com) 61 | - [iMi digital](https://www.imi-digital.de/) 62 | - [Earthlink](https://www.earthlink.ro/) 63 | - [Steadfast Collective](https://steadfastcollective.com/) 64 | - [We Are The Robots Inc.](https://watr.mx/) 65 | - [Understand.io](https://www.understand.io/) 66 | - [Abdel Elrafa](https://abdelelrafa.com) 67 | - [Hyper Host](https://hyper.host) 68 | - [Appoly](https://www.appoly.co.uk) 69 | - [云软科技](http://www.yunruan.ltd/) 70 | 71 | ## Contributing 72 | 73 | Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions). 74 | 75 | ## Code of Conduct 76 | 77 | In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct). 78 | 79 | ## Security Vulnerabilities 80 | 81 | If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed. 82 | 83 | ## License 84 | 85 | The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). 86 | -------------------------------------------------------------------------------- /resources/js/components/WritePost.vue: -------------------------------------------------------------------------------- 1 | 70 | 71 | 136 | -------------------------------------------------------------------------------- /resources/js/components/ui/Modal.vue: -------------------------------------------------------------------------------- 1 | 67 | 68 | 118 | -------------------------------------------------------------------------------- /config/database.php: -------------------------------------------------------------------------------- 1 | env('DB_CONNECTION', 'mysql'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Database Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here are each of the database connections setup for your application. 26 | | Of course, examples of configuring each database platform that is 27 | | supported by Laravel is shown below to make development simple. 28 | | 29 | | 30 | | All database work in Laravel is done through the PHP PDO facilities 31 | | so make sure you have the driver for your particular database of 32 | | choice installed on your machine before you begin development. 33 | | 34 | */ 35 | 36 | 'connections' => [ 37 | 38 | 'sqlite' => [ 39 | 'driver' => 'sqlite', 40 | 'url' => env('DATABASE_URL'), 41 | 'database' => env('DB_DATABASE', database_path('database.sqlite')), 42 | 'prefix' => '', 43 | 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), 44 | ], 45 | 46 | 'mysql' => [ 47 | 'driver' => 'mysql', 48 | 'url' => env('DATABASE_URL'), 49 | 'host' => env('DB_HOST', '127.0.0.1'), 50 | 'port' => env('DB_PORT', '3306'), 51 | 'database' => env('DB_DATABASE', 'forge'), 52 | 'username' => env('DB_USERNAME', 'forge'), 53 | 'password' => env('DB_PASSWORD', ''), 54 | 'unix_socket' => env('DB_SOCKET', ''), 55 | 'charset' => 'utf8mb4', 56 | 'collation' => 'utf8mb4_unicode_ci', 57 | 'prefix' => '', 58 | 'prefix_indexes' => true, 59 | 'strict' => true, 60 | 'engine' => null, 61 | ], 62 | 63 | 'pgsql' => [ 64 | 'driver' => 'pgsql', 65 | 'url' => env('DATABASE_URL'), 66 | 'host' => env('DB_HOST', '127.0.0.1'), 67 | 'port' => env('DB_PORT', '5432'), 68 | 'database' => env('DB_DATABASE', 'forge'), 69 | 'username' => env('DB_USERNAME', 'forge'), 70 | 'password' => env('DB_PASSWORD', ''), 71 | 'charset' => 'utf8', 72 | 'prefix' => '', 73 | 'prefix_indexes' => true, 74 | 'schema' => 'public', 75 | 'sslmode' => 'prefer', 76 | ], 77 | 78 | 'sqlsrv' => [ 79 | 'driver' => 'sqlsrv', 80 | 'url' => env('DATABASE_URL'), 81 | 'host' => env('DB_HOST', 'localhost'), 82 | 'port' => env('DB_PORT', '1433'), 83 | 'database' => env('DB_DATABASE', 'forge'), 84 | 'username' => env('DB_USERNAME', 'forge'), 85 | 'password' => env('DB_PASSWORD', ''), 86 | 'charset' => 'utf8', 87 | 'prefix' => '', 88 | 'prefix_indexes' => true, 89 | ], 90 | 91 | ], 92 | 93 | /* 94 | |-------------------------------------------------------------------------- 95 | | Migration Repository Table 96 | |-------------------------------------------------------------------------- 97 | | 98 | | This table keeps track of all the migrations that have already run for 99 | | your application. Using this information, we can determine which of 100 | | the migrations on disk haven't actually been run in the database. 101 | | 102 | */ 103 | 104 | 'migrations' => 'migrations', 105 | 106 | /* 107 | |-------------------------------------------------------------------------- 108 | | Redis Databases 109 | |-------------------------------------------------------------------------- 110 | | 111 | | Redis is an open source, fast, and advanced key-value store that also 112 | | provides a richer body of commands than a typical key-value system 113 | | such as APC or Memcached. Laravel makes it easy to dig right in. 114 | | 115 | */ 116 | 117 | 'redis' => [ 118 | 119 | 'client' => env('REDIS_CLIENT', 'phpredis'), 120 | 121 | 'options' => [ 122 | 'cluster' => env('REDIS_CLUSTER', 'redis'), 123 | 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'), 124 | ], 125 | 126 | 'default' => [ 127 | 'url' => env('REDIS_URL'), 128 | 'host' => env('REDIS_HOST', '127.0.0.1'), 129 | 'password' => env('REDIS_PASSWORD', null), 130 | 'port' => env('REDIS_PORT', '6379'), 131 | 'database' => env('REDIS_DB', '0'), 132 | ], 133 | 134 | 'cache' => [ 135 | 'url' => env('REDIS_URL'), 136 | 'host' => env('REDIS_HOST', '127.0.0.1'), 137 | 'password' => env('REDIS_PASSWORD', null), 138 | 'port' => env('REDIS_PORT', '6379'), 139 | 'database' => env('REDIS_CACHE_DB', '1'), 140 | ], 141 | 142 | ], 143 | 144 | ]; 145 | --------------------------------------------------------------------------------