├── .editorconfig ├── .env.example ├── .gitattributes ├── .gitignore ├── .styleci.yml ├── README.md ├── app ├── Actions │ ├── Fortify │ │ ├── CreateNewUser.php │ │ ├── PasswordValidationRules.php │ │ ├── ResetUserPassword.php │ │ ├── UpdateUserPassword.php │ │ └── UpdateUserProfileInformation.php │ └── Jetstream │ │ ├── AddTeamMember.php │ │ ├── CreateTeam.php │ │ ├── DeleteTeam.php │ │ ├── DeleteUser.php │ │ ├── InviteTeamMember.php │ │ ├── RemoveTeamMember.php │ │ └── UpdateTeamName.php ├── Console │ ├── Commands │ │ └── CrudLivewireCommand.php │ └── Kernel.php ├── Exceptions │ └── Handler.php ├── Http │ ├── Controllers │ │ └── Controller.php │ ├── Kernel.php │ ├── Livewire │ │ ├── FrontPage.php │ │ ├── NavigationMenus.php │ │ ├── Pages.php │ │ ├── UserPermissions.php │ │ └── Users.php │ └── Middleware │ │ ├── Authenticate.php │ │ ├── EncryptCookies.php │ │ ├── EnsureRoleIsAllowedAccess.php │ │ ├── PreventRequestsDuringMaintenance.php │ │ ├── RedirectIfAuthenticated.php │ │ ├── TrimStrings.php │ │ ├── TrustHosts.php │ │ ├── TrustProxies.php │ │ └── VerifyCsrfToken.php ├── Models │ ├── Membership.php │ ├── NavigationMenu.php │ ├── Page.php │ ├── Team.php │ ├── TeamInvitation.php │ ├── User.php │ └── UserPermission.php ├── Policies │ └── TeamPolicy.php ├── Providers │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── BroadcastServiceProvider.php │ ├── EventServiceProvider.php │ ├── FortifyServiceProvider.php │ ├── JetstreamServiceProvider.php │ └── RouteServiceProvider.php └── View │ └── Components │ ├── AppLayout.php │ ├── Frontend.php │ └── GuestLayout.php ├── artisan ├── bootstrap ├── app.php └── cache │ └── .gitignore ├── composer.json ├── composer.lock ├── config ├── app.php ├── auth.php ├── broadcasting.php ├── cache.php ├── cors.php ├── database.php ├── filesystems.php ├── fortify.php ├── hashing.php ├── jetstream.php ├── laravel-trix.php ├── logging.php ├── mail.php ├── queue.php ├── sanctum.php ├── services.php ├── session.php └── view.php ├── database ├── .gitignore ├── factories │ ├── TeamFactory.php │ └── UserFactory.php ├── migrations │ ├── 2014_10_12_000000_create_users_table.php │ ├── 2014_10_12_100000_create_password_resets_table.php │ ├── 2014_10_12_200000_add_two_factor_columns_to_users_table.php │ ├── 2019_08_19_000000_create_failed_jobs_table.php │ ├── 2019_12_14_000001_create_personal_access_tokens_table.php │ ├── 2020_05_21_100000_create_teams_table.php │ ├── 2020_05_21_200000_create_team_user_table.php │ ├── 2020_05_21_300000_create_team_invitations_table.php │ ├── 2022_03_17_134219_create_sessions_table.php │ ├── 2022_03_17_141900_create_pages_table.php │ ├── 2022_03_17_143255_create_trix_rich_texts_table.php │ ├── 2022_05_27_154414_add_set_default_pages_to_pages_table.php │ ├── 2022_06_01_131715_create_navigation_menus_table.php │ ├── 2022_06_01_180021_add_role_to_users_table.php │ └── 2022_06_02_110432_create_user_permissions_table.php └── seeders │ ├── DatabaseSeeder.php │ ├── NavigationMenuSeeder.php │ ├── PageSeeder.php │ ├── UserPermissionSeeder.php │ └── UserSeeder.php ├── lang ├── en.json └── en │ ├── auth.php │ ├── pagination.php │ ├── passwords.php │ └── validation.php ├── package-lock.json ├── package.json ├── phpunit.xml ├── public ├── .htaccess ├── css │ └── app.css ├── favicon.ico ├── img │ └── logo.svg ├── index.php ├── js │ ├── app.js │ └── notification-socket.js ├── mix-manifest.json └── robots.txt ├── resources ├── css │ └── app.css ├── js │ ├── app.js │ └── bootstrap.js ├── markdown │ ├── policy.md │ └── terms.md └── views │ ├── admin │ ├── navigation-menus.blade.php │ ├── pages.blade.php │ ├── user-permissions.blade.php │ └── users.blade.php │ ├── api │ ├── api-token-manager.blade.php │ └── index.blade.php │ ├── auth │ ├── confirm-password.blade.php │ ├── forgot-password.blade.php │ ├── login.blade.php │ ├── register.blade.php │ ├── reset-password.blade.php │ ├── two-factor-challenge.blade.php │ └── verify-email.blade.php │ ├── dashboard.blade.php │ ├── layouts │ ├── app.blade.php │ ├── guest.blade.php │ └── my-app.blade.php │ ├── livewire │ ├── front-page.blade.php │ ├── navigation-menus.blade.php │ ├── pages.blade.php │ ├── user-permissions.blade.php │ └── users.blade.php │ ├── navigation-menu.blade.php │ ├── policy.blade.php │ ├── profile │ ├── delete-user-form.blade.php │ ├── logout-other-browser-sessions-form.blade.php │ ├── show.blade.php │ ├── two-factor-authentication-form.blade.php │ ├── update-password-form.blade.php │ └── update-profile-information-form.blade.php │ ├── teams │ ├── create-team-form.blade.php │ ├── create.blade.php │ ├── delete-team-form.blade.php │ ├── show.blade.php │ ├── team-member-manager.blade.php │ └── update-team-name-form.blade.php │ ├── terms.blade.php │ ├── vendor │ └── jetstream │ │ ├── components │ │ ├── action-message.blade.php │ │ ├── action-section.blade.php │ │ ├── application-logo.blade.php │ │ ├── application-mark.blade.php │ │ ├── authentication-card-logo.blade.php │ │ ├── authentication-card.blade.php │ │ ├── banner.blade.php │ │ ├── button.blade.php │ │ ├── checkbox.blade.php │ │ ├── confirmation-modal.blade.php │ │ ├── confirms-password.blade.php │ │ ├── danger-button.blade.php │ │ ├── dialog-modal.blade.php │ │ ├── dropdown-link.blade.php │ │ ├── dropdown.blade.php │ │ ├── form-section.blade.php │ │ ├── input-error.blade.php │ │ ├── input.blade.php │ │ ├── label.blade.php │ │ ├── modal.blade.php │ │ ├── nav-link.blade.php │ │ ├── responsive-nav-link.blade.php │ │ ├── secondary-button.blade.php │ │ ├── section-border.blade.php │ │ ├── section-title.blade.php │ │ ├── switchable-team.blade.php │ │ ├── validation-errors.blade.php │ │ └── welcome.blade.php │ │ └── mail │ │ └── team-invitation.blade.php │ └── welcome.blade.php ├── routes ├── api.php ├── channels.php ├── console.php └── web.php ├── storage ├── app │ ├── .gitignore │ └── public │ │ └── .gitignore ├── debugbar │ └── .gitignore ├── framework │ ├── .gitignore │ ├── cache │ │ ├── .gitignore │ │ └── data │ │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ ├── testing │ │ └── .gitignore │ └── views │ │ └── .gitignore └── logs │ └── .gitignore ├── stubs ├── livewire.crud.stub └── livewire.view.crud.stub ├── tailwind.config.js ├── tests ├── CreatesApplication.php ├── Feature │ ├── ApiTokenPermissionsTest.php │ ├── AuthenticationTest.php │ ├── BrowserSessionsTest.php │ ├── CreateApiTokenTest.php │ ├── CreateTeamTest.php │ ├── DeleteAccountTest.php │ ├── DeleteApiTokenTest.php │ ├── DeleteTeamTest.php │ ├── EmailVerificationTest.php │ ├── ExampleTest.php │ ├── InviteTeamMemberTest.php │ ├── LeaveTeamTest.php │ ├── PasswordConfirmationTest.php │ ├── PasswordResetTest.php │ ├── ProfileInformationTest.php │ ├── RegistrationTest.php │ ├── RemoveTeamMemberTest.php │ ├── TwoFactorAuthenticationSettingsTest.php │ ├── UpdatePasswordTest.php │ ├── UpdateTeamMemberRoleTest.php │ └── UpdateTeamNameTest.php ├── TestCase.php └── Unit │ └── ExampleTest.php ├── webpack.mix.js └── websocket ├── .gitignore ├── notificationsServer.js ├── package-lock.json └── package.json /.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 | 17 | [docker-compose.yml] 18 | indent_size = 4 19 | -------------------------------------------------------------------------------- /.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 | LOG_DEPRECATIONS_CHANNEL=null 9 | LOG_LEVEL=debug 10 | 11 | DB_CONNECTION=mysql 12 | DB_HOST=127.0.0.1 13 | DB_PORT=3306 14 | DB_DATABASE=laravel_cms 15 | DB_USERNAME=root 16 | DB_PASSWORD= 17 | 18 | BROADCAST_DRIVER=log 19 | CACHE_DRIVER=file 20 | FILESYSTEM_DISK=local 21 | QUEUE_CONNECTION=sync 22 | SESSION_DRIVER=database 23 | SESSION_LIFETIME=120 24 | 25 | MEMCACHED_HOST=127.0.0.1 26 | 27 | REDIS_HOST=127.0.0.1 28 | REDIS_PASSWORD=null 29 | REDIS_PORT=6379 30 | 31 | MAIL_MAILER=smtp 32 | MAIL_HOST=mailhog 33 | MAIL_PORT=1025 34 | MAIL_USERNAME=null 35 | MAIL_PASSWORD=null 36 | MAIL_ENCRYPTION=null 37 | MAIL_FROM_ADDRESS="hello@example.com" 38 | MAIL_FROM_NAME="${APP_NAME}" 39 | 40 | AWS_ACCESS_KEY_ID= 41 | AWS_SECRET_ACCESS_KEY= 42 | AWS_DEFAULT_REGION=us-east-1 43 | AWS_BUCKET= 44 | AWS_USE_PATH_STYLE_ENDPOINT=false 45 | 46 | PUSHER_APP_ID= 47 | PUSHER_APP_KEY= 48 | PUSHER_APP_SECRET= 49 | PUSHER_APP_CLUSTER=mt1 50 | 51 | MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 52 | MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 53 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | 3 | *.blade.php diff=html 4 | *.css diff=css 5 | *.html diff=html 6 | *.md diff=markdown 7 | *.php diff=php 8 | 9 | /.github export-ignore 10 | CHANGELOG.md export-ignore 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /public/hot 3 | /public/storage 4 | /storage/*.key 5 | /vendor 6 | .env 7 | .env.backup 8 | .phpunit.result.cache 9 | Homestead.json 10 | Homestead.yaml 11 | npm-debug.log 12 | yarn-error.log 13 | /.idea 14 | /.vscode 15 | -------------------------------------------------------------------------------- /.styleci.yml: -------------------------------------------------------------------------------- 1 | php: 2 | preset: laravel 3 | version: 8 4 | disabled: 5 | - no_unused_imports 6 | finder: 7 | not-name: 8 | - index.php 9 | js: 10 | finder: 11 | not-name: 12 | - webpack.mix.js 13 | css: true 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Laravel Simple CMS 2 | 3 | This is a simple content management system (CMS) created using Laravel 9 & Livewire. 4 | 5 | ## Want to test it ? 6 | 7 | Here are the credentials for some users: 8 | 9 | - Email: admin@example.com / Password: 123456789 10 | - Email: bob@esi.dz / Password: 123456789 11 | 12 | ## How to launch the app 13 | 14 | - Start with `composer install` in the root folder & `npm install` in the websocket folder to install dependencies. 15 | - Launch the migrations and the seeders `php artisan migrate --seed`. 16 | - Go to the websocket folder and launch the command `npm start`. 17 | - then finaly launch the command `php artisan serve`. 18 | 19 | ## What you will find 20 | 21 | - Jetstream Auth 22 | - Many CRUDs (Pages CRUD, Users CRUD...) 23 | - Role permissions managment 24 | - Notification push using nodejs & web sockets 25 | - Custom commande to create livewire CRUD components : `php artisan make:livewire:crud [class-name] [model-name]` 26 | -------------------------------------------------------------------------------- /app/Actions/Fortify/CreateNewUser.php: -------------------------------------------------------------------------------- 1 | ['required', 'string', 'max:255'], 27 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 28 | 'password' => $this->passwordRules(), 29 | 'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature() ? ['required', 'accepted'] : '', 30 | ])->validate(); 31 | 32 | return DB::transaction(function () use ($input) { 33 | return tap(User::create([ 34 | 'name' => $input['name'], 35 | 'email' => $input['email'], 36 | 'password' => Hash::make($input['password']), 37 | ]), function (User $user) { 38 | $this->createTeam($user); 39 | }); 40 | }); 41 | } 42 | 43 | /** 44 | * Create a personal team for the user. 45 | * 46 | * @param \App\Models\User $user 47 | * @return void 48 | */ 49 | protected function createTeam(User $user) 50 | { 51 | $user->ownedTeams()->save(Team::forceCreate([ 52 | 'user_id' => $user->id, 53 | 'name' => explode(' ', $user->name, 2)[0]."'s Team", 54 | 'personal_team' => true, 55 | ])); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /app/Actions/Fortify/PasswordValidationRules.php: -------------------------------------------------------------------------------- 1 | $this->passwordRules(), 24 | ])->validate(); 25 | 26 | $user->forceFill([ 27 | 'password' => Hash::make($input['password']), 28 | ])->save(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Actions/Fortify/UpdateUserPassword.php: -------------------------------------------------------------------------------- 1 | ['required', 'string'], 24 | 'password' => $this->passwordRules(), 25 | ])->after(function ($validator) use ($user, $input) { 26 | if (! isset($input['current_password']) || ! Hash::check($input['current_password'], $user->password)) { 27 | $validator->errors()->add('current_password', __('The provided password does not match your current password.')); 28 | } 29 | })->validateWithBag('updatePassword'); 30 | 31 | $user->forceFill([ 32 | 'password' => Hash::make($input['password']), 33 | ])->save(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/Actions/Fortify/UpdateUserProfileInformation.php: -------------------------------------------------------------------------------- 1 | ['required', 'string', 'max:255'], 23 | 'email' => ['required', 'email', 'max:255', Rule::unique('users')->ignore($user->id)], 24 | 'photo' => ['nullable', 'mimes:jpg,jpeg,png', 'max:1024'], 25 | ])->validateWithBag('updateProfileInformation'); 26 | 27 | if (isset($input['photo'])) { 28 | $user->updateProfilePhoto($input['photo']); 29 | } 30 | 31 | if ($input['email'] !== $user->email && 32 | $user instanceof MustVerifyEmail) { 33 | $this->updateVerifiedUser($user, $input); 34 | } else { 35 | $user->forceFill([ 36 | 'name' => $input['name'], 37 | 'email' => $input['email'], 38 | ])->save(); 39 | } 40 | } 41 | 42 | /** 43 | * Update the given verified user's profile information. 44 | * 45 | * @param mixed $user 46 | * @param array $input 47 | * @return void 48 | */ 49 | protected function updateVerifiedUser($user, array $input) 50 | { 51 | $user->forceFill([ 52 | 'name' => $input['name'], 53 | 'email' => $input['email'], 54 | 'email_verified_at' => null, 55 | ])->save(); 56 | 57 | $user->sendEmailVerificationNotification(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/Actions/Jetstream/AddTeamMember.php: -------------------------------------------------------------------------------- 1 | authorize('addTeamMember', $team); 27 | 28 | $this->validate($team, $email, $role); 29 | 30 | $newTeamMember = Jetstream::findUserByEmailOrFail($email); 31 | 32 | AddingTeamMember::dispatch($team, $newTeamMember); 33 | 34 | $team->users()->attach( 35 | $newTeamMember, ['role' => $role] 36 | ); 37 | 38 | TeamMemberAdded::dispatch($team, $newTeamMember); 39 | } 40 | 41 | /** 42 | * Validate the add member operation. 43 | * 44 | * @param mixed $team 45 | * @param string $email 46 | * @param string|null $role 47 | * @return void 48 | */ 49 | protected function validate($team, string $email, ?string $role) 50 | { 51 | Validator::make([ 52 | 'email' => $email, 53 | 'role' => $role, 54 | ], $this->rules(), [ 55 | 'email.exists' => __('We were unable to find a registered user with this email address.'), 56 | ])->after( 57 | $this->ensureUserIsNotAlreadyOnTeam($team, $email) 58 | )->validateWithBag('addTeamMember'); 59 | } 60 | 61 | /** 62 | * Get the validation rules for adding a team member. 63 | * 64 | * @return array 65 | */ 66 | protected function rules() 67 | { 68 | return array_filter([ 69 | 'email' => ['required', 'email', 'exists:users'], 70 | 'role' => Jetstream::hasRoles() 71 | ? ['required', 'string', new Role] 72 | : null, 73 | ]); 74 | } 75 | 76 | /** 77 | * Ensure that the user is not already on the team. 78 | * 79 | * @param mixed $team 80 | * @param string $email 81 | * @return \Closure 82 | */ 83 | protected function ensureUserIsNotAlreadyOnTeam($team, string $email) 84 | { 85 | return function ($validator) use ($team, $email) { 86 | $validator->errors()->addIf( 87 | $team->hasUserWithEmail($email), 88 | 'email', 89 | __('This user already belongs to the team.') 90 | ); 91 | }; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /app/Actions/Jetstream/CreateTeam.php: -------------------------------------------------------------------------------- 1 | authorize('create', Jetstream::newTeamModel()); 23 | 24 | Validator::make($input, [ 25 | 'name' => ['required', 'string', 'max:255'], 26 | ])->validateWithBag('createTeam'); 27 | 28 | AddingTeam::dispatch($user); 29 | 30 | $user->switchTeam($team = $user->ownedTeams()->create([ 31 | 'name' => $input['name'], 32 | 'personal_team' => false, 33 | ])); 34 | 35 | return $team; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/Actions/Jetstream/DeleteTeam.php: -------------------------------------------------------------------------------- 1 | purge(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/Actions/Jetstream/DeleteUser.php: -------------------------------------------------------------------------------- 1 | deletesTeams = $deletesTeams; 27 | } 28 | 29 | /** 30 | * Delete the given user. 31 | * 32 | * @param mixed $user 33 | * @return void 34 | */ 35 | public function delete($user) 36 | { 37 | DB::transaction(function () use ($user) { 38 | $this->deleteTeams($user); 39 | $user->deleteProfilePhoto(); 40 | $user->tokens->each->delete(); 41 | $user->delete(); 42 | }); 43 | } 44 | 45 | /** 46 | * Delete the teams and team associations attached to the user. 47 | * 48 | * @param mixed $user 49 | * @return void 50 | */ 51 | protected function deleteTeams($user) 52 | { 53 | $user->teams()->detach(); 54 | 55 | $user->ownedTeams->each(function ($team) { 56 | $this->deletesTeams->delete($team); 57 | }); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/Actions/Jetstream/InviteTeamMember.php: -------------------------------------------------------------------------------- 1 | authorize('addTeamMember', $team); 29 | 30 | $this->validate($team, $email, $role); 31 | 32 | InvitingTeamMember::dispatch($team, $email, $role); 33 | 34 | $invitation = $team->teamInvitations()->create([ 35 | 'email' => $email, 36 | 'role' => $role, 37 | ]); 38 | 39 | Mail::to($email)->send(new TeamInvitation($invitation)); 40 | } 41 | 42 | /** 43 | * Validate the invite member operation. 44 | * 45 | * @param mixed $team 46 | * @param string $email 47 | * @param string|null $role 48 | * @return void 49 | */ 50 | protected function validate($team, string $email, ?string $role) 51 | { 52 | Validator::make([ 53 | 'email' => $email, 54 | 'role' => $role, 55 | ], $this->rules($team), [ 56 | 'email.unique' => __('This user has already been invited to the team.'), 57 | ])->after( 58 | $this->ensureUserIsNotAlreadyOnTeam($team, $email) 59 | )->validateWithBag('addTeamMember'); 60 | } 61 | 62 | /** 63 | * Get the validation rules for inviting a team member. 64 | * 65 | * @param mixed $team 66 | * @return array 67 | */ 68 | protected function rules($team) 69 | { 70 | return array_filter([ 71 | 'email' => ['required', 'email', Rule::unique('team_invitations')->where(function ($query) use ($team) { 72 | $query->where('team_id', $team->id); 73 | })], 74 | 'role' => Jetstream::hasRoles() 75 | ? ['required', 'string', new Role] 76 | : null, 77 | ]); 78 | } 79 | 80 | /** 81 | * Ensure that the user is not already on the team. 82 | * 83 | * @param mixed $team 84 | * @param string $email 85 | * @return \Closure 86 | */ 87 | protected function ensureUserIsNotAlreadyOnTeam($team, string $email) 88 | { 89 | return function ($validator) use ($team, $email) { 90 | $validator->errors()->addIf( 91 | $team->hasUserWithEmail($email), 92 | 'email', 93 | __('This user already belongs to the team.') 94 | ); 95 | }; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /app/Actions/Jetstream/RemoveTeamMember.php: -------------------------------------------------------------------------------- 1 | authorize($user, $team, $teamMember); 24 | 25 | $this->ensureUserDoesNotOwnTeam($teamMember, $team); 26 | 27 | $team->removeUser($teamMember); 28 | 29 | TeamMemberRemoved::dispatch($team, $teamMember); 30 | } 31 | 32 | /** 33 | * Authorize that the user can remove the team member. 34 | * 35 | * @param mixed $user 36 | * @param mixed $team 37 | * @param mixed $teamMember 38 | * @return void 39 | */ 40 | protected function authorize($user, $team, $teamMember) 41 | { 42 | if (! Gate::forUser($user)->check('removeTeamMember', $team) && 43 | $user->id !== $teamMember->id) { 44 | throw new AuthorizationException; 45 | } 46 | } 47 | 48 | /** 49 | * Ensure that the currently authenticated user does not own the team. 50 | * 51 | * @param mixed $teamMember 52 | * @param mixed $team 53 | * @return void 54 | */ 55 | protected function ensureUserDoesNotOwnTeam($teamMember, $team) 56 | { 57 | if ($teamMember->id === $team->owner->id) { 58 | throw ValidationException::withMessages([ 59 | 'team' => [__('You may not leave a team that you created.')], 60 | ])->errorBag('removeTeamMember'); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /app/Actions/Jetstream/UpdateTeamName.php: -------------------------------------------------------------------------------- 1 | authorize('update', $team); 22 | 23 | Validator::make($input, [ 24 | 'name' => ['required', 'string', 'max:255'], 25 | ])->validateWithBag('updateTeamName'); 26 | 27 | $team->forceFill([ 28 | 'name' => $input['name'], 29 | ])->save(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire')->hourly(); 19 | } 20 | 21 | /** 22 | * Register the commands for the application. 23 | * 24 | * @return void 25 | */ 26 | protected function commands() 27 | { 28 | $this->load(__DIR__.'/Commands'); 29 | 30 | require base_path('routes/console.php'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | > 14 | */ 15 | protected $dontReport = [ 16 | // 17 | ]; 18 | 19 | /** 20 | * A list of the inputs that are never flashed for validation exceptions. 21 | * 22 | * @var array 23 | */ 24 | protected $dontFlash = [ 25 | 'current_password', 26 | 'password', 27 | 'password_confirmation', 28 | ]; 29 | 30 | /** 31 | * Register the exception handling callbacks for the application. 32 | * 33 | * @return void 34 | */ 35 | public function register() 36 | { 37 | $this->reportable(function (Throwable $e) { 38 | // 39 | }); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | 15 | */ 16 | protected $middleware = [ 17 | // \App\Http\Middleware\TrustHosts::class, 18 | \App\Http\Middleware\TrustProxies::class, 19 | \Illuminate\Http\Middleware\HandleCors::class, 20 | \App\Http\Middleware\PreventRequestsDuringMaintenance::class, 21 | \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, 22 | \App\Http\Middleware\TrimStrings::class, 23 | \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, 24 | ]; 25 | 26 | /** 27 | * The application's route middleware groups. 28 | * 29 | * @var array> 30 | */ 31 | protected $middlewareGroups = [ 32 | 'web' => [ 33 | \App\Http\Middleware\EncryptCookies::class, 34 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 35 | \Illuminate\Session\Middleware\StartSession::class, 36 | \Laravel\Jetstream\Http\Middleware\AuthenticateSession::class, 37 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 38 | \App\Http\Middleware\VerifyCsrfToken::class, 39 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 40 | ], 41 | 42 | 'api' => [ 43 | // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, 44 | 'throttle:api', 45 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 46 | ], 47 | ]; 48 | 49 | /** 50 | * The application's route middleware. 51 | * 52 | * These middleware may be assigned to groups or used individually. 53 | * 54 | * @var array 55 | */ 56 | protected $routeMiddleware = [ 57 | 'auth' => \App\Http\Middleware\Authenticate::class, 58 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 59 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 60 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 61 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 62 | 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, 63 | 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, 64 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 65 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 66 | 'roleaccess' => \App\Http\Middleware\EnsureRoleIsAllowedAccess::class 67 | ]; 68 | } 69 | -------------------------------------------------------------------------------- /app/Http/Livewire/FrontPage.php: -------------------------------------------------------------------------------- 1 | getContent($urlslug); 24 | } 25 | 26 | /** 27 | * get the sidebar links 28 | * 29 | * @return void 30 | */ 31 | private function getSidebarLinks() 32 | { 33 | return NavigationMenu::where('type', 'Sidebar')->orderBy('sequence', 'asc')->get(); 34 | } 35 | 36 | /** 37 | * get the top bar links 38 | * 39 | * @return void 40 | */ 41 | private function getTopLinks() 42 | { 43 | if (Auth::check()) 44 | return NavigationMenu::where('type', 'Top')->where('slug', '!=', 'login')->orderBy('sequence', 'asc')->get(); 45 | return NavigationMenu::where('type', 'Top')->orderBy('sequence', 'asc')->get(); 46 | } 47 | 48 | /** 49 | * get page content using the url slug 50 | * 51 | * @param mixed $urlslug 52 | * @return void 53 | */ 54 | public function getContent($urlslug) 55 | { 56 | $page = empty($urlslug) 57 | ? Page::defaultHome()->first() 58 | : Page::where('slug', $urlslug)->first(); 59 | if (!$page) { 60 | $page = Page::default404()->firstOrFail(); 61 | } 62 | $this->title = $page->title; 63 | $this->content = $page->content; 64 | } 65 | 66 | public function render() 67 | { 68 | return view('livewire.front-page', [ 69 | 'sidebarLinks' => $this->getSidebarLinks(), 70 | 'topLinks' => $this->getTopLinks() 71 | ])->layout('layouts.my-app'); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | expectsJson()) { 18 | return route('login'); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/EnsureRoleIsAllowedAccess.php: -------------------------------------------------------------------------------- 1 | user()->role; 22 | $currentRouteName = Route::currentRouteName(); 23 | 24 | if (UserPermission::where([ 25 | 'role' => $role, 26 | 'route_name' => $currentRouteName 27 | ])->count()) { 28 | return $next($request); 29 | } 30 | 31 | abort(403, 'You are not allowed to access this page.'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/Http/Middleware/PreventRequestsDuringMaintenance.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/RedirectIfAuthenticated.php: -------------------------------------------------------------------------------- 1 | check()) { 26 | return redirect(RouteServiceProvider::HOME); 27 | } 28 | } 29 | 30 | return $next($request); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrimStrings.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | 'current_password', 16 | 'password', 17 | 'password_confirmation', 18 | ]; 19 | } 20 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustHosts.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | public function hosts() 15 | { 16 | return [ 17 | $this->allSubdomainsOfApplicationUrl(), 18 | ]; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustProxies.php: -------------------------------------------------------------------------------- 1 | |string|null 14 | */ 15 | protected $proxies; 16 | 17 | /** 18 | * The headers that should be used to detect proxies. 19 | * 20 | * @var int 21 | */ 22 | protected $headers = 23 | Request::HEADER_X_FORWARDED_FOR | 24 | Request::HEADER_X_FORWARDED_HOST | 25 | Request::HEADER_X_FORWARDED_PORT | 26 | Request::HEADER_X_FORWARDED_PROTO | 27 | Request::HEADER_X_FORWARDED_AWS_ELB; 28 | } 29 | -------------------------------------------------------------------------------- /app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Models/Membership.php: -------------------------------------------------------------------------------- 1 | 'boolean', 22 | ]; 23 | 24 | /** 25 | * The attributes that are mass assignable. 26 | * 27 | * @var string[] 28 | */ 29 | protected $fillable = [ 30 | 'name', 31 | 'personal_team', 32 | ]; 33 | 34 | /** 35 | * The event map for the model. 36 | * 37 | * @var array 38 | */ 39 | protected $dispatchesEvents = [ 40 | 'created' => TeamCreated::class, 41 | 'updated' => TeamUpdated::class, 42 | 'deleted' => TeamDeleted::class, 43 | ]; 44 | } 45 | -------------------------------------------------------------------------------- /app/Models/TeamInvitation.php: -------------------------------------------------------------------------------- 1 | belongsTo(Jetstream::teamModel()); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/Models/User.php: -------------------------------------------------------------------------------- 1 | 'datetime', 51 | ]; 52 | 53 | /** 54 | * The accessors to append to the model's array form. 55 | * 56 | * @var array 57 | */ 58 | protected $appends = [ 59 | 'profile_photo_url', 60 | ]; 61 | } 62 | -------------------------------------------------------------------------------- /app/Models/UserPermission.php: -------------------------------------------------------------------------------- 1 | belongsToTeam($team); 34 | } 35 | 36 | /** 37 | * Determine whether the user can create models. 38 | * 39 | * @param \App\Models\User $user 40 | * @return mixed 41 | */ 42 | public function create(User $user) 43 | { 44 | return true; 45 | } 46 | 47 | /** 48 | * Determine whether the user can update the model. 49 | * 50 | * @param \App\Models\User $user 51 | * @param \App\Models\Team $team 52 | * @return mixed 53 | */ 54 | public function update(User $user, Team $team) 55 | { 56 | return $user->ownsTeam($team); 57 | } 58 | 59 | /** 60 | * Determine whether the user can add team members. 61 | * 62 | * @param \App\Models\User $user 63 | * @param \App\Models\Team $team 64 | * @return mixed 65 | */ 66 | public function addTeamMember(User $user, Team $team) 67 | { 68 | return $user->ownsTeam($team); 69 | } 70 | 71 | /** 72 | * Determine whether the user can update team member permissions. 73 | * 74 | * @param \App\Models\User $user 75 | * @param \App\Models\Team $team 76 | * @return mixed 77 | */ 78 | public function updateTeamMember(User $user, Team $team) 79 | { 80 | return $user->ownsTeam($team); 81 | } 82 | 83 | /** 84 | * Determine whether the user can remove team members. 85 | * 86 | * @param \App\Models\User $user 87 | * @param \App\Models\Team $team 88 | * @return mixed 89 | */ 90 | public function removeTeamMember(User $user, Team $team) 91 | { 92 | return $user->ownsTeam($team); 93 | } 94 | 95 | /** 96 | * Determine whether the user can delete the model. 97 | * 98 | * @param \App\Models\User $user 99 | * @param \App\Models\Team $team 100 | * @return mixed 101 | */ 102 | public function delete(User $user, Team $team) 103 | { 104 | return $user->ownsTeam($team); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | TeamPolicy::class, 18 | ]; 19 | 20 | /** 21 | * Register any authentication / authorization services. 22 | * 23 | * @return void 24 | */ 25 | public function boot() 26 | { 27 | $this->registerPolicies(); 28 | 29 | // 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | > 16 | */ 17 | protected $listen = [ 18 | Registered::class => [ 19 | SendEmailVerificationNotification::class, 20 | ], 21 | ]; 22 | 23 | /** 24 | * Register any events for your application. 25 | * 26 | * @return void 27 | */ 28 | public function boot() 29 | { 30 | // 31 | } 32 | 33 | /** 34 | * Determine if events and listeners should be automatically discovered. 35 | * 36 | * @return bool 37 | */ 38 | public function shouldDiscoverEvents() 39 | { 40 | return false; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/Providers/FortifyServiceProvider.php: -------------------------------------------------------------------------------- 1 | email; 41 | 42 | return Limit::perMinute(5)->by($email.$request->ip()); 43 | }); 44 | 45 | RateLimiter::for('two-factor', function (Request $request) { 46 | return Limit::perMinute(5)->by($request->session()->get('login.id')); 47 | }); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/Providers/JetstreamServiceProvider.php: -------------------------------------------------------------------------------- 1 | configurePermissions(); 35 | 36 | Jetstream::createTeamsUsing(CreateTeam::class); 37 | Jetstream::updateTeamNamesUsing(UpdateTeamName::class); 38 | Jetstream::addTeamMembersUsing(AddTeamMember::class); 39 | Jetstream::inviteTeamMembersUsing(InviteTeamMember::class); 40 | Jetstream::removeTeamMembersUsing(RemoveTeamMember::class); 41 | Jetstream::deleteTeamsUsing(DeleteTeam::class); 42 | Jetstream::deleteUsersUsing(DeleteUser::class); 43 | } 44 | 45 | /** 46 | * Configure the roles and permissions that are available within the application. 47 | * 48 | * @return void 49 | */ 50 | protected function configurePermissions() 51 | { 52 | Jetstream::defaultApiTokenPermissions(['read']); 53 | 54 | Jetstream::role('admin', 'Administrator', [ 55 | 'create', 56 | 'read', 57 | 'update', 58 | 'delete', 59 | ])->description('Administrator users can perform any action.'); 60 | 61 | Jetstream::role('editor', 'Editor', [ 62 | 'read', 63 | 'create', 64 | 'update', 65 | ])->description('Editor users have the ability to read, create, and update.'); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | configureRateLimiting(); 30 | 31 | $this->routes(function () { 32 | Route::prefix('api') 33 | ->middleware('api') 34 | ->group(base_path('routes/api.php')); 35 | 36 | Route::middleware('web') 37 | ->group(base_path('routes/web.php')); 38 | }); 39 | } 40 | 41 | /** 42 | * Configure the rate limiters for the application. 43 | * 44 | * @return void 45 | */ 46 | protected function configureRateLimiting() 47 | { 48 | RateLimiter::for('api', function (Request $request) { 49 | return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); 50 | }); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/View/Components/AppLayout.php: -------------------------------------------------------------------------------- 1 | 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "type": "project", 4 | "description": "The Laravel Framework.", 5 | "keywords": ["framework", "laravel"], 6 | "license": "MIT", 7 | "require": { 8 | "php": "^8.0.2", 9 | "guzzlehttp/guzzle": "^7.2", 10 | "laravel/framework": "^9.2", 11 | "laravel/jetstream": "^2.6", 12 | "laravel/sanctum": "^2.14.1", 13 | "laravel/tinker": "^2.7", 14 | "livewire/livewire": "^2.5", 15 | "te7a-houdini/laravel-trix": "^2.0" 16 | }, 17 | "require-dev": { 18 | "barryvdh/laravel-debugbar": "^3.6", 19 | "fakerphp/faker": "^1.9.1", 20 | "laravel/sail": "^1.0.1", 21 | "mockery/mockery": "^1.4.4", 22 | "nunomaduro/collision": "^6.1", 23 | "phpunit/phpunit": "^9.5.10", 24 | "spatie/laravel-ignition": "^1.0" 25 | }, 26 | "autoload": { 27 | "psr-4": { 28 | "App\\": "app/", 29 | "Database\\Factories\\": "database/factories/", 30 | "Database\\Seeders\\": "database/seeders/" 31 | } 32 | }, 33 | "autoload-dev": { 34 | "psr-4": { 35 | "Tests\\": "tests/" 36 | } 37 | }, 38 | "scripts": { 39 | "post-autoload-dump": [ 40 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 41 | "@php artisan package:discover --ansi" 42 | ], 43 | "post-update-cmd": [ 44 | "@php artisan vendor:publish --tag=laravel-assets --ansi --force" 45 | ], 46 | "post-root-package-install": [ 47 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 48 | ], 49 | "post-create-project-cmd": [ 50 | "@php artisan key:generate --ansi" 51 | ] 52 | }, 53 | "extra": { 54 | "laravel": { 55 | "dont-discover": [] 56 | } 57 | }, 58 | "config": { 59 | "optimize-autoloader": true, 60 | "preferred-install": "dist", 61 | "sort-packages": true 62 | }, 63 | "minimum-stability": "dev", 64 | "prefer-stable": true 65 | } 66 | -------------------------------------------------------------------------------- /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 | 'client_options' => [ 43 | // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html 44 | ], 45 | ], 46 | 47 | 'ably' => [ 48 | 'driver' => 'ably', 49 | 'key' => env('ABLY_KEY'), 50 | ], 51 | 52 | 'redis' => [ 53 | 'driver' => 'redis', 54 | 'connection' => 'default', 55 | ], 56 | 57 | 'log' => [ 58 | 'driver' => 'log', 59 | ], 60 | 61 | 'null' => [ 62 | 'driver' => 'null', 63 | ], 64 | 65 | ], 66 | 67 | ]; 68 | -------------------------------------------------------------------------------- /config/cors.php: -------------------------------------------------------------------------------- 1 | ['api/*', 'sanctum/csrf-cookie'], 19 | 20 | 'allowed_methods' => ['*'], 21 | 22 | 'allowed_origins' => ['*'], 23 | 24 | 'allowed_origins_patterns' => [], 25 | 26 | 'allowed_headers' => ['*'], 27 | 28 | 'exposed_headers' => [], 29 | 30 | 'max_age' => 0, 31 | 32 | 'supports_credentials' => false, 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | env('FILESYSTEM_DISK', 'local'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Filesystem Disks 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure as many filesystem "disks" as you wish, and you 24 | | may even configure multiple disks of the same driver. Defaults have 25 | | been set up for each driver as an example of the required values. 26 | | 27 | | Supported Drivers: "local", "ftp", "sftp", "s3" 28 | | 29 | */ 30 | 31 | 'disks' => [ 32 | 33 | 'local' => [ 34 | 'driver' => 'local', 35 | 'root' => storage_path('app'), 36 | 'throw' => false, 37 | ], 38 | 39 | 'public' => [ 40 | 'driver' => 'local', 41 | 'root' => storage_path('app/public'), 42 | 'url' => env('APP_URL').'/storage', 43 | 'visibility' => 'public', 44 | 'throw' => false, 45 | ], 46 | 47 | 's3' => [ 48 | 'driver' => 's3', 49 | 'key' => env('AWS_ACCESS_KEY_ID'), 50 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 51 | 'region' => env('AWS_DEFAULT_REGION'), 52 | 'bucket' => env('AWS_BUCKET'), 53 | 'url' => env('AWS_URL'), 54 | 'endpoint' => env('AWS_ENDPOINT'), 55 | 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), 56 | 'throw' => false, 57 | ], 58 | 59 | ], 60 | 61 | /* 62 | |-------------------------------------------------------------------------- 63 | | Symbolic Links 64 | |-------------------------------------------------------------------------- 65 | | 66 | | Here you may configure the symbolic links that will be created when the 67 | | `storage:link` Artisan command is executed. The array keys should be 68 | | the locations of the links and the values should be their targets. 69 | | 70 | */ 71 | 72 | 'links' => [ 73 | public_path('storage') => storage_path('app/public'), 74 | ], 75 | 76 | ]; 77 | -------------------------------------------------------------------------------- /config/hashing.php: -------------------------------------------------------------------------------- 1 | 'bcrypt', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Bcrypt Options 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may specify the configuration options that should be used when 26 | | passwords are hashed using the Bcrypt algorithm. This will allow you 27 | | to control the amount of time it takes to hash the given password. 28 | | 29 | */ 30 | 31 | 'bcrypt' => [ 32 | 'rounds' => env('BCRYPT_ROUNDS', 10), 33 | ], 34 | 35 | /* 36 | |-------------------------------------------------------------------------- 37 | | Argon Options 38 | |-------------------------------------------------------------------------- 39 | | 40 | | Here you may specify the configuration options that should be used when 41 | | passwords are hashed using the Argon algorithm. These will allow you 42 | | to control the amount of time it takes to hash the given password. 43 | | 44 | */ 45 | 46 | 'argon' => [ 47 | 'memory' => 65536, 48 | 'threads' => 1, 49 | 'time' => 4, 50 | ], 51 | 52 | ]; 53 | -------------------------------------------------------------------------------- /config/jetstream.php: -------------------------------------------------------------------------------- 1 | 'livewire', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Jetstream Route Middleware 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may specify which middleware Jetstream will assign to the routes 26 | | that it registers with the application. When necessary, you may modify 27 | | these middleware; however, this default value is usually sufficient. 28 | | 29 | */ 30 | 31 | 'middleware' => ['web'], 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | Jetstream Guard 36 | |-------------------------------------------------------------------------- 37 | | 38 | | Here you may specify the authentication guard Jetstream will use while 39 | | authenticating users. This value should correspond with one of your 40 | | guards that is already present in your "auth" configuration file. 41 | | 42 | */ 43 | 44 | 'guard' => 'sanctum', 45 | 46 | /* 47 | |-------------------------------------------------------------------------- 48 | | Features 49 | |-------------------------------------------------------------------------- 50 | | 51 | | Some of Jetstream's features are optional. You may disable the features 52 | | by removing them from this array. You're free to only remove some of 53 | | these features or you can even remove all of these if you need to. 54 | | 55 | */ 56 | 57 | 'features' => [ 58 | // Features::termsAndPrivacyPolicy(), 59 | // Features::profilePhotos(), 60 | // Features::api(), 61 | Features::teams(['invitations' => true]), 62 | Features::accountDeletion(), 63 | ], 64 | 65 | /* 66 | |-------------------------------------------------------------------------- 67 | | Profile Photo Disk 68 | |-------------------------------------------------------------------------- 69 | | 70 | | This configuration value determines the default disk that will be used 71 | | when storing profile photos for your application's users. Typically 72 | | this will be the "public" disk but you may adjust this if needed. 73 | | 74 | */ 75 | 76 | 'profile_photo_disk' => 'public', 77 | 78 | ]; 79 | -------------------------------------------------------------------------------- /config/laravel-trix.php: -------------------------------------------------------------------------------- 1 | env('LARAVEL_TRIX_STORAGE_DISK', 'public'), 5 | 6 | 'store_attachment_action' => Te7aHoudini\LaravelTrix\Http\Controllers\TrixAttachmentController::class.'@store', 7 | 8 | 'destroy_attachment_action' => Te7aHoudini\LaravelTrix\Http\Controllers\TrixAttachmentController::class.'@destroy', 9 | ]; 10 | -------------------------------------------------------------------------------- /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 | 'after_commit' => false, 43 | ], 44 | 45 | 'beanstalkd' => [ 46 | 'driver' => 'beanstalkd', 47 | 'host' => 'localhost', 48 | 'queue' => 'default', 49 | 'retry_after' => 90, 50 | 'block_for' => 0, 51 | 'after_commit' => false, 52 | ], 53 | 54 | 'sqs' => [ 55 | 'driver' => 'sqs', 56 | 'key' => env('AWS_ACCESS_KEY_ID'), 57 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 58 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 59 | 'queue' => env('SQS_QUEUE', 'default'), 60 | 'suffix' => env('SQS_SUFFIX'), 61 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 62 | 'after_commit' => false, 63 | ], 64 | 65 | 'redis' => [ 66 | 'driver' => 'redis', 67 | 'connection' => 'default', 68 | 'queue' => env('REDIS_QUEUE', 'default'), 69 | 'retry_after' => 90, 70 | 'block_for' => null, 71 | 'after_commit' => false, 72 | ], 73 | 74 | ], 75 | 76 | /* 77 | |-------------------------------------------------------------------------- 78 | | Failed Queue Jobs 79 | |-------------------------------------------------------------------------- 80 | | 81 | | These options configure the behavior of failed queue job logging so you 82 | | can control which database and table are used to store the jobs that 83 | | have failed. You may change them to any database / table you wish. 84 | | 85 | */ 86 | 87 | 'failed' => [ 88 | 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), 89 | 'database' => env('DB_CONNECTION', 'mysql'), 90 | 'table' => 'failed_jobs', 91 | ], 92 | 93 | ]; 94 | -------------------------------------------------------------------------------- /config/sanctum.php: -------------------------------------------------------------------------------- 1 | explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( 19 | '%s%s', 20 | 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', 21 | Sanctum::currentApplicationUrlWithPort() 22 | ))), 23 | 24 | /* 25 | |-------------------------------------------------------------------------- 26 | | Sanctum Guards 27 | |-------------------------------------------------------------------------- 28 | | 29 | | This array contains the authentication guards that will be checked when 30 | | Sanctum is trying to authenticate a request. If none of these guards 31 | | are able to authenticate the request, Sanctum will use the bearer 32 | | token that's present on an incoming request for authentication. 33 | | 34 | */ 35 | 36 | 'guard' => ['web'], 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Expiration Minutes 41 | |-------------------------------------------------------------------------- 42 | | 43 | | This value controls the number of minutes until an issued token will be 44 | | considered expired. If this value is null, personal access tokens do 45 | | not expire. This won't tweak the lifetime of first-party sessions. 46 | | 47 | */ 48 | 49 | 'expiration' => null, 50 | 51 | /* 52 | |-------------------------------------------------------------------------- 53 | | Sanctum Middleware 54 | |-------------------------------------------------------------------------- 55 | | 56 | | When authenticating your first-party SPA with Sanctum you may need to 57 | | customize some of the middleware Sanctum uses while processing the 58 | | request. You may change the middleware listed below as required. 59 | | 60 | */ 61 | 62 | 'middleware' => [ 63 | 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class, 64 | 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class, 65 | ], 66 | 67 | ]; 68 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), 21 | 'scheme' => 'https', 22 | ], 23 | 24 | 'postmark' => [ 25 | 'token' => env('POSTMARK_TOKEN'), 26 | ], 27 | 28 | 'ses' => [ 29 | 'key' => env('AWS_ACCESS_KEY_ID'), 30 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 31 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 32 | ], 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /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/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite* 2 | -------------------------------------------------------------------------------- /database/factories/TeamFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->unique()->company(), 27 | 'user_id' => User::factory(), 28 | 'personal_team' => true, 29 | ]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->name(), 29 | 'email' => $this->faker->unique()->safeEmail(), 30 | 'email_verified_at' => now(), 31 | 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 32 | 'remember_token' => Str::random(10), 33 | ]; 34 | } 35 | 36 | /** 37 | * Indicate that the model's email address should be unverified. 38 | * 39 | * @return \Illuminate\Database\Eloquent\Factories\Factory 40 | */ 41 | public function unverified() 42 | { 43 | return $this->state(function (array $attributes) { 44 | return [ 45 | 'email_verified_at' => null, 46 | ]; 47 | }); 48 | } 49 | 50 | /** 51 | * Indicate that the user should have a personal team. 52 | * 53 | * @return $this 54 | */ 55 | public function withPersonalTeam() 56 | { 57 | if (! Features::hasTeamFeatures()) { 58 | return $this->state([]); 59 | } 60 | 61 | return $this->has( 62 | Team::factory() 63 | ->state(function (array $attributes, User $user) { 64 | return ['name' => $user->name.'\'s Team', 'user_id' => $user->id, 'personal_team' => true]; 65 | }), 66 | 'ownedTeams' 67 | ); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('name'); 19 | $table->string('email')->unique(); 20 | $table->timestamp('email_verified_at')->nullable(); 21 | $table->string('password'); 22 | $table->rememberToken(); 23 | $table->foreignId('current_team_id')->nullable(); 24 | $table->string('profile_photo_path', 2048)->nullable(); 25 | $table->timestamps(); 26 | }); 27 | } 28 | 29 | /** 30 | * Reverse the migrations. 31 | * 32 | * @return void 33 | */ 34 | public function down() 35 | { 36 | Schema::dropIfExists('users'); 37 | } 38 | }; 39 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_100000_create_password_resets_table.php: -------------------------------------------------------------------------------- 1 | string('email')->index(); 18 | $table->string('token'); 19 | $table->timestamp('created_at')->nullable(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('password_resets'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_200000_add_two_factor_columns_to_users_table.php: -------------------------------------------------------------------------------- 1 | text('two_factor_secret') 19 | ->after('password') 20 | ->nullable(); 21 | 22 | $table->text('two_factor_recovery_codes') 23 | ->after('two_factor_secret') 24 | ->nullable(); 25 | 26 | if (Fortify::confirmsTwoFactorAuthentication()) { 27 | $table->timestamp('two_factor_confirmed_at') 28 | ->after('two_factor_recovery_codes') 29 | ->nullable(); 30 | } 31 | }); 32 | } 33 | 34 | /** 35 | * Reverse the migrations. 36 | * 37 | * @return void 38 | */ 39 | public function down() 40 | { 41 | Schema::table('users', function (Blueprint $table) { 42 | $table->dropColumn(array_merge([ 43 | 'two_factor_secret', 44 | 'two_factor_recovery_codes', 45 | ], Fortify::confirmsTwoFactorAuthentication() ? [ 46 | 'two_factor_confirmed_at', 47 | ] : [])); 48 | }); 49 | } 50 | }; 51 | -------------------------------------------------------------------------------- /database/migrations/2019_08_19_000000_create_failed_jobs_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('uuid')->unique(); 19 | $table->text('connection'); 20 | $table->text('queue'); 21 | $table->longText('payload'); 22 | $table->longText('exception'); 23 | $table->timestamp('failed_at')->useCurrent(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('failed_jobs'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 18 | $table->morphs('tokenable'); 19 | $table->string('name'); 20 | $table->string('token', 64)->unique(); 21 | $table->text('abilities')->nullable(); 22 | $table->timestamp('last_used_at')->nullable(); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('personal_access_tokens'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /database/migrations/2020_05_21_100000_create_teams_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->foreignId('user_id')->index(); 19 | $table->string('name'); 20 | $table->boolean('personal_team'); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::dropIfExists('teams'); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /database/migrations/2020_05_21_200000_create_team_user_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->foreignId('team_id'); 19 | $table->foreignId('user_id'); 20 | $table->string('role')->nullable(); 21 | $table->timestamps(); 22 | 23 | $table->unique(['team_id', 'user_id']); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('team_user'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /database/migrations/2020_05_21_300000_create_team_invitations_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->foreignId('team_id')->constrained()->cascadeOnDelete(); 19 | $table->string('email'); 20 | $table->string('role')->nullable(); 21 | $table->timestamps(); 22 | 23 | $table->unique(['team_id', 'email']); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('team_invitations'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /database/migrations/2022_03_17_134219_create_sessions_table.php: -------------------------------------------------------------------------------- 1 | string('id')->primary(); 18 | $table->foreignId('user_id')->nullable()->index(); 19 | $table->string('ip_address', 45)->nullable(); 20 | $table->text('user_agent')->nullable(); 21 | $table->text('payload'); 22 | $table->integer('last_activity')->index(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('sessions'); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /database/migrations/2022_03_17_141900_create_pages_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('title')->nullable(); 19 | $table->string('slug')->nullable(); 20 | $table->longText('content')->nullable(); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::dropIfExists('pages'); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /database/migrations/2022_03_17_143255_create_trix_rich_texts_table.php: -------------------------------------------------------------------------------- 1 | unsignedBigInteger('id')->autoIncrement(); 18 | $table->string('field'); 19 | $table->morphs('model'); 20 | $table->text('content')->nullable(); 21 | $table->timestamps(); 22 | }); 23 | 24 | Schema::create('trix_attachments', function (Blueprint $table) { 25 | $table->unsignedBigInteger('id')->autoIncrement(); 26 | $table->string('field'); 27 | $table->unsignedInteger('attachable_id')->nullable(); 28 | $table->string('attachable_type'); 29 | $table->string('attachment'); 30 | $table->string('disk'); 31 | $table->boolean('is_pending')->default(1); 32 | $table->timestamps(); 33 | }); 34 | } 35 | 36 | /** 37 | * Reverse the migrations. 38 | * 39 | * @return void 40 | */ 41 | public function down() 42 | { 43 | Schema::drop('trix_attachments'); 44 | Schema::drop('trix_rich_texts'); 45 | } 46 | } -------------------------------------------------------------------------------- /database/migrations/2022_05_27_154414_add_set_default_pages_to_pages_table.php: -------------------------------------------------------------------------------- 1 | boolean('is_default_home')->nullable()->after('id'); 18 | $table->boolean('is_default_404')->nullable()->after('is_default_home'); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | * 25 | * @return void 26 | */ 27 | public function down() 28 | { 29 | Schema::table('pages', function (Blueprint $table) { 30 | // 31 | }); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /database/migrations/2022_06_01_131715_create_navigation_menus_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->integer('sequence'); 19 | $table->enum('type', ['Sidebar', 'Top']); 20 | $table->string('label'); 21 | $table->string('slug'); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('navigation_menus'); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /database/migrations/2022_06_01_180021_add_role_to_users_table.php: -------------------------------------------------------------------------------- 1 | string('role')->default('user')->after('id'); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | * 24 | * @return void 25 | */ 26 | public function down() 27 | { 28 | Schema::table('users', function (Blueprint $table) { 29 | // 30 | }); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /database/migrations/2022_06_02_110432_create_user_permissions_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('role')->nullable(); 19 | $table->string('route_name')->nullable(); 20 | 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::dropIfExists('user_permissions'); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /database/seeders/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call([ 19 | UserSeeder::class, 20 | PageSeeder::class, 21 | NavigationMenuSeeder::class, 22 | UserPermissionSeeder::class, 23 | ]); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /database/seeders/NavigationMenuSeeder.php: -------------------------------------------------------------------------------- 1 | 1, 21 | 'type' => 'Sidebar', 22 | 'label' => 'Home', 23 | 'slug' => 'home', 24 | ]); 25 | NavigationMenu::create([ 26 | 'sequence' => 2, 27 | 'type' => 'Sidebar', 28 | 'label' => 'About', 29 | 'slug' => 'about', 30 | ]); 31 | NavigationMenu::create([ 32 | 'sequence' => 3, 33 | 'type' => 'Sidebar', 34 | 'label' => 'Contact', 35 | 'slug' => 'contact', 36 | ]); 37 | NavigationMenu::create([ 38 | 'sequence' => 1, 39 | 'type' => 'Top', 40 | 'label' => 'Login', 41 | 'slug' => 'login', 42 | ]); 43 | NavigationMenu::create([ 44 | 'sequence' => 1, 45 | 'type' => 'Top', 46 | 'label' => 'Home', 47 | 'slug' => 'home', 48 | ]); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /database/seeders/UserPermissionSeeder.php: -------------------------------------------------------------------------------- 1 | 'admin', 21 | 'route_name' => 'dashboard', 22 | ]); 23 | UserPermission::create([ 24 | 'role' => 'admin', 25 | 'route_name' => 'navigation-menus', 26 | ]); 27 | UserPermission::create([ 28 | 'role' => 'admin', 29 | 'route_name' => 'users', 30 | ]); 31 | UserPermission::create([ 32 | 'role' => 'admin', 33 | 'route_name' => 'user-permissions', 34 | ]); 35 | UserPermission::create([ 36 | 'role' => 'admin', 37 | 'route_name' => 'pages', 38 | ]); 39 | UserPermission::create([ 40 | 'role' => 'user', 41 | 'route_name' => 'dashboard', 42 | ]); 43 | UserPermission::create([ 44 | 'role' => 'user', 45 | 'route_name' => 'pages', 46 | ]); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /database/seeders/UserSeeder.php: -------------------------------------------------------------------------------- 1 | 'Badreddine Zatout', 21 | 'email' => 'admin@example.com', 22 | 'role' => 'admin', 23 | 'password' => '$2y$10$mciTph.QOp/uFbZuEUrj.u3Z5Z8WXwWYHeMAzDssHOivSeXc2ti6y', 24 | ] 25 | ); 26 | User::create([ 27 | 'name' => 'Bob Green', 28 | 'email' => 'bob@esi.dz', 29 | 'role' => 'user', 30 | 'password' => '$2y$10$B5zMDb5V5bMxqpAC3/APSOcNvOdZhoucWJh7LFFXmWuppEiu9Vb2W' 31 | ]); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lang/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "The :attribute must contain at least one letter.": "The :attribute must contain at least one letter.", 3 | "The :attribute must contain at least one number.": "The :attribute must contain at least one number.", 4 | "The :attribute must contain at least one symbol.": "The :attribute must contain at least one symbol.", 5 | "The :attribute must contain at least one uppercase and one lowercase letter.": "The :attribute must contain at least one uppercase and one lowercase letter.", 6 | "The given :attribute has appeared in a data leak. Please choose a different :attribute.": "The given :attribute has appeared in a data leak. Please choose a different :attribute." 7 | } 8 | -------------------------------------------------------------------------------- /lang/en/auth.php: -------------------------------------------------------------------------------- 1 | 'These credentials do not match our records.', 17 | 'password' => 'The provided password is incorrect.', 18 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 19 | 20 | ]; 21 | -------------------------------------------------------------------------------- /lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "npm run development", 5 | "development": "mix", 6 | "watch": "mix watch", 7 | "watch-poll": "mix watch -- --watch-options-poll=1000", 8 | "hot": "mix watch --hot", 9 | "prod": "npm run production", 10 | "production": "mix --production" 11 | }, 12 | "devDependencies": { 13 | "@tailwindcss/forms": "^0.4.0", 14 | "@tailwindcss/typography": "^0.5.0", 15 | "alpinejs": "^3.0.6", 16 | "axios": "^0.25", 17 | "browser-sync": "^2.27.10", 18 | "browser-sync-webpack-plugin": "^2.3.0", 19 | "laravel-mix": "^6.0.6", 20 | "lodash": "^4.17.19", 21 | "postcss": "^8.1.14", 22 | "postcss-import": "^14.0.1", 23 | "tailwindcss": "^3.0.0" 24 | }, 25 | "dependencies": {} 26 | } 27 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BadreddineZatout/simple-laravel-cms/5ca9fd11327c5a91018606f1388226648c6f2b87/public/favicon.ico -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class); 50 | 51 | $response = $kernel->handle( 52 | $request = Request::capture() 53 | )->send(); 54 | 55 | $kernel->terminate($request, $response); 56 | -------------------------------------------------------------------------------- /public/js/notification-socket.js: -------------------------------------------------------------------------------- 1 | let clientSocket = (config = {}) => { 2 | let route = config.route || "127.0.0.1"; 3 | let port = config.port || 3280; 4 | window.Websocket = window.Websocket || window.MozWebSocket; 5 | return new WebSocket("ws://" + route + ":" + port); 6 | }; 7 | let connection = clientSocket(); 8 | 9 | connection.onopen = () => { 10 | console.log("Connecion is open!"); 11 | }; 12 | 13 | //create notification 14 | connection.onmessage = (message) => { 15 | let result = JSON.parse(message.data); 16 | 17 | $(".event-notification-box").html(` 18 |

${result.eventName}

19 |

${result.eventMessage}

20 | `); 21 | $(".event-notification-box").removeClass("opacity-0"); 22 | $(".event-notification-box").addClass("opacity-100"); 23 | 24 | setTimeout(() => { 25 | $(".event-notification-box").removeClass("opacity-100"); 26 | $(".event-notification-box").addClass("opacity-0"); 27 | }, 3000); 28 | }; 29 | 30 | //page creation event listner 31 | window.addEventListener("event-notification", (event) => { 32 | connection.send( 33 | JSON.stringify({ 34 | eventName: event.detail.eventName, 35 | eventMessage: event.detail.eventMessage, 36 | }) 37 | ); 38 | }); 39 | -------------------------------------------------------------------------------- /public/mix-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "/js/app.js": "/js/app.js", 3 | "/css/app.css": "/css/app.css" 4 | } 5 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /resources/css/app.css: -------------------------------------------------------------------------------- 1 | @import "tailwindcss/base"; 2 | @import "tailwindcss/components"; 3 | @import "tailwindcss/utilities"; 4 | 5 | .body-content { 6 | max-height: 300px !important; 7 | overflow-y: scroll; 8 | } 9 | 10 | .trix-button-group--history-tools { 11 | display: none !important; 12 | } 13 | 14 | .error { 15 | color: red; 16 | } 17 | 18 | .table-head { 19 | @apply px-6 py-3 bg-gray-50 text-left text-xs leading-4 font-medium text-gray-500 uppercase tracking-wider; 20 | } 21 | 22 | .table-data { 23 | @apply px-6 py-4 text-sm whitespace-nowrap; 24 | } 25 | 26 | .event-notification-box { 27 | @apply fixed right-0 top-0 mt-3 mr-3 px-5 py-3 rounded-sm shadow-lg text-white bg-green-500; 28 | } 29 | -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | require("./bootstrap"); 2 | 3 | import Alpine from "alpinejs"; 4 | 5 | window.Alpine = Alpine; 6 | 7 | Alpine.start(); 8 | -------------------------------------------------------------------------------- /resources/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | window._ = require('lodash'); 2 | 3 | /** 4 | * We'll load the axios HTTP library which allows us to easily issue requests 5 | * to our Laravel back-end. This library automatically handles sending the 6 | * CSRF token as a header based on the value of the "XSRF" token cookie. 7 | */ 8 | 9 | window.axios = require('axios'); 10 | 11 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 12 | 13 | /** 14 | * Echo exposes an expressive API for subscribing to channels and listening 15 | * for events that are broadcast by Laravel. Echo and event broadcasting 16 | * allows your team to easily build robust real-time web applications. 17 | */ 18 | 19 | // import Echo from 'laravel-echo'; 20 | 21 | // window.Pusher = require('pusher-js'); 22 | 23 | // window.Echo = new Echo({ 24 | // broadcaster: 'pusher', 25 | // key: process.env.MIX_PUSHER_APP_KEY, 26 | // cluster: process.env.MIX_PUSHER_APP_CLUSTER, 27 | // forceTLS: true 28 | // }); 29 | -------------------------------------------------------------------------------- /resources/markdown/policy.md: -------------------------------------------------------------------------------- 1 | # Privacy Policy 2 | 3 | Edit this file to define the privacy policy for your application. 4 | -------------------------------------------------------------------------------- /resources/markdown/terms.md: -------------------------------------------------------------------------------- 1 | # Terms of Service 2 | 3 | Edit this file to define the terms of service for your application. 4 | -------------------------------------------------------------------------------- /resources/views/admin/navigation-menus.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |

4 | {{ __('Navigation Menus') }} 5 |

6 |
7 | 8 |
9 |
10 |
11 | @livewire('navigation-menus') 12 |
13 |
14 |
15 |
16 | -------------------------------------------------------------------------------- /resources/views/admin/pages.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |

4 | {{ __('Pages') }} 5 |

6 |
7 | 8 |
9 |
10 |
11 | @livewire('pages') 12 |
13 |
14 |
15 |
16 | -------------------------------------------------------------------------------- /resources/views/admin/user-permissions.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |

4 | {{ __('User Permissions') }} 5 |

6 |
7 | 8 |
9 |
10 |
11 | @livewire('user-permissions') 12 |
13 |
14 |
15 |
16 | -------------------------------------------------------------------------------- /resources/views/admin/users.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |

4 | {{ __('Users') }} 5 |

6 |
7 | 8 |
9 |
10 |
11 | @livewire('users') 12 |
13 |
14 |
15 |
16 | -------------------------------------------------------------------------------- /resources/views/api/index.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |

4 | {{ __('API Tokens') }} 5 |

6 |
7 | 8 |
9 |
10 | @livewire('api.api-token-manager') 11 |
12 |
13 |
14 | -------------------------------------------------------------------------------- /resources/views/auth/confirm-password.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | {{ __('This is a secure area of the application. Please confirm your password before continuing.') }} 9 |
10 | 11 | 12 | 13 |
14 | @csrf 15 | 16 |
17 | 18 | 19 |
20 | 21 |
22 | 23 | {{ __('Confirm') }} 24 | 25 |
26 |
27 |
28 |
29 | -------------------------------------------------------------------------------- /resources/views/auth/forgot-password.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | {{ __('Forgot your password? No problem. Just let us know your email address and we will email you a password reset link that will allow you to choose a new one.') }} 9 |
10 | 11 | @if (session('status')) 12 |
13 | {{ session('status') }} 14 |
15 | @endif 16 | 17 | 18 | 19 |
20 | @csrf 21 | 22 |
23 | 24 | 25 |
26 | 27 |
28 | 29 | {{ __('Email Password Reset Link') }} 30 | 31 |
32 |
33 |
34 |
35 | -------------------------------------------------------------------------------- /resources/views/auth/login.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | @if (session('status')) 10 |
11 | {{ session('status') }} 12 |
13 | @endif 14 | 15 |
16 | @csrf 17 | 18 |
19 | 20 | 21 |
22 | 23 |
24 | 25 | 26 |
27 | 28 |
29 | 33 |
34 | 35 |
36 | @if (Route::has('password.request')) 37 | 38 | {{ __('Forgot your password?') }} 39 | 40 | @endif 41 | 42 | 43 | {{ __('Log in') }} 44 | 45 |
46 |
47 |
48 |
49 | -------------------------------------------------------------------------------- /resources/views/auth/register.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | @csrf 11 | 12 |
13 | 14 | 15 |
16 | 17 |
18 | 19 | 20 |
21 | 22 |
23 | 24 | 25 |
26 | 27 |
28 | 29 | 30 |
31 | 32 | @if (Laravel\Jetstream\Jetstream::hasTermsAndPrivacyPolicyFeature()) 33 |
34 | 35 |
36 | 37 | 38 |
39 | {!! __('I agree to the :terms_of_service and :privacy_policy', [ 40 | 'terms_of_service' => ''.__('Terms of Service').'', 41 | 'privacy_policy' => ''.__('Privacy Policy').'', 42 | ]) !!} 43 |
44 |
45 |
46 |
47 | @endif 48 | 49 |
50 | 51 | {{ __('Already registered?') }} 52 | 53 | 54 | 55 | {{ __('Register') }} 56 | 57 |
58 |
59 |
60 |
61 | -------------------------------------------------------------------------------- /resources/views/auth/reset-password.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | @csrf 11 | 12 | 13 | 14 |
15 | 16 | 17 |
18 | 19 |
20 | 21 | 22 |
23 | 24 |
25 | 26 | 27 |
28 | 29 |
30 | 31 | {{ __('Reset Password') }} 32 | 33 |
34 |
35 |
36 |
37 | -------------------------------------------------------------------------------- /resources/views/auth/two-factor-challenge.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 |
9 | {{ __('Please confirm access to your account by entering the authentication code provided by your authenticator application.') }} 10 |
11 | 12 |
13 | {{ __('Please confirm access to your account by entering one of your emergency recovery codes.') }} 14 |
15 | 16 | 17 | 18 |
19 | @csrf 20 | 21 |
22 | 23 | 24 |
25 | 26 |
27 | 28 | 29 |
30 | 31 |
32 | 40 | 41 | 49 | 50 | 51 | {{ __('Log in') }} 52 | 53 |
54 |
55 |
56 |
57 |
58 | -------------------------------------------------------------------------------- /resources/views/auth/verify-email.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | {{ __('Thanks for signing up! Before getting started, could you verify your email address by clicking on the link we just emailed to you? If you didn\'t receive the email, we will gladly send you another.') }} 9 |
10 | 11 | @if (session('status') == 'verification-link-sent') 12 |
13 | {{ __('A new verification link has been sent to the email address you provided during registration.') }} 14 |
15 | @endif 16 | 17 |
18 |
19 | @csrf 20 | 21 |
22 | 23 | {{ __('Resend Verification Email') }} 24 | 25 |
26 |
27 | 28 |
29 | @csrf 30 | 31 | 34 |
35 |
36 |
37 |
38 | -------------------------------------------------------------------------------- /resources/views/dashboard.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |

4 | {{ __('Dashboard') }} 5 |

6 |
7 | 8 |
9 |
10 |
11 | 12 |
13 |
14 |
15 |
16 | -------------------------------------------------------------------------------- /resources/views/layouts/app.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{ config('app.name', 'Laravel') }} 10 | 11 | 12 | 13 | 14 | 15 | 16 | @trixassets 17 | @livewireStyles 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | @livewire('navigation-menu') 28 | 29 | 30 | @if (isset($header)) 31 |
32 |
33 | {{ $header }} 34 |
35 |
36 | @endif 37 | 38 | 39 |
40 |
41 | {{ $slot }} 42 |
43 |
44 | 45 | @stack('modals') 46 | 47 | @livewireScripts 48 | 49 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /resources/views/layouts/guest.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{ config('app.name', 'Laravel') }} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | {{ $slot }} 22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /resources/views/layouts/my-app.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{ config('app.name', 'Laravel') }} 10 | 11 | 12 | 13 | 14 | 15 | 16 | @livewireStyles 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 |
30 | {{ $slot }} 31 |
32 |
33 | 34 | @stack('modals') 35 | 36 | @livewireScripts 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /resources/views/policy.blade.php: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 | 6 |
7 | 8 |
9 | {!! $policy !!} 10 |
11 |
12 |
13 |
14 | -------------------------------------------------------------------------------- /resources/views/profile/delete-user-form.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{ __('Delete Account') }} 4 | 5 | 6 | 7 | {{ __('Permanently delete your account.') }} 8 | 9 | 10 | 11 |
12 | {{ __('Once your account is deleted, all of its resources and data will be permanently deleted. Before deleting your account, please download any data or information that you wish to retain.') }} 13 |
14 | 15 |
16 | 17 | {{ __('Delete Account') }} 18 | 19 |
20 | 21 | 22 | 23 | 24 | {{ __('Delete Account') }} 25 | 26 | 27 | 28 | {{ __('Are you sure you want to delete your account? Once your account is deleted, all of its resources and data will be permanently deleted. Please enter your password to confirm you would like to permanently delete your account.') }} 29 | 30 |
31 | 36 | 37 | 38 |
39 |
40 | 41 | 42 | 43 | {{ __('Cancel') }} 44 | 45 | 46 | 47 | {{ __('Delete Account') }} 48 | 49 | 50 |
51 |
52 |
53 | -------------------------------------------------------------------------------- /resources/views/profile/show.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |

4 | {{ __('Profile') }} 5 |

6 |
7 | 8 |
9 |
10 | @if (Laravel\Fortify\Features::canUpdateProfileInformation()) 11 | @livewire('profile.update-profile-information-form') 12 | 13 | 14 | @endif 15 | 16 | @if (Laravel\Fortify\Features::enabled(Laravel\Fortify\Features::updatePasswords())) 17 |
18 | @livewire('profile.update-password-form') 19 |
20 | 21 | 22 | @endif 23 | 24 | @if (Laravel\Fortify\Features::canManageTwoFactorAuthentication()) 25 |
26 | @livewire('profile.two-factor-authentication-form') 27 |
28 | 29 | 30 | @endif 31 | 32 |
33 | @livewire('profile.logout-other-browser-sessions-form') 34 |
35 | 36 | @if (Laravel\Jetstream\Jetstream::hasAccountDeletionFeatures()) 37 | 38 | 39 |
40 | @livewire('profile.delete-user-form') 41 |
42 | @endif 43 |
44 |
45 |
46 | -------------------------------------------------------------------------------- /resources/views/profile/update-password-form.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{ __('Update Password') }} 4 | 5 | 6 | 7 | {{ __('Ensure your account is using a long, random password to stay secure.') }} 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 |
16 | 17 |
18 | 19 | 20 | 21 |
22 | 23 |
24 | 25 | 26 | 27 |
28 |
29 | 30 | 31 | 32 | {{ __('Saved.') }} 33 | 34 | 35 | 36 | {{ __('Save') }} 37 | 38 | 39 |
40 | -------------------------------------------------------------------------------- /resources/views/teams/create-team-form.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{ __('Team Details') }} 4 | 5 | 6 | 7 | {{ __('Create a new team to collaborate with others on projects.') }} 8 | 9 | 10 | 11 |
12 | 13 | 14 |
15 | {{ $this->user->name }} 16 | 17 |
18 |
{{ $this->user->name }}
19 |
{{ $this->user->email }}
20 |
21 |
22 |
23 | 24 |
25 | 26 | 27 | 28 |
29 |
30 | 31 | 32 | 33 | {{ __('Create') }} 34 | 35 | 36 |
37 | -------------------------------------------------------------------------------- /resources/views/teams/create.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |

4 | {{ __('Create Team') }} 5 |

6 |
7 | 8 |
9 |
10 | @livewire('teams.create-team-form') 11 |
12 |
13 |
14 | -------------------------------------------------------------------------------- /resources/views/teams/delete-team-form.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{ __('Delete Team') }} 4 | 5 | 6 | 7 | {{ __('Permanently delete this team.') }} 8 | 9 | 10 | 11 |
12 | {{ __('Once a team is deleted, all of its resources and data will be permanently deleted. Before deleting this team, please download any data or information regarding this team that you wish to retain.') }} 13 |
14 | 15 |
16 | 17 | {{ __('Delete Team') }} 18 | 19 |
20 | 21 | 22 | 23 | 24 | {{ __('Delete Team') }} 25 | 26 | 27 | 28 | {{ __('Are you sure you want to delete this team? Once a team is deleted, all of its resources and data will be permanently deleted.') }} 29 | 30 | 31 | 32 | 33 | {{ __('Cancel') }} 34 | 35 | 36 | 37 | {{ __('Delete Team') }} 38 | 39 | 40 | 41 |
42 |
43 | -------------------------------------------------------------------------------- /resources/views/teams/show.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |

4 | {{ __('Team Settings') }} 5 |

6 |
7 | 8 |
9 |
10 | @livewire('teams.update-team-name-form', ['team' => $team]) 11 | 12 | @livewire('teams.team-member-manager', ['team' => $team]) 13 | 14 | @if (Gate::check('delete', $team) && ! $team->personal_team) 15 | 16 | 17 |
18 | @livewire('teams.delete-team-form', ['team' => $team]) 19 |
20 | @endif 21 |
22 |
23 |
24 | -------------------------------------------------------------------------------- /resources/views/teams/update-team-name-form.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{ __('Team Name') }} 4 | 5 | 6 | 7 | {{ __('The team\'s name and owner information.') }} 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 |
16 | {{ $team->owner->name }} 17 | 18 |
19 |
{{ $team->owner->name }}
20 |
{{ $team->owner->email }}
21 |
22 |
23 |
24 | 25 | 26 |
27 | 28 | 29 | 34 | 35 | 36 |
37 |
38 | 39 | @if (Gate::check('update', $team)) 40 | 41 | 42 | {{ __('Saved.') }} 43 | 44 | 45 | 46 | {{ __('Save') }} 47 | 48 | 49 | @endif 50 |
51 | -------------------------------------------------------------------------------- /resources/views/terms.blade.php: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 | 6 |
7 | 8 |
9 | {!! $terms !!} 10 |
11 |
12 |
13 |
14 | -------------------------------------------------------------------------------- /resources/views/vendor/jetstream/components/action-message.blade.php: -------------------------------------------------------------------------------- 1 | @props(['on']) 2 | 3 |
merge(['class' => 'text-sm text-gray-600']) }}> 9 | {{ $slot->isEmpty() ? 'Saved.' : $slot }} 10 |
11 | -------------------------------------------------------------------------------- /resources/views/vendor/jetstream/components/action-section.blade.php: -------------------------------------------------------------------------------- 1 |
merge(['class' => 'md:grid md:grid-cols-3 md:gap-6']) }}> 2 | 3 | {{ $title }} 4 | {{ $description }} 5 | 6 | 7 |
8 |
9 | {{ $content }} 10 |
11 |
12 |
13 | -------------------------------------------------------------------------------- /resources/views/vendor/jetstream/components/application-mark.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /resources/views/vendor/jetstream/components/authentication-card-logo.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /resources/views/vendor/jetstream/components/authentication-card.blade.php: -------------------------------------------------------------------------------- 1 |
2 |
3 | {{ $logo }} 4 |
5 | 6 |
7 | {{ $slot }} 8 |
9 |
10 | -------------------------------------------------------------------------------- /resources/views/vendor/jetstream/components/banner.blade.php: -------------------------------------------------------------------------------- 1 | @props(['style' => session('flash.bannerStyle', 'success'), 'message' => session('flash.banner')]) 2 | 3 |
14 |
15 |
16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |

30 |
31 | 32 |
33 | 43 |
44 |
45 |
46 |
47 | -------------------------------------------------------------------------------- /resources/views/vendor/jetstream/components/button.blade.php: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /resources/views/vendor/jetstream/components/checkbox.blade.php: -------------------------------------------------------------------------------- 1 | merge(['class' => 'rounded border-gray-300 text-indigo-600 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50']) !!}> 2 | -------------------------------------------------------------------------------- /resources/views/vendor/jetstream/components/confirmation-modal.blade.php: -------------------------------------------------------------------------------- 1 | @props(['id' => null, 'maxWidth' => null]) 2 | 3 | 4 |
5 |
6 |
7 | 8 | 9 | 10 |
11 | 12 |
13 |

14 | {{ $title }} 15 |

16 | 17 |
18 | {{ $content }} 19 |
20 |
21 |
22 |
23 | 24 |
25 | {{ $footer }} 26 |
27 |
28 | -------------------------------------------------------------------------------- /resources/views/vendor/jetstream/components/confirms-password.blade.php: -------------------------------------------------------------------------------- 1 | @props(['title' => __('Confirm Password'), 'content' => __('For your security, please confirm your password to continue.'), 'button' => __('Confirm')]) 2 | 3 | @php 4 | $confirmableId = md5($attributes->wire('then')); 5 | @endphp 6 | 7 | wire('then') }} 9 | x-data 10 | x-ref="span" 11 | x-on:click="$wire.startConfirmingPassword('{{ $confirmableId }}')" 12 | x-on:password-confirmed.window="setTimeout(() => $event.detail.id === '{{ $confirmableId }}' && $refs.span.dispatchEvent(new CustomEvent('then', { bubbles: false })), 250);" 13 | > 14 | {{ $slot }} 15 | 16 | 17 | @once 18 | 19 | 20 | {{ $title }} 21 | 22 | 23 | 24 | {{ $content }} 25 | 26 |
27 | 31 | 32 | 33 |
34 |
35 | 36 | 37 | 38 | {{ __('Cancel') }} 39 | 40 | 41 | 42 | {{ $button }} 43 | 44 | 45 |
46 | @endonce 47 | -------------------------------------------------------------------------------- /resources/views/vendor/jetstream/components/danger-button.blade.php: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /resources/views/vendor/jetstream/components/dialog-modal.blade.php: -------------------------------------------------------------------------------- 1 | @props(['id' => null, 'maxWidth' => null]) 2 | 3 | 4 |
5 |
6 | {{ $title }} 7 |
8 | 9 |
10 | {{ $content }} 11 |
12 |
13 | 14 |
15 | {{ $footer }} 16 |
17 |
18 | -------------------------------------------------------------------------------- /resources/views/vendor/jetstream/components/dropdown-link.blade.php: -------------------------------------------------------------------------------- 1 | merge(['class' => 'block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 transition']) }}>{{ $slot }} 2 | -------------------------------------------------------------------------------- /resources/views/vendor/jetstream/components/dropdown.blade.php: -------------------------------------------------------------------------------- 1 | @props(['align' => 'right', 'width' => '48', 'contentClasses' => 'py-1 bg-white', 'dropdownClasses' => '']) 2 | 3 | @php 4 | switch ($align) { 5 | case 'left': 6 | $alignmentClasses = 'origin-top-left left-0'; 7 | break; 8 | case 'top': 9 | $alignmentClasses = 'origin-top'; 10 | break; 11 | case 'none': 12 | case 'false': 13 | $alignmentClasses = ''; 14 | break; 15 | case 'right': 16 | default: 17 | $alignmentClasses = 'origin-top-right right-0'; 18 | break; 19 | } 20 | 21 | switch ($width) { 22 | case '48': 23 | $width = 'w-48'; 24 | break; 25 | } 26 | @endphp 27 | 28 |
29 |
30 | {{ $trigger }} 31 |
32 | 33 | 47 |
48 | -------------------------------------------------------------------------------- /resources/views/vendor/jetstream/components/form-section.blade.php: -------------------------------------------------------------------------------- 1 | @props(['submit']) 2 | 3 |
merge(['class' => 'md:grid md:grid-cols-3 md:gap-6']) }}> 4 | 5 | {{ $title }} 6 | {{ $description }} 7 | 8 | 9 |
10 |
11 |
12 |
13 | {{ $form }} 14 |
15 |
16 | 17 | @if (isset($actions)) 18 |
19 | {{ $actions }} 20 |
21 | @endif 22 |
23 |
24 |
25 | -------------------------------------------------------------------------------- /resources/views/vendor/jetstream/components/input-error.blade.php: -------------------------------------------------------------------------------- 1 | @props(['for']) 2 | 3 | @error($for) 4 |

merge(['class' => 'text-sm text-red-600']) }}>{{ $message }}

5 | @enderror 6 | -------------------------------------------------------------------------------- /resources/views/vendor/jetstream/components/input.blade.php: -------------------------------------------------------------------------------- 1 | @props(['disabled' => false]) 2 | 3 | merge(['class' => 'border-gray-300 focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 rounded-md shadow-sm']) !!}> 4 | -------------------------------------------------------------------------------- /resources/views/vendor/jetstream/components/label.blade.php: -------------------------------------------------------------------------------- 1 | @props(['value']) 2 | 3 | 6 | -------------------------------------------------------------------------------- /resources/views/vendor/jetstream/components/nav-link.blade.php: -------------------------------------------------------------------------------- 1 | @props(['active']) 2 | 3 | @php 4 | $classes = ($active ?? false) 5 | ? 'inline-flex items-center px-1 pt-1 border-b-2 border-indigo-400 text-sm font-medium leading-5 text-gray-900 focus:outline-none focus:border-indigo-700 transition' 6 | : 'inline-flex items-center px-1 pt-1 border-b-2 border-transparent text-sm font-medium leading-5 text-gray-500 hover:text-gray-700 hover:border-gray-300 focus:outline-none focus:text-gray-700 focus:border-gray-300 transition'; 7 | @endphp 8 | 9 | merge(['class' => $classes]) }}> 10 | {{ $slot }} 11 | 12 | -------------------------------------------------------------------------------- /resources/views/vendor/jetstream/components/responsive-nav-link.blade.php: -------------------------------------------------------------------------------- 1 | @props(['active']) 2 | 3 | @php 4 | $classes = ($active ?? false) 5 | ? 'block pl-3 pr-4 py-2 border-l-4 border-indigo-400 text-base font-medium text-indigo-700 bg-indigo-50 focus:outline-none focus:text-indigo-800 focus:bg-indigo-100 focus:border-indigo-700 transition' 6 | : 'block pl-3 pr-4 py-2 border-l-4 border-transparent text-base font-medium text-gray-600 hover:text-gray-800 hover:bg-gray-50 hover:border-gray-300 focus:outline-none focus:text-gray-800 focus:bg-gray-50 focus:border-gray-300 transition'; 7 | @endphp 8 | 9 | merge(['class' => $classes]) }}> 10 | {{ $slot }} 11 | 12 | -------------------------------------------------------------------------------- /resources/views/vendor/jetstream/components/secondary-button.blade.php: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /resources/views/vendor/jetstream/components/section-border.blade.php: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /resources/views/vendor/jetstream/components/section-title.blade.php: -------------------------------------------------------------------------------- 1 |
2 |
3 |

{{ $title }}

4 | 5 |

6 | {{ $description }} 7 |

8 |
9 | 10 |
11 | {{ $aside ?? '' }} 12 |
13 |
14 | -------------------------------------------------------------------------------- /resources/views/vendor/jetstream/components/switchable-team.blade.php: -------------------------------------------------------------------------------- 1 | @props(['team', 'component' => 'jet-dropdown-link']) 2 | 3 |
4 | @method('PUT') 5 | @csrf 6 | 7 | 8 | 9 | 10 | 11 |
12 | @if (Auth::user()->isCurrentTeam($team)) 13 | 14 | @endif 15 | 16 |
{{ $team->name }}
17 |
18 |
19 |
20 | -------------------------------------------------------------------------------- /resources/views/vendor/jetstream/components/validation-errors.blade.php: -------------------------------------------------------------------------------- 1 | @if ($errors->any()) 2 |
3 |
{{ __('Whoops! Something went wrong.') }}
4 | 5 |
    6 | @foreach ($errors->all() as $error) 7 |
  • {{ $error }}
  • 8 | @endforeach 9 |
10 |
11 | @endif 12 | -------------------------------------------------------------------------------- /resources/views/vendor/jetstream/mail/team-invitation.blade.php: -------------------------------------------------------------------------------- 1 | @component('mail::message') 2 | {{ __('You have been invited to join the :team team!', ['team' => $invitation->team->name]) }} 3 | 4 | @if (Laravel\Fortify\Features::enabled(Laravel\Fortify\Features::registration())) 5 | {{ __('If you do not have an account, you may create one by clicking the button below. After creating an account, you may click the invitation acceptance button in this email to accept the team invitation:') }} 6 | 7 | @component('mail::button', ['url' => route('register')]) 8 | {{ __('Create Account') }} 9 | @endcomponent 10 | 11 | {{ __('If you already have an account, you may accept this invitation by clicking the button below:') }} 12 | 13 | @else 14 | {{ __('You may accept this invitation by clicking the button below:') }} 15 | @endif 16 | 17 | 18 | @component('mail::button', ['url' => $acceptUrl]) 19 | {{ __('Accept Invitation') }} 20 | @endcomponent 21 | 22 | {{ __('If you did not expect to receive an invitation to this team, you may discard this email.') }} 23 | @endcomponent 24 | -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | get('/user', function (Request $request) { 18 | return $request->user(); 19 | }); 20 | -------------------------------------------------------------------------------- /routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 18 | }); 19 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 19 | })->purpose('Display an inspiring quote'); 20 | -------------------------------------------------------------------------------- /routes/web.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'auth:sanctum', 19 | 'verified', 20 | 'roleaccess' 21 | ]], function () { 22 | Route::get('/dashboard', function () { 23 | return view('dashboard'); 24 | })->name('dashboard'); 25 | Route::get('/pages', function () { 26 | return view('admin.pages'); 27 | })->name('pages'); 28 | Route::get('/navigation-menus', function () { 29 | return view('admin.navigation-menus'); 30 | })->name('navigation-menus'); 31 | Route::view('/users', 'admin.users') 32 | ->name('users'); 33 | Route::view('/user-permissions', 'admin.user-permissions') 34 | ->name('user-permissions'); 35 | }); 36 | 37 | Route::get('/{urlslug}', FrontPage::class); 38 | Route::get('/', FrontPage::class); 39 | -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/debugbar/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | compiled.php 2 | config.php 3 | down 4 | events.scanned.php 5 | maintenance.php 6 | routes.php 7 | routes.scanned.php 8 | schedule-* 9 | services.json 10 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !data/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/framework/cache/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | const defaultTheme = require("tailwindcss/defaultTheme"); 2 | 3 | module.exports = { 4 | content: [ 5 | "./vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php", 6 | "./vendor/laravel/jetstream/**/*.blade.php", 7 | "./storage/framework/views/*.php", 8 | "./resources/views/**/*.blade.php", 9 | ], 10 | 11 | theme: { 12 | extend: { 13 | fontFamily: { 14 | sans: ["Nunito", ...defaultTheme.fontFamily.sans], 15 | }, 16 | colors: { 17 | PrussianBlue: "#013B57", 18 | DarkChestnut: "#977563", 19 | Champagne: "#F7E6CC", 20 | PinkLavender: "#D8BAC6", 21 | MediumCarmine: "#A6492B", 22 | }, 23 | }, 24 | }, 25 | 26 | plugins: [ 27 | require("@tailwindcss/forms"), 28 | require("@tailwindcss/typography"), 29 | ], 30 | }; 31 | -------------------------------------------------------------------------------- /tests/CreatesApplication.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 19 | 20 | return $app; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/Feature/ApiTokenPermissionsTest.php: -------------------------------------------------------------------------------- 1 | markTestSkipped('API support is not enabled.'); 21 | } 22 | 23 | $this->actingAs($user = User::factory()->withPersonalTeam()->create()); 24 | 25 | $token = $user->tokens()->create([ 26 | 'name' => 'Test Token', 27 | 'token' => Str::random(40), 28 | 'abilities' => ['create', 'read'], 29 | ]); 30 | 31 | Livewire::test(ApiTokenManager::class) 32 | ->set(['managingPermissionsFor' => $token]) 33 | ->set(['updateApiTokenForm' => [ 34 | 'permissions' => [ 35 | 'delete', 36 | 'missing-permission', 37 | ], 38 | ]]) 39 | ->call('updateApiToken'); 40 | 41 | $this->assertTrue($user->fresh()->tokens->first()->can('delete')); 42 | $this->assertFalse($user->fresh()->tokens->first()->can('read')); 43 | $this->assertFalse($user->fresh()->tokens->first()->can('missing-permission')); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /tests/Feature/AuthenticationTest.php: -------------------------------------------------------------------------------- 1 | get('/login'); 17 | 18 | $response->assertStatus(200); 19 | } 20 | 21 | public function test_users_can_authenticate_using_the_login_screen() 22 | { 23 | $user = User::factory()->create(); 24 | 25 | $response = $this->post('/login', [ 26 | 'email' => $user->email, 27 | 'password' => 'password', 28 | ]); 29 | 30 | $this->assertAuthenticated(); 31 | $response->assertRedirect(RouteServiceProvider::HOME); 32 | } 33 | 34 | public function test_users_can_not_authenticate_with_invalid_password() 35 | { 36 | $user = User::factory()->create(); 37 | 38 | $this->post('/login', [ 39 | 'email' => $user->email, 40 | 'password' => 'wrong-password', 41 | ]); 42 | 43 | $this->assertGuest(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /tests/Feature/BrowserSessionsTest.php: -------------------------------------------------------------------------------- 1 | actingAs($user = User::factory()->create()); 18 | 19 | Livewire::test(LogoutOtherBrowserSessionsForm::class) 20 | ->set('password', 'password') 21 | ->call('logoutOtherBrowserSessions'); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/Feature/CreateApiTokenTest.php: -------------------------------------------------------------------------------- 1 | markTestSkipped('API support is not enabled.'); 20 | } 21 | 22 | $this->actingAs($user = User::factory()->withPersonalTeam()->create()); 23 | 24 | Livewire::test(ApiTokenManager::class) 25 | ->set(['createApiTokenForm' => [ 26 | 'name' => 'Test Token', 27 | 'permissions' => [ 28 | 'read', 29 | 'update', 30 | ], 31 | ]]) 32 | ->call('createApiToken'); 33 | 34 | $this->assertCount(1, $user->fresh()->tokens); 35 | $this->assertEquals('Test Token', $user->fresh()->tokens->first()->name); 36 | $this->assertTrue($user->fresh()->tokens->first()->can('read')); 37 | $this->assertFalse($user->fresh()->tokens->first()->can('delete')); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tests/Feature/CreateTeamTest.php: -------------------------------------------------------------------------------- 1 | actingAs($user = User::factory()->withPersonalTeam()->create()); 18 | 19 | Livewire::test(CreateTeamForm::class) 20 | ->set(['state' => ['name' => 'Test Team']]) 21 | ->call('createTeam'); 22 | 23 | $this->assertCount(2, $user->fresh()->ownedTeams); 24 | $this->assertEquals('Test Team', $user->fresh()->ownedTeams()->latest('id')->first()->name); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tests/Feature/DeleteAccountTest.php: -------------------------------------------------------------------------------- 1 | markTestSkipped('Account deletion is not enabled.'); 20 | } 21 | 22 | $this->actingAs($user = User::factory()->create()); 23 | 24 | $component = Livewire::test(DeleteUserForm::class) 25 | ->set('password', 'password') 26 | ->call('deleteUser'); 27 | 28 | $this->assertNull($user->fresh()); 29 | } 30 | 31 | public function test_correct_password_must_be_provided_before_account_can_be_deleted() 32 | { 33 | if (! Features::hasAccountDeletionFeatures()) { 34 | return $this->markTestSkipped('Account deletion is not enabled.'); 35 | } 36 | 37 | $this->actingAs($user = User::factory()->create()); 38 | 39 | Livewire::test(DeleteUserForm::class) 40 | ->set('password', 'wrong-password') 41 | ->call('deleteUser') 42 | ->assertHasErrors(['password']); 43 | 44 | $this->assertNotNull($user->fresh()); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /tests/Feature/DeleteApiTokenTest.php: -------------------------------------------------------------------------------- 1 | markTestSkipped('API support is not enabled.'); 21 | } 22 | 23 | $this->actingAs($user = User::factory()->withPersonalTeam()->create()); 24 | 25 | $token = $user->tokens()->create([ 26 | 'name' => 'Test Token', 27 | 'token' => Str::random(40), 28 | 'abilities' => ['create', 'read'], 29 | ]); 30 | 31 | Livewire::test(ApiTokenManager::class) 32 | ->set(['apiTokenIdBeingDeleted' => $token->id]) 33 | ->call('deleteApiToken'); 34 | 35 | $this->assertCount(0, $user->fresh()->tokens); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tests/Feature/DeleteTeamTest.php: -------------------------------------------------------------------------------- 1 | actingAs($user = User::factory()->withPersonalTeam()->create()); 19 | 20 | $user->ownedTeams()->save($team = Team::factory()->make([ 21 | 'personal_team' => false, 22 | ])); 23 | 24 | $team->users()->attach( 25 | $otherUser = User::factory()->create(), ['role' => 'test-role'] 26 | ); 27 | 28 | $component = Livewire::test(DeleteTeamForm::class, ['team' => $team->fresh()]) 29 | ->call('deleteTeam'); 30 | 31 | $this->assertNull($team->fresh()); 32 | $this->assertCount(0, $otherUser->fresh()->teams); 33 | } 34 | 35 | public function test_personal_teams_cant_be_deleted() 36 | { 37 | $this->actingAs($user = User::factory()->withPersonalTeam()->create()); 38 | 39 | $component = Livewire::test(DeleteTeamForm::class, ['team' => $user->currentTeam]) 40 | ->call('deleteTeam') 41 | ->assertHasErrors(['team']); 42 | 43 | $this->assertNotNull($user->currentTeam->fresh()); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /tests/Feature/EmailVerificationTest.php: -------------------------------------------------------------------------------- 1 | markTestSkipped('Email verification not enabled.'); 22 | } 23 | 24 | $user = User::factory()->withPersonalTeam()->unverified()->create(); 25 | 26 | $response = $this->actingAs($user)->get('/email/verify'); 27 | 28 | $response->assertStatus(200); 29 | } 30 | 31 | public function test_email_can_be_verified() 32 | { 33 | if (! Features::enabled(Features::emailVerification())) { 34 | return $this->markTestSkipped('Email verification not enabled.'); 35 | } 36 | 37 | Event::fake(); 38 | 39 | $user = User::factory()->unverified()->create(); 40 | 41 | $verificationUrl = URL::temporarySignedRoute( 42 | 'verification.verify', 43 | now()->addMinutes(60), 44 | ['id' => $user->id, 'hash' => sha1($user->email)] 45 | ); 46 | 47 | $response = $this->actingAs($user)->get($verificationUrl); 48 | 49 | Event::assertDispatched(Verified::class); 50 | 51 | $this->assertTrue($user->fresh()->hasVerifiedEmail()); 52 | $response->assertRedirect(RouteServiceProvider::HOME.'?verified=1'); 53 | } 54 | 55 | public function test_email_can_not_verified_with_invalid_hash() 56 | { 57 | if (! Features::enabled(Features::emailVerification())) { 58 | return $this->markTestSkipped('Email verification not enabled.'); 59 | } 60 | 61 | $user = User::factory()->unverified()->create(); 62 | 63 | $verificationUrl = URL::temporarySignedRoute( 64 | 'verification.verify', 65 | now()->addMinutes(60), 66 | ['id' => $user->id, 'hash' => sha1('wrong-email')] 67 | ); 68 | 69 | $this->actingAs($user)->get($verificationUrl); 70 | 71 | $this->assertFalse($user->fresh()->hasVerifiedEmail()); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /tests/Feature/ExampleTest.php: -------------------------------------------------------------------------------- 1 | get('/'); 18 | 19 | $response->assertStatus(200); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/Feature/InviteTeamMemberTest.php: -------------------------------------------------------------------------------- 1 | actingAs($user = User::factory()->withPersonalTeam()->create()); 22 | 23 | $component = Livewire::test(TeamMemberManager::class, ['team' => $user->currentTeam]) 24 | ->set('addTeamMemberForm', [ 25 | 'email' => 'test@example.com', 26 | 'role' => 'admin', 27 | ])->call('addTeamMember'); 28 | 29 | Mail::assertSent(TeamInvitation::class); 30 | 31 | $this->assertCount(1, $user->currentTeam->fresh()->teamInvitations); 32 | } 33 | 34 | public function test_team_member_invitations_can_be_cancelled() 35 | { 36 | Mail::fake(); 37 | 38 | $this->actingAs($user = User::factory()->withPersonalTeam()->create()); 39 | 40 | // Add the team member... 41 | $component = Livewire::test(TeamMemberManager::class, ['team' => $user->currentTeam]) 42 | ->set('addTeamMemberForm', [ 43 | 'email' => 'test@example.com', 44 | 'role' => 'admin', 45 | ])->call('addTeamMember'); 46 | 47 | $invitationId = $user->currentTeam->fresh()->teamInvitations->first()->id; 48 | 49 | // Cancel the team invitation... 50 | $component->call('cancelTeamInvitation', $invitationId); 51 | 52 | $this->assertCount(0, $user->currentTeam->fresh()->teamInvitations); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /tests/Feature/LeaveTeamTest.php: -------------------------------------------------------------------------------- 1 | withPersonalTeam()->create(); 18 | 19 | $user->currentTeam->users()->attach( 20 | $otherUser = User::factory()->create(), ['role' => 'admin'] 21 | ); 22 | 23 | $this->actingAs($otherUser); 24 | 25 | $component = Livewire::test(TeamMemberManager::class, ['team' => $user->currentTeam]) 26 | ->call('leaveTeam'); 27 | 28 | $this->assertCount(0, $user->currentTeam->fresh()->users); 29 | } 30 | 31 | public function test_team_owners_cant_leave_their_own_team() 32 | { 33 | $this->actingAs($user = User::factory()->withPersonalTeam()->create()); 34 | 35 | $component = Livewire::test(TeamMemberManager::class, ['team' => $user->currentTeam]) 36 | ->call('leaveTeam') 37 | ->assertHasErrors(['team']); 38 | 39 | $this->assertNotNull($user->currentTeam->fresh()); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tests/Feature/PasswordConfirmationTest.php: -------------------------------------------------------------------------------- 1 | withPersonalTeam()->create(); 17 | 18 | $response = $this->actingAs($user)->get('/user/confirm-password'); 19 | 20 | $response->assertStatus(200); 21 | } 22 | 23 | public function test_password_can_be_confirmed() 24 | { 25 | $user = User::factory()->create(); 26 | 27 | $response = $this->actingAs($user)->post('/user/confirm-password', [ 28 | 'password' => 'password', 29 | ]); 30 | 31 | $response->assertRedirect(); 32 | $response->assertSessionHasNoErrors(); 33 | } 34 | 35 | public function test_password_is_not_confirmed_with_invalid_password() 36 | { 37 | $user = User::factory()->create(); 38 | 39 | $response = $this->actingAs($user)->post('/user/confirm-password', [ 40 | 'password' => 'wrong-password', 41 | ]); 42 | 43 | $response->assertSessionHasErrors(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /tests/Feature/PasswordResetTest.php: -------------------------------------------------------------------------------- 1 | markTestSkipped('Password updates are not enabled.'); 20 | } 21 | 22 | $response = $this->get('/forgot-password'); 23 | 24 | $response->assertStatus(200); 25 | } 26 | 27 | public function test_reset_password_link_can_be_requested() 28 | { 29 | if (! Features::enabled(Features::resetPasswords())) { 30 | return $this->markTestSkipped('Password updates are not enabled.'); 31 | } 32 | 33 | Notification::fake(); 34 | 35 | $user = User::factory()->create(); 36 | 37 | $response = $this->post('/forgot-password', [ 38 | 'email' => $user->email, 39 | ]); 40 | 41 | Notification::assertSentTo($user, ResetPassword::class); 42 | } 43 | 44 | public function test_reset_password_screen_can_be_rendered() 45 | { 46 | if (! Features::enabled(Features::resetPasswords())) { 47 | return $this->markTestSkipped('Password updates are not enabled.'); 48 | } 49 | 50 | Notification::fake(); 51 | 52 | $user = User::factory()->create(); 53 | 54 | $response = $this->post('/forgot-password', [ 55 | 'email' => $user->email, 56 | ]); 57 | 58 | Notification::assertSentTo($user, ResetPassword::class, function ($notification) { 59 | $response = $this->get('/reset-password/'.$notification->token); 60 | 61 | $response->assertStatus(200); 62 | 63 | return true; 64 | }); 65 | } 66 | 67 | public function test_password_can_be_reset_with_valid_token() 68 | { 69 | if (! Features::enabled(Features::resetPasswords())) { 70 | return $this->markTestSkipped('Password updates are not enabled.'); 71 | } 72 | 73 | Notification::fake(); 74 | 75 | $user = User::factory()->create(); 76 | 77 | $response = $this->post('/forgot-password', [ 78 | 'email' => $user->email, 79 | ]); 80 | 81 | Notification::assertSentTo($user, ResetPassword::class, function ($notification) use ($user) { 82 | $response = $this->post('/reset-password', [ 83 | 'token' => $notification->token, 84 | 'email' => $user->email, 85 | 'password' => 'password', 86 | 'password_confirmation' => 'password', 87 | ]); 88 | 89 | $response->assertSessionHasNoErrors(); 90 | 91 | return true; 92 | }); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /tests/Feature/ProfileInformationTest.php: -------------------------------------------------------------------------------- 1 | actingAs($user = User::factory()->create()); 18 | 19 | $component = Livewire::test(UpdateProfileInformationForm::class); 20 | 21 | $this->assertEquals($user->name, $component->state['name']); 22 | $this->assertEquals($user->email, $component->state['email']); 23 | } 24 | 25 | public function test_profile_information_can_be_updated() 26 | { 27 | $this->actingAs($user = User::factory()->create()); 28 | 29 | Livewire::test(UpdateProfileInformationForm::class) 30 | ->set('state', ['name' => 'Test Name', 'email' => 'test@example.com']) 31 | ->call('updateProfileInformation'); 32 | 33 | $this->assertEquals('Test Name', $user->fresh()->name); 34 | $this->assertEquals('test@example.com', $user->fresh()->email); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/Feature/RegistrationTest.php: -------------------------------------------------------------------------------- 1 | markTestSkipped('Registration support is not enabled.'); 19 | } 20 | 21 | $response = $this->get('/register'); 22 | 23 | $response->assertStatus(200); 24 | } 25 | 26 | public function test_registration_screen_cannot_be_rendered_if_support_is_disabled() 27 | { 28 | if (Features::enabled(Features::registration())) { 29 | return $this->markTestSkipped('Registration support is enabled.'); 30 | } 31 | 32 | $response = $this->get('/register'); 33 | 34 | $response->assertStatus(404); 35 | } 36 | 37 | public function test_new_users_can_register() 38 | { 39 | if (! Features::enabled(Features::registration())) { 40 | return $this->markTestSkipped('Registration support is not enabled.'); 41 | } 42 | 43 | $response = $this->post('/register', [ 44 | 'name' => 'Test User', 45 | 'email' => 'test@example.com', 46 | 'password' => 'password', 47 | 'password_confirmation' => 'password', 48 | 'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature(), 49 | ]); 50 | 51 | $this->assertAuthenticated(); 52 | $response->assertRedirect(RouteServiceProvider::HOME); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /tests/Feature/RemoveTeamMemberTest.php: -------------------------------------------------------------------------------- 1 | actingAs($user = User::factory()->withPersonalTeam()->create()); 18 | 19 | $user->currentTeam->users()->attach( 20 | $otherUser = User::factory()->create(), ['role' => 'admin'] 21 | ); 22 | 23 | $component = Livewire::test(TeamMemberManager::class, ['team' => $user->currentTeam]) 24 | ->set('teamMemberIdBeingRemoved', $otherUser->id) 25 | ->call('removeTeamMember'); 26 | 27 | $this->assertCount(0, $user->currentTeam->fresh()->users); 28 | } 29 | 30 | public function test_only_team_owner_can_remove_team_members() 31 | { 32 | $user = User::factory()->withPersonalTeam()->create(); 33 | 34 | $user->currentTeam->users()->attach( 35 | $otherUser = User::factory()->create(), ['role' => 'admin'] 36 | ); 37 | 38 | $this->actingAs($otherUser); 39 | 40 | $component = Livewire::test(TeamMemberManager::class, ['team' => $user->currentTeam]) 41 | ->set('teamMemberIdBeingRemoved', $user->id) 42 | ->call('removeTeamMember') 43 | ->assertStatus(403); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /tests/Feature/TwoFactorAuthenticationSettingsTest.php: -------------------------------------------------------------------------------- 1 | actingAs($user = User::factory()->create()); 18 | 19 | $this->withSession(['auth.password_confirmed_at' => time()]); 20 | 21 | Livewire::test(TwoFactorAuthenticationForm::class) 22 | ->call('enableTwoFactorAuthentication'); 23 | 24 | $user = $user->fresh(); 25 | 26 | $this->assertNotNull($user->two_factor_secret); 27 | $this->assertCount(8, $user->recoveryCodes()); 28 | } 29 | 30 | public function test_recovery_codes_can_be_regenerated() 31 | { 32 | $this->actingAs($user = User::factory()->create()); 33 | 34 | $this->withSession(['auth.password_confirmed_at' => time()]); 35 | 36 | $component = Livewire::test(TwoFactorAuthenticationForm::class) 37 | ->call('enableTwoFactorAuthentication') 38 | ->call('regenerateRecoveryCodes'); 39 | 40 | $user = $user->fresh(); 41 | 42 | $component->call('regenerateRecoveryCodes'); 43 | 44 | $this->assertCount(8, $user->recoveryCodes()); 45 | $this->assertCount(8, array_diff($user->recoveryCodes(), $user->fresh()->recoveryCodes())); 46 | } 47 | 48 | public function test_two_factor_authentication_can_be_disabled() 49 | { 50 | $this->actingAs($user = User::factory()->create()); 51 | 52 | $this->withSession(['auth.password_confirmed_at' => time()]); 53 | 54 | $component = Livewire::test(TwoFactorAuthenticationForm::class) 55 | ->call('enableTwoFactorAuthentication'); 56 | 57 | $this->assertNotNull($user->fresh()->two_factor_secret); 58 | 59 | $component->call('disableTwoFactorAuthentication'); 60 | 61 | $this->assertNull($user->fresh()->two_factor_secret); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /tests/Feature/UpdatePasswordTest.php: -------------------------------------------------------------------------------- 1 | actingAs($user = User::factory()->create()); 19 | 20 | Livewire::test(UpdatePasswordForm::class) 21 | ->set('state', [ 22 | 'current_password' => 'password', 23 | 'password' => 'new-password', 24 | 'password_confirmation' => 'new-password', 25 | ]) 26 | ->call('updatePassword'); 27 | 28 | $this->assertTrue(Hash::check('new-password', $user->fresh()->password)); 29 | } 30 | 31 | public function test_current_password_must_be_correct() 32 | { 33 | $this->actingAs($user = User::factory()->create()); 34 | 35 | Livewire::test(UpdatePasswordForm::class) 36 | ->set('state', [ 37 | 'current_password' => 'wrong-password', 38 | 'password' => 'new-password', 39 | 'password_confirmation' => 'new-password', 40 | ]) 41 | ->call('updatePassword') 42 | ->assertHasErrors(['current_password']); 43 | 44 | $this->assertTrue(Hash::check('password', $user->fresh()->password)); 45 | } 46 | 47 | public function test_new_passwords_must_match() 48 | { 49 | $this->actingAs($user = User::factory()->create()); 50 | 51 | Livewire::test(UpdatePasswordForm::class) 52 | ->set('state', [ 53 | 'current_password' => 'password', 54 | 'password' => 'new-password', 55 | 'password_confirmation' => 'wrong-password', 56 | ]) 57 | ->call('updatePassword') 58 | ->assertHasErrors(['password']); 59 | 60 | $this->assertTrue(Hash::check('password', $user->fresh()->password)); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /tests/Feature/UpdateTeamMemberRoleTest.php: -------------------------------------------------------------------------------- 1 | actingAs($user = User::factory()->withPersonalTeam()->create()); 18 | 19 | $user->currentTeam->users()->attach( 20 | $otherUser = User::factory()->create(), ['role' => 'admin'] 21 | ); 22 | 23 | $component = Livewire::test(TeamMemberManager::class, ['team' => $user->currentTeam]) 24 | ->set('managingRoleFor', $otherUser) 25 | ->set('currentRole', 'editor') 26 | ->call('updateRole'); 27 | 28 | $this->assertTrue($otherUser->fresh()->hasTeamRole( 29 | $user->currentTeam->fresh(), 'editor' 30 | )); 31 | } 32 | 33 | public function test_only_team_owner_can_update_team_member_roles() 34 | { 35 | $user = User::factory()->withPersonalTeam()->create(); 36 | 37 | $user->currentTeam->users()->attach( 38 | $otherUser = User::factory()->create(), ['role' => 'admin'] 39 | ); 40 | 41 | $this->actingAs($otherUser); 42 | 43 | $component = Livewire::test(TeamMemberManager::class, ['team' => $user->currentTeam]) 44 | ->set('managingRoleFor', $otherUser) 45 | ->set('currentRole', 'editor') 46 | ->call('updateRole') 47 | ->assertStatus(403); 48 | 49 | $this->assertTrue($otherUser->fresh()->hasTeamRole( 50 | $user->currentTeam->fresh(), 'admin' 51 | )); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /tests/Feature/UpdateTeamNameTest.php: -------------------------------------------------------------------------------- 1 | actingAs($user = User::factory()->withPersonalTeam()->create()); 18 | 19 | Livewire::test(UpdateTeamNameForm::class, ['team' => $user->currentTeam]) 20 | ->set(['state' => ['name' => 'Test Team']]) 21 | ->call('updateTeamName'); 22 | 23 | $this->assertCount(1, $user->fresh()->ownedTeams); 24 | $this->assertEquals('Test Team', $user->currentTeam->fresh()->name); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /webpack.mix.js: -------------------------------------------------------------------------------- 1 | const mix = require("laravel-mix"); 2 | 3 | /* 4 | |-------------------------------------------------------------------------- 5 | | Mix Asset Management 6 | |-------------------------------------------------------------------------- 7 | | 8 | | Mix provides a clean, fluent API for defining some Webpack build steps 9 | | for your Laravel applications. By default, we are compiling the CSS 10 | | file for the application as well as bundling up all the JS files. 11 | | 12 | */ 13 | 14 | mix.js("resources/js/app.js", "public/js") 15 | .postCss("resources/css/app.css", "public/css", [ 16 | require("postcss-import"), 17 | require("tailwindcss"), 18 | ]) 19 | .browserSync("http://localhost:8000"); 20 | 21 | if (mix.inProduction()) { 22 | mix.version(); 23 | } 24 | -------------------------------------------------------------------------------- /websocket/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules -------------------------------------------------------------------------------- /websocket/notificationsServer.js: -------------------------------------------------------------------------------- 1 | const webSocketServer = require("websocket").server; 2 | const http = require("http"); 3 | const htmlEntity = require("html-entities"); 4 | 5 | const PORT = 3280; 6 | const clients = []; 7 | 8 | const server = http.createServer(); 9 | server.listen(PORT, () => { 10 | console.log("Server listening on PORT:", PORT); 11 | }); 12 | 13 | const wsServer = new webSocketServer({ 14 | httpServer: server, 15 | }); 16 | wsServer.on("request", (req) => { 17 | let connection = req.accept(null, req.origin); 18 | let index = clients.push(connection) - 1; 19 | console.log("Client", index, "connected"); 20 | 21 | connection.on("message", (message) => { 22 | let utf8Data = JSON.parse(message.utf8Data); 23 | if (message.type == "utf8") { 24 | let obj = JSON.stringify({ 25 | eventName: htmlEntity.encode(utf8Data.eventName), 26 | eventMessage: htmlEntity.encode(utf8Data.eventMessage), 27 | }); 28 | clients.forEach((client) => { 29 | client.sendUTF(obj); 30 | }); 31 | } 32 | }); 33 | 34 | connection.on("close", (connection) => { 35 | clients.splice(index, 1); 36 | console.log("Client", index, "was disconnected"); 37 | }); 38 | }); 39 | -------------------------------------------------------------------------------- /websocket/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "websocket-cms", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "nodemon notificationsServer.js" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "html-entities": "^2.3.3", 14 | "websocket": "^1.0.34" 15 | }, 16 | "devDependencies": { 17 | "nodemon": "^2.0.16" 18 | } 19 | } 20 | --------------------------------------------------------------------------------