├── .editorconfig ├── .env.example ├── .gitattributes ├── .gitignore ├── .styleci.yml ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── README.md ├── app ├── Console │ └── Kernel.php ├── Exceptions │ └── Handler.php ├── Http │ ├── Controllers │ │ ├── API │ │ │ └── V1 │ │ │ │ ├── ApiController.php │ │ │ │ ├── CopyFileController.php │ │ │ │ ├── DeleteFileController.php │ │ │ │ ├── DownloadController.php │ │ │ │ ├── FileController.php │ │ │ │ ├── FolderController.php │ │ │ │ ├── MoveFileController.php │ │ │ │ ├── RoleController.php │ │ │ │ ├── ShareableLinkController.php │ │ │ │ ├── SharesController.php │ │ │ │ ├── StarredController.php │ │ │ │ └── UserController.php │ │ ├── Auth │ │ │ ├── AuthenticatedSessionController.php │ │ │ ├── ConfirmablePasswordController.php │ │ │ ├── EmailVerificationNotificationController.php │ │ │ ├── EmailVerificationPromptController.php │ │ │ ├── NewPasswordController.php │ │ │ ├── PasswordResetLinkController.php │ │ │ ├── RegisteredUserController.php │ │ │ ├── SocialController.php │ │ │ └── VerifyEmailController.php │ │ ├── Controller.php │ │ ├── HomeController.php │ │ ├── ShareableController.php │ │ ├── TagController.php │ │ ├── Translation │ │ │ ├── LanguageController.php │ │ │ └── LanguageTranslationController.php │ │ └── UploadController.php │ ├── Kernel.php │ ├── Middleware │ │ ├── Authenticate.php │ │ ├── EncryptCookies.php │ │ ├── PreventRequestsDuringMaintenance.php │ │ ├── RedirectIfAuthenticated.php │ │ ├── TrimStrings.php │ │ ├── TrustHosts.php │ │ ├── TrustProxies.php │ │ └── VerifyCsrfToken.php │ └── Requests │ │ ├── Auth │ │ └── LoginRequest.php │ │ ├── FileRequest.php │ │ ├── FolderRequest.php │ │ ├── RoleRequest.php │ │ └── UserRequest.php ├── Jobs │ ├── ResizedImage.php │ └── UploadToCloud.php ├── Models │ ├── File.php │ ├── Folder.php │ ├── Observers │ │ ├── FileObserver.php │ │ └── FolderObserver.php │ ├── Role.php │ ├── ShareableLink.php │ ├── Tag.php │ ├── Tagable.php │ ├── Traits │ │ ├── CaptureIpTrait.php │ │ ├── HandlesPaths.php │ │ └── HashesId.php │ ├── User.php │ └── UserMeta.php ├── Policies │ ├── RolePolicy.php │ └── UserPolicy.php ├── Providers │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── BroadcastServiceProvider.php │ ├── EventServiceProvider.php │ └── RouteServiceProvider.php ├── Repositories │ ├── BaseRepository.php │ ├── RoleRepository.php │ └── UserRepository.php ├── Response │ ├── AudioVideoResponse.php │ ├── DownloadResponse.php │ ├── FileContentResponseCreator.php │ └── ImageResponse.php ├── Services │ └── Shares │ │ ├── AttachUsersToEntry.php │ │ ├── DetachUsersFromEntries.php │ │ ├── GetUsersWithAccessToEntry.php │ │ ├── Traits │ │ └── GeneratesSharePermissions.php │ │ └── UpdateEntryUsers.php └── View │ └── Components │ ├── AppLayout.php │ └── GuestLayout.php ├── artisan ├── bootstrap ├── app.php └── cache │ └── .gitignore ├── composer.json ├── composer.lock ├── config ├── app.php ├── auth.php ├── broadcasting.php ├── cache.php ├── chunk-upload.php ├── cors.php ├── database.php ├── filesystems.php ├── hashing.php ├── logging.php ├── mail.php ├── permission.php ├── queue.php ├── sanctum.php ├── services.php ├── session.php └── view.php ├── database ├── .gitignore ├── factories │ └── UserFactory.php ├── migrations │ ├── 2014_10_12_000000_create_users_table.php │ ├── 2014_10_12_100000_create_password_resets_table.php │ ├── 2018_09_08_054426_create_files_table.php │ ├── 2019_01_01_054038_create_tags_table.php │ ├── 2019_01_01_054558_create_taggables_table.php │ ├── 2019_01_08_134334_file_user.php │ ├── 2019_01_15_093426_create_shareable_links_table.php │ ├── 2019_08_19_000000_create_failed_jobs_table.php │ ├── 2019_12_14_000001_create_personal_access_tokens_table.php │ └── 2022_07_06_135110_create_permission_tables.php └── seeders │ ├── DatabaseSeeder.php │ └── UserSeeder.php ├── doc └── screenshort │ ├── mydrive-page.png │ ├── sharewithme-page.png │ ├── trash-pge.png │ └── users-page.png ├── lang └── en │ ├── auth.php │ ├── pagination.php │ ├── passwords.php │ └── validation.php ├── package-lock.json ├── package.json ├── phpunit.xml ├── postcss.config.js ├── public ├── .htaccess ├── favicon.ico ├── index.php └── robots.txt ├── resources ├── css │ └── app.css ├── js │ ├── Components │ │ ├── App.vue │ │ ├── Dashboard │ │ │ ├── Dashboard.vue │ │ │ ├── Widgets │ │ │ │ └── Count.vue │ │ │ └── route.js │ │ ├── Layout │ │ │ ├── FavoriteFolders.vue │ │ │ ├── Layout.vue │ │ │ ├── MenuItems.vue │ │ │ ├── UserInfo.vue │ │ │ └── index.js │ │ ├── MyDrive │ │ │ ├── ContextMenu.vue │ │ │ ├── FileUploader.vue │ │ │ ├── MediaInfo.vue │ │ │ ├── MoveTo.vue │ │ │ ├── MyDrive.vue │ │ │ ├── NewFolderForm.vue │ │ │ ├── Preview.vue │ │ │ ├── RecursiveFolder.vue │ │ │ ├── RenameFile.vue │ │ │ ├── ShareFile.vue │ │ │ ├── ShareLink.vue │ │ │ ├── SharedWithMe.vue │ │ │ ├── Stared.vue │ │ │ ├── Trash.vue │ │ │ ├── mediaItem.vue │ │ │ ├── mediaToolbar.vue │ │ │ ├── mixin.js │ │ │ ├── route.js │ │ │ └── store.js │ │ ├── Translation │ │ │ ├── Languages.vue │ │ │ ├── NewLanguage.vue │ │ │ ├── NewTranslation.vue │ │ │ ├── Translation.vue │ │ │ ├── TranslationInput.vue │ │ │ ├── Translations.vue │ │ │ ├── route.js │ │ │ └── store.js │ │ ├── Users │ │ │ ├── Permissions.vue │ │ │ ├── Profile.vue │ │ │ ├── Role.vue │ │ │ ├── RoleForm.vue │ │ │ ├── Roles.vue │ │ │ ├── UserForm.vue │ │ │ ├── Users.vue │ │ │ ├── UsersTable.vue │ │ │ ├── route.js │ │ │ └── store.js │ │ ├── dropzone │ │ │ ├── dropzone.vue │ │ │ ├── index.js │ │ │ └── services.js │ │ └── passport │ │ │ ├── AuthorizedClients.vue │ │ │ ├── Clients.vue │ │ │ └── PersonalAccessTokens.vue │ ├── Vuetify.js │ ├── app.js │ ├── bootstrap.js │ ├── plugins │ │ ├── auth.js │ │ ├── mixin.js │ │ └── panzoom.js │ ├── router │ │ └── index.js │ └── store │ │ └── index.js └── views │ ├── auth │ ├── confirm-password.blade.php │ ├── forgot-password.blade.php │ ├── login.blade.php │ ├── register.blade.php │ ├── reset-password.blade.php │ └── verify-email.blade.php │ ├── components │ ├── application-logo.blade.php │ ├── auth-card.blade.php │ ├── auth-session-status.blade.php │ ├── auth-validation-errors.blade.php │ ├── button.blade.php │ ├── dropdown-link.blade.php │ ├── dropdown.blade.php │ ├── input.blade.php │ ├── label.blade.php │ ├── nav-link.blade.php │ └── responsive-nav-link.blade.php │ ├── dashboard.blade.php │ ├── drive │ └── index.blade.php │ ├── home.blade.php │ ├── layouts │ ├── app.blade.php │ ├── guest.blade.php │ └── navigation.blade.php │ ├── sharedfiles.blade.php │ └── welcome.blade.php ├── routes ├── api.php ├── auth.php ├── channels.php ├── console.php └── web.php ├── storage ├── app │ ├── .gitignore │ └── public │ │ └── .gitignore ├── framework │ ├── .gitignore │ ├── cache │ │ ├── .gitignore │ │ └── data │ │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ ├── testing │ │ └── .gitignore │ └── views │ │ └── .gitignore └── logs │ └── .gitignore ├── tailwind.config.js ├── tests ├── CreatesApplication.php ├── Feature │ ├── Auth │ │ ├── AuthenticationTest.php │ │ ├── EmailVerificationTest.php │ │ ├── PasswordConfirmationTest.php │ │ ├── PasswordResetTest.php │ │ └── RegistrationTest.php │ └── ExampleTest.php ├── TestCase.php └── Unit │ └── ExampleTest.php └── vite.config.js /.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 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=file 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_HOST= 50 | PUSHER_PORT=443 51 | PUSHER_SCHEME=https 52 | PUSHER_APP_CLUSTER=mt1 53 | 54 | VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 55 | VITE_PUSHER_HOST="${PUSHER_HOST}" 56 | VITE_PUSHER_PORT="${PUSHER_PORT}" 57 | VITE_PUSHER_SCHEME="${PUSHER_SCHEME}" 58 | VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 59 | -------------------------------------------------------------------------------- /.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/build 3 | /public/hot 4 | /public/storage 5 | /storage/*.key 6 | /vendor 7 | .env 8 | .env.backup 9 | .phpunit.result.cache 10 | Homestead.json 11 | Homestead.yaml 12 | npm-debug.log 13 | yarn-error.log 14 | /.idea 15 | /.vscode 16 | /.cache 17 | /.npm 18 | /.local 19 | /.config 20 | -------------------------------------------------------------------------------- /.styleci.yml: -------------------------------------------------------------------------------- 1 | php: 2 | preset: laravel 3 | disabled: 4 | - no_unused_imports 5 | finder: 6 | not-name: 7 | - index.php 8 | js: 9 | finder: 10 | not-name: 11 | - vite.config.js 12 | css: true 13 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribution or overriding 2 | Are welcome. To add a new feature just add a new Handler (which extends AbstractHandler). Then implement the chunk 3 | upload and progress. 4 | 5 | 1. Fork the project. 6 | 2. Create your bugfix/feature branch and write your (try well-commented) code. 7 | 3. Commit your changes (and your tests) and push to your branch. 8 | 4. Create a new pull request against this package's `master` branch. 9 | 10 | ## Pull Requests 11 | 12 | - **Use the [PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md).** 13 | The easiest way to apply the conventions is to use `composer run lint:fix`. 14 | 15 | - **Consider our release cycle.** We try to follow [SemVer v2.0.0](http://semver.org/). 16 | 17 | - **Document any change in behaviour.** Make sure the `README.md` and any other relevant 18 | documentation are kept up-to-date. 19 | 20 | - **Create feature branches.** Don't ask us to pull from your master branch. 21 | 22 | - **One pull request per feature.** If you want to do more than one thing, send multiple pull requests. 23 | 24 | ### Before pull-request do: 25 | 26 | 1. Rebase your changes on master branch 27 | 2. Lint project `composer run lint` 28 | 3. Run tests `composer run test` 29 | 4. (recommended) Write tests 30 | 5. (optinal) Rebase your commits to fewer commits 31 | 32 | **Thank you!** 33 | -------------------------------------------------------------------------------- /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 | , \Psr\Log\LogLevel::*> 14 | */ 15 | protected $levels = [ 16 | // 17 | ]; 18 | 19 | /** 20 | * A list of the exception types that are not reported. 21 | * 22 | * @var array> 23 | */ 24 | protected $dontReport = [ 25 | // 26 | ]; 27 | 28 | /** 29 | * A list of the inputs that are never flashed to the session on validation exceptions. 30 | * 31 | * @var array 32 | */ 33 | protected $dontFlash = [ 34 | 'current_password', 35 | 'password', 36 | 'password_confirmation', 37 | ]; 38 | 39 | /** 40 | * Register the exception handling callbacks for the application. 41 | * 42 | * @return void 43 | */ 44 | public function register() 45 | { 46 | $this->reportable(function (Throwable $e) { 47 | // 48 | }); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/Http/Controllers/API/V1/DownloadController.php: -------------------------------------------------------------------------------- 1 | request = $request; 31 | $this->file = $file; 32 | 33 | $this->downloadResponse = $downloadResponse; 34 | } 35 | 36 | public function download(Request $request) 37 | { 38 | $ids = $request->get('ids'); 39 | 40 | if (sizeof($ids) > 1) { 41 | return $this->downloadResponse->multipleDownload($ids); 42 | } else { 43 | return $this->downloadResponse->singleDownload($ids[0]); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/Http/Controllers/API/V1/FolderController.php: -------------------------------------------------------------------------------- 1 | validated(); 31 | 32 | $data = $request->only(['name', 'description', 'parent_id']); 33 | $data['parent_id'] = isset($data['parent_id']) ? intval($data['parent_id']) : 0; 34 | $data['file_name'] = $data['name']; 35 | 36 | 37 | $folder = Folder::create($data); 38 | $folder->generatePath(); 39 | 40 | return new JsonResource($folder); 41 | } 42 | 43 | /** 44 | * Update the specified resource in storage. 45 | * 46 | * @param $request 47 | * @param int $id 48 | * @return \Illuminate\Http\Response 49 | */ 50 | public function update(FolderRequest $request, Folder $folder) 51 | { 52 | $validated = $request->validated(); 53 | $data = $request->only(['name', 'description']); 54 | $data['file_name'] = $data['name']; 55 | $folder->fill($data); 56 | $folder->save(); 57 | 58 | return new JsonResource($folder); 59 | } 60 | 61 | /** 62 | * Remove the specified resource from storage. 63 | * 64 | * @param int $id 65 | * @return \Illuminate\Http\Response 66 | */ 67 | public function destroy(Folder $folder) 68 | { 69 | $folder->delete(); 70 | return response()->json(['message'=> "Folder deleted successfully."]); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/Http/Controllers/API/V1/MoveFileController.php: -------------------------------------------------------------------------------- 1 | validate($request, [ 16 | 'files' => 'required|array|min:1|', 17 | 'files.*' => 'required|integer', 18 | 'destination' => 'nullable|integer|exists:files,id' 19 | ]); 20 | 21 | $files = collect($request->get('files')); 22 | $destination = $request->get('destination'); 23 | 24 | $entries = $this->getFiles($files); 25 | $newParent = $this->getNewParent($destination); 26 | $entries = $this->removeInvalidEntries($entries, $newParent); 27 | 28 | //there was an issue with entries or parent, bail 29 | if ($entries->isEmpty()) { 30 | return $this->errorWrongArgs(); 31 | } 32 | 33 | if ($this->updateParent($destination, $entries)) { 34 | $entries = $this->getFiles($entries->pluck('id')); 35 | } 36 | 37 | 38 | return JsonResource::collection($entries); 39 | } 40 | 41 | 42 | 43 | /** 44 | * Make sure entries can't be moved into themselves or their children. 45 | * 46 | * @param Collection $entries 47 | * @param int|'root' $parent 48 | * @return Collection 49 | */ 50 | private function removeInvalidEntries(Collection $entries, $parent) 51 | { 52 | if (! $parent) { 53 | return $entries; 54 | } 55 | 56 | return $entries->filter(function ($entry) use ($parent) { 57 | return ! Str::contains($parent->path, $entry->id); 58 | }); 59 | } 60 | 61 | /** 62 | * @param int|null $destination 63 | * @return FileEntry|null 64 | */ 65 | private function getNewParent($destination) 66 | { 67 | if (! $destination) { 68 | return null; 69 | } 70 | return File::select('path', 'id')->find($destination); 71 | } 72 | 73 | /** 74 | * @param Collection $entryIds 75 | * @return Collection 76 | */ 77 | private function getFiles($ids) 78 | { 79 | return File::whereIn('id', $ids)->get(); 80 | } 81 | 82 | /** 83 | * @param int|null $destination 84 | * @param Collection $ids 85 | */ 86 | private function updateParent($destination, Collection $files) 87 | { 88 | if (!$destination) { 89 | $destination = 0; 90 | } 91 | return File::whereIn('id', $files->pluck('id')) 92 | ->update(['parent_id' => $destination]); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /app/Http/Controllers/API/V1/StarredController.php: -------------------------------------------------------------------------------- 1 | request = $request; 31 | $this->tag = $tag; 32 | } 33 | 34 | public function index(Request $request) 35 | { 36 | $per_page = 20; 37 | 38 | $tag = $this->tag->where('name', self::TAG_NAME)->first(); 39 | 40 | if (!$tag) { 41 | $tag = $this->createStarTag(); 42 | } 43 | $files = $tag->files()->wherePivot('user_id', \Auth::id())->paginate($per_page); 44 | 45 | return JsonResource::collection($files); 46 | } 47 | 48 | /** 49 | * Attach "starred" tag to specified entries. 50 | * 51 | * @return \Illuminate\Http\JsonResponse 52 | * @throws \Illuminate\Auth\Access\AuthorizationException 53 | */ 54 | public function add() 55 | { 56 | $ids = $this->request->get('ids'); 57 | 58 | $this->validate($this->request, [ 59 | 'ids' => 'required|array|exists:files,id' 60 | ]); 61 | 62 | $tag = $this->tag->where('name', self::TAG_NAME)->first(); 63 | 64 | if (!$tag) { 65 | $tag = $this->createStarTag(); 66 | } 67 | 68 | $tag->attachFile($ids, $this->request->user()->id); 69 | 70 | return $this->respondWithMessage("Successfully added to stared."); 71 | } 72 | 73 | /** 74 | * Detach "starred" tag from specified entries. 75 | * 76 | * @return \Illuminate\Http\JsonResponse 77 | * @throws \Illuminate\Auth\Access\AuthorizationException 78 | */ 79 | public function remove() 80 | { 81 | $ids = $this->request->get('ids'); 82 | 83 | $this->validate($this->request, [ 84 | 'ids' => 'required|array|exists:files,id' 85 | ]); 86 | 87 | 88 | $tag = $this->tag->where('name', self::TAG_NAME)->first(); 89 | 90 | $tag->detachFile($ids, $this->request->user()->id); 91 | 92 | return $this->respondWithMessage("Successfully remove from stared."); 93 | } 94 | 95 | protected function createStarTag() 96 | { 97 | $tag = Tag::firstOrCreate([ 98 | 'name' => self::TAG_NAME, 99 | 'description' => 'Stared file for quick access', 100 | 'type' => 'custom', 101 | ]); 102 | 103 | return $tag; 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/AuthenticatedSessionController.php: -------------------------------------------------------------------------------- 1 | authenticate(); 32 | 33 | $request->session()->regenerate(); 34 | 35 | return redirect()->intended(RouteServiceProvider::HOME); 36 | } 37 | 38 | /** 39 | * Destroy an authenticated session. 40 | * 41 | * @param \Illuminate\Http\Request $request 42 | * @return \Illuminate\Http\RedirectResponse 43 | */ 44 | public function destroy(Request $request) 45 | { 46 | Auth::guard('web')->logout(); 47 | 48 | $request->session()->invalidate(); 49 | 50 | $request->session()->regenerateToken(); 51 | 52 | return redirect('/'); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ConfirmablePasswordController.php: -------------------------------------------------------------------------------- 1 | validate([ 32 | 'email' => $request->user()->email, 33 | 'password' => $request->password, 34 | ])) { 35 | throw ValidationException::withMessages([ 36 | 'password' => __('auth.password'), 37 | ]); 38 | } 39 | 40 | $request->session()->put('auth.password_confirmed_at', time()); 41 | 42 | return redirect()->intended(RouteServiceProvider::HOME); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/EmailVerificationNotificationController.php: -------------------------------------------------------------------------------- 1 | user()->hasVerifiedEmail()) { 20 | return redirect()->intended(RouteServiceProvider::HOME); 21 | } 22 | 23 | $request->user()->sendEmailVerificationNotification(); 24 | 25 | return back()->with('status', 'verification-link-sent'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/EmailVerificationPromptController.php: -------------------------------------------------------------------------------- 1 | user()->hasVerifiedEmail() 20 | ? redirect()->intended(RouteServiceProvider::HOME) 21 | : view('auth.verify-email'); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/NewPasswordController.php: -------------------------------------------------------------------------------- 1 | $request]); 24 | } 25 | 26 | /** 27 | * Handle an incoming new password request. 28 | * 29 | * @param \Illuminate\Http\Request $request 30 | * @return \Illuminate\Http\RedirectResponse 31 | * 32 | * @throws \Illuminate\Validation\ValidationException 33 | */ 34 | public function store(Request $request) 35 | { 36 | $request->validate([ 37 | 'token' => ['required'], 38 | 'email' => ['required', 'email'], 39 | 'password' => ['required', 'confirmed', Rules\Password::defaults()], 40 | ]); 41 | 42 | // Here we will attempt to reset the user's password. If it is successful we 43 | // will update the password on an actual user model and persist it to the 44 | // database. Otherwise we will parse the error and return the response. 45 | $status = Password::reset( 46 | $request->only('email', 'password', 'password_confirmation', 'token'), 47 | function ($user) use ($request) { 48 | $user->forceFill([ 49 | 'password' => Hash::make($request->password), 50 | 'remember_token' => Str::random(60), 51 | ])->save(); 52 | 53 | event(new PasswordReset($user)); 54 | } 55 | ); 56 | 57 | // If the password was successfully reset, we will redirect the user back to 58 | // the application's home authenticated view. If there is an error we can 59 | // redirect them back to where they came from with their error message. 60 | return $status == Password::PASSWORD_RESET 61 | ? redirect()->route('login')->with('status', __($status)) 62 | : back()->withInput($request->only('email')) 63 | ->withErrors(['email' => __($status)]); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/PasswordResetLinkController.php: -------------------------------------------------------------------------------- 1 | validate([ 32 | 'email' => ['required', 'email'], 33 | ]); 34 | 35 | // We will send the password reset link to this user. Once we have attempted 36 | // to send the link, we will examine the response then see the message we 37 | // need to show to the user. Finally, we'll send out a proper response. 38 | $status = Password::sendResetLink( 39 | $request->only('email') 40 | ); 41 | 42 | return $status == Password::RESET_LINK_SENT 43 | ? back()->with('status', __($status)) 44 | : back()->withInput($request->only('email')) 45 | ->withErrors(['email' => __($status)]); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/RegisteredUserController.php: -------------------------------------------------------------------------------- 1 | validate([ 37 | 'name' => ['required', 'string', 'max:255'], 38 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 39 | 'password' => ['required', 'confirmed', Rules\Password::defaults()], 40 | ]); 41 | 42 | $user = User::create([ 43 | 'name' => $request->name, 44 | 'email' => $request->email, 45 | 'password' => Hash::make($request->password), 46 | ]); 47 | 48 | event(new Registered($user)); 49 | 50 | Auth::login($user); 51 | 52 | return redirect(RouteServiceProvider::HOME); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/VerifyEmailController.php: -------------------------------------------------------------------------------- 1 | user()->hasVerifiedEmail()) { 21 | return redirect()->intended(RouteServiceProvider::HOME.'?verified=1'); 22 | } 23 | 24 | if ($request->user()->markEmailAsVerified()) { 25 | event(new Verified($request->user())); 26 | } 27 | 28 | return redirect()->intended(RouteServiceProvider::HOME.'?verified=1'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 17 | } 18 | 19 | /** 20 | * Show the application dashboard. 21 | * 22 | * @return \Illuminate\Http\Response 23 | */ 24 | public function index() 25 | { 26 | return view('home'); 27 | } 28 | 29 | public function drive() { 30 | return view('drive.index'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Http/Controllers/ShareableController.php: -------------------------------------------------------------------------------- 1 | translation = $translation; 18 | } 19 | 20 | public function index(Request $request) 21 | { 22 | $languages = $this->translation->allLanguages(); 23 | 24 | return new JsonResource($languages); 25 | } 26 | 27 | public function create() 28 | { 29 | return view('translation::languages.create'); 30 | } 31 | 32 | public function store(LanguageRequest $request) 33 | { 34 | $this->translation->addLanguage($request->locale, $request->name); 35 | return response()->json(['success' => true,]); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/Http/Controllers/UploadController.php: -------------------------------------------------------------------------------- 1 | first(); 16 | 17 | return $fileResponse->create($entry); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/Http/Kernel.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 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 37 | \App\Http\Middleware\VerifyCsrfToken::class, 38 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 39 | ], 40 | 41 | 'api' => [ 42 | \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, 43 | 'throttle:api', 44 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 45 | ], 46 | ]; 47 | 48 | /** 49 | * The application's route middleware. 50 | * 51 | * These middleware may be assigned to groups or used individually. 52 | * 53 | * @var array 54 | */ 55 | protected $routeMiddleware = [ 56 | 'auth' => \App\Http\Middleware\Authenticate::class, 57 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 58 | 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::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 | ]; 67 | } 68 | -------------------------------------------------------------------------------- /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/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/Http/Requests/Auth/LoginRequest.php: -------------------------------------------------------------------------------- 1 | ['required', 'string', 'email'], 33 | 'password' => ['required', 'string'], 34 | ]; 35 | } 36 | 37 | /** 38 | * Attempt to authenticate the request's credentials. 39 | * 40 | * @return void 41 | * 42 | * @throws \Illuminate\Validation\ValidationException 43 | */ 44 | public function authenticate() 45 | { 46 | $this->ensureIsNotRateLimited(); 47 | 48 | if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) { 49 | RateLimiter::hit($this->throttleKey()); 50 | 51 | throw ValidationException::withMessages([ 52 | 'email' => trans('auth.failed'), 53 | ]); 54 | } 55 | 56 | RateLimiter::clear($this->throttleKey()); 57 | } 58 | 59 | /** 60 | * Ensure the login request is not rate limited. 61 | * 62 | * @return void 63 | * 64 | * @throws \Illuminate\Validation\ValidationException 65 | */ 66 | public function ensureIsNotRateLimited() 67 | { 68 | if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) { 69 | return; 70 | } 71 | 72 | event(new Lockout($this)); 73 | 74 | $seconds = RateLimiter::availableIn($this->throttleKey()); 75 | 76 | throw ValidationException::withMessages([ 77 | 'email' => trans('auth.throttle', [ 78 | 'seconds' => $seconds, 79 | 'minutes' => ceil($seconds / 60), 80 | ]), 81 | ]); 82 | } 83 | 84 | /** 85 | * Get the rate limiting throttle key for the request. 86 | * 87 | * @return string 88 | */ 89 | public function throttleKey() 90 | { 91 | return Str::lower($this->input('email')).'|'.$this->ip(); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /app/Http/Requests/FileRequest.php: -------------------------------------------------------------------------------- 1 | input('id'); 27 | 28 | $rules = [ 29 | 'name' => "string|max:255|nullable", 30 | 'description' => "string|min:2|max:255|nullable", 31 | ]; 32 | 33 | // if ($this->method() === 'POST') { 34 | // $rules['name'] = 'required|'.$rules['name']; 35 | // } 36 | 37 | return $rules; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/Http/Requests/FolderRequest.php: -------------------------------------------------------------------------------- 1 | input('id'); 27 | 28 | $rules = [ 29 | 'name' => "string|max:255", 30 | 'description' => "string|min:2|max:255|nullable", 31 | ]; 32 | 33 | if ($this->method() === 'POST') { 34 | $rules['name'] = 'required|'.$rules['name']; 35 | } 36 | 37 | return $rules; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/Http/Requests/RoleRequest.php: -------------------------------------------------------------------------------- 1 | input('id'); 27 | 28 | $rules = [ 29 | 'name' => "alpha|max:255|unique:roles,name,$roleId", 30 | 'permissions' => "array", 31 | 'description' => "string|min:2|max:255|nullable", 32 | ]; 33 | 34 | if ($this->method() === 'POST') { 35 | $rules['name'] = 'required|'.$rules['name']; 36 | } 37 | 38 | return $rules; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/Http/Requests/UserRequest.php: -------------------------------------------------------------------------------- 1 | input('id'); 27 | 28 | $rules = [ 29 | 'firstname' => 'alpha|min:2|max:255|nullable', 30 | 'lastname' => 'alpha|min:2|max:255|nullable', 31 | 'permissions' => 'array|nullable', 32 | 'roles' => 'array|nullable', 33 | 'password' => 'min:6|max:255|confirmed', 34 | 'name' => "min:3|max:255|unique:users,name,$userId", 35 | 'email' => "email|min:3|max:255|unique:users,email,$userId" 36 | ]; 37 | 38 | if ($this->method() === 'POST') { 39 | $rules['email'] = 'required|'.$rules['email']; 40 | $rules['name'] = 'required|'.$rules['name']; 41 | $rules['password'] = 'required|'.$rules['password']; 42 | } 43 | 44 | return $rules; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/Jobs/UploadToCloud.php: -------------------------------------------------------------------------------- 1 | file = $file; 33 | } 34 | 35 | /** 36 | * Execute the job. 37 | */ 38 | public function handle() 39 | { 40 | $disk = config('filesystems.cloud'); 41 | // is already uploaded 42 | if ($this->file->driver == $disk) { 43 | return; 44 | } 45 | 46 | $path = storage_path('app/uploads/'); 47 | $public = 'public'; 48 | 49 | $localfiles = Storage::disk('local')->allFiles($this->file->file_name); 50 | 51 | foreach ($localfiles as $lfile) { 52 | Storage::disk($disk)->putFileAs($this->file->file_name, new FileAdapdar("{$path}/{$lfile}"), $this->file->name, $public); 53 | } 54 | // save to path; 55 | $this->file->updatePublicPaths($disk); 56 | 57 | // wait 5 second to delete directorr so all local request is complete and new request to cloud 58 | sleep(5); 59 | Storage::disk('local')->deleteDirectory($this->file->file_name); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app/Models/Folder.php: -------------------------------------------------------------------------------- 1 | 'integer', 37 | 'file_size' => 'integer', 38 | 'parent_id' => 'integer' 39 | ]; 40 | 41 | protected $attributes = ['type' => 'folder']; 42 | 43 | protected $appends = [ 44 | 'hash', 45 | 'stared' 46 | ]; 47 | 48 | public function newQuery($except_deleted = true) 49 | { 50 | return parent::newQuery($except_deleted)->where('type', '=', 'folder')->stared(); 51 | } 52 | /** 53 | * Bootstrap any application services. 54 | * 55 | * @return void 56 | */ 57 | public static function boot() 58 | { 59 | parent::boot(); 60 | Folder::observe(FolderObserver::class); 61 | } 62 | /** 63 | * @return \Illuminate\Database\Eloquent\Relations\HasMany 64 | */ 65 | public function children() 66 | { 67 | return $this->hasMany(static::class, 'parent_id')->withoutGlobalScope('fsType'); 68 | } 69 | 70 | /** 71 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo 72 | */ 73 | public function parent() 74 | { 75 | return $this->belongsTo(static::class, 'parent_id'); 76 | } 77 | 78 | public function tags() 79 | { 80 | return $this->belongsToMany('App\Tag', 'taggables', 'taggable_id', 'tag_id'); 81 | } 82 | 83 | public function getStaredAttribute() 84 | { 85 | return !empty($this->attributes['stared']); 86 | } 87 | 88 | public function scopeStared($query) 89 | { 90 | return $query->addSelect(['stared' => function ($query) { 91 | $query->select('name') 92 | ->from('tags') 93 | ->join('taggables', 'tags.id', '=', 'taggables.tag_id') 94 | ->whereColumn('taggables.taggable_id', 'files.id') 95 | ->limit(1); 96 | }]); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /app/Models/Observers/FileObserver.php: -------------------------------------------------------------------------------- 1 | uploaded_by = $id; 20 | } 21 | 22 | /** 23 | * Handle the File "updated" event. 24 | * 25 | * @param \App\File $file 26 | * @return void 27 | */ 28 | public function updated(File $file) 29 | { 30 | // 31 | } 32 | 33 | /** 34 | * Handle the File "deleted" event. 35 | * 36 | * @param \App\File $file 37 | * @return void 38 | */ 39 | public function deleting(File $file) 40 | { 41 | $id = Auth::id(); 42 | $file->deleted_by = $id; 43 | } 44 | 45 | /** 46 | * Handle the File "restored" event. 47 | * 48 | * @param \App\File $file 49 | * @return void 50 | */ 51 | public function restored(File $file) 52 | { 53 | // 54 | } 55 | 56 | /** 57 | * Handle the File "force deleted" event. 58 | * 59 | * @param \App\File $file 60 | * @return void 61 | */ 62 | public function forceDeleted(File $file) 63 | { 64 | // 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /app/Models/Observers/FolderObserver.php: -------------------------------------------------------------------------------- 1 | uploaded_by = $id; 20 | } 21 | 22 | /** 23 | * Handle the Folder "updated" event. 24 | * 25 | * @param \App\Folder $folder 26 | * @return void 27 | */ 28 | public function updated(Folder $folder) 29 | { 30 | // 31 | } 32 | 33 | /** 34 | * Handle the Folder "deleted" event. 35 | * 36 | * @param \App\Folder $folder 37 | * @return void 38 | */ 39 | public function deleting(Folder $folder) 40 | { 41 | $id = Auth::id(); 42 | $folder->uploaded_by = $id; 43 | } 44 | 45 | /** 46 | * Handle the Folder "restored" event. 47 | * 48 | * @param \App\Folder $folder 49 | * @return void 50 | */ 51 | public function restored(Folder $folder) 52 | { 53 | // 54 | } 55 | 56 | /** 57 | * Handle the Folder "force deleted" event. 58 | * 59 | * @param \App\Folder $folder 60 | * @return void 61 | */ 62 | public function forceDeleted(Folder $folder) 63 | { 64 | // 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /app/Models/Role.php: -------------------------------------------------------------------------------- 1 | 'integer', 28 | 'allow_download' => 'boolean', 29 | 'allow_edit' => 'boolean' 30 | ]; 31 | 32 | protected $hidden = [ 33 | 'password', 'expires_at', 'hash', 'user_id', 'file_id' 34 | ]; 35 | 36 | protected $appends = [ 37 | 'link' 38 | ]; 39 | 40 | 41 | public function file() 42 | { 43 | return $this->belongsTo(File::class); 44 | } 45 | 46 | public function getLinkAttribute() 47 | { 48 | return route('shareable', [ 'hash' => $this->hash]); 49 | } 50 | 51 | 52 | /** 53 | * @param string $value 54 | */ 55 | public function setHashAttribute($value) 56 | { 57 | $this->attributes['hash'] = $value ? $value : Str::random(30); 58 | } 59 | 60 | /** 61 | * @param string $value 62 | */ 63 | public function setExpiresAtAttribute($value) 64 | { 65 | $this->attributes['expires_at'] = Carbon::parse($value); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /app/Models/Tag.php: -------------------------------------------------------------------------------- 1 | morphedByMany('App\File', 'taggable'); 26 | } 27 | 28 | /** 29 | * @param array $ids 30 | * @param null|int $userId 31 | */ 32 | public function attachFile($ids, $userId = null) 33 | { 34 | if ($userId) { 35 | $ids = collect($ids)->mapWithKeys(function ($id) use ($userId) { 36 | return [$id => ['user_id' => $userId]]; 37 | }); 38 | } 39 | 40 | $this->files()->syncWithoutDetaching($ids); 41 | } 42 | 43 | /** 44 | * @param array $ids 45 | * @param null|int $userId 46 | */ 47 | public function detachFile($ids, $userId = null) 48 | { 49 | $query = $this->files(); 50 | 51 | if ($userId) { 52 | $query->wherePivot('user_id', $userId); 53 | } 54 | 55 | $query->detach($ids); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /app/Models/Tagable.php: -------------------------------------------------------------------------------- 1 | decodePathId($part); 19 | }, array_filter($parts)); 20 | 21 | return implode('/', $parts); 22 | } 23 | 24 | public function setPathAttribute($value) 25 | { 26 | if (! $value) { 27 | $value = ''; 28 | } 29 | 30 | $this->attributes['path'] = $this->encodePath($value); 31 | } 32 | 33 | /** 34 | * @param string $oldPath 35 | * @param string $newPath 36 | * @param null $entryIds 37 | */ 38 | public function updatePaths($oldPath, $newPath, $entryIds = null) 39 | { 40 | $oldPath = $this->encodePath($oldPath); 41 | $newPath = $this->encodePath($newPath); 42 | 43 | $query = $this->newQuery(); 44 | 45 | if ($entryIds) { 46 | $query->whereIn('id', $entryIds); 47 | } 48 | 49 | $query->where('path', 'LIKE', "$oldPath%") 50 | ->update(['path' => DB::raw("REPLACE(path, '$oldPath', '$newPath')")]); 51 | } 52 | 53 | /** 54 | * Get all children of current entry. 55 | * 56 | * @return \Illuminate\Support\Collection 57 | */ 58 | public function findChildren() 59 | { 60 | if (! $this->exists) { 61 | return collect(); 62 | } 63 | 64 | return $this->where('path', 'like', $this->attributes['path'].'%')->get(); 65 | } 66 | 67 | /** 68 | * Generate full path for current entry, based on its parent. 69 | */ 70 | public function generatePath() 71 | { 72 | if (! $this->exists) { 73 | return; 74 | } 75 | 76 | $this->path = $this->id; 77 | 78 | if ($this->parent) { 79 | $parent = $this->find($this->parent_id); 80 | $this->path = "{$parent->path}/$this->path"; 81 | } 82 | 83 | $this->save(); 84 | } 85 | 86 | private function encodePath($path) 87 | { 88 | $parts = explode('/', (string) $path); 89 | 90 | $parts = array_filter($parts); 91 | 92 | $parts = array_map(function ($part) { 93 | return $this->encodePathId($part); 94 | }, $parts); 95 | 96 | return implode('/', $parts); 97 | } 98 | 99 | private function encodePathId($id) 100 | { 101 | return base_convert($id, 10, 36); 102 | } 103 | 104 | private function decodePathId($id) 105 | { 106 | return base_convert($id, 36, 10); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /app/Models/Traits/HashesId.php: -------------------------------------------------------------------------------- 1 | getOriginal('id').'|', 10, 'padding')), '='); 12 | } 13 | 14 | public function scopeWhereHash(Builder $query, $value) 15 | { 16 | $id = $this->decodeHash($value); 17 | return $query->where('id', $id); 18 | } 19 | 20 | public static function decodeHash($hash) 21 | { 22 | if ((int) $hash !== 0) { 23 | return $hash; 24 | } 25 | return (int) explode('|', base64_decode($hash))[0]; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/Models/User.php: -------------------------------------------------------------------------------- 1 | 20 | */ 21 | protected $fillable = [ 22 | 'name', 23 | 'email', 24 | 'password', 25 | ]; 26 | 27 | /** 28 | * The attributes that should be hidden for serialization. 29 | * 30 | * @var array 31 | */ 32 | protected $hidden = [ 33 | 'password', 34 | 'remember_token', 35 | ]; 36 | 37 | /** 38 | * The attributes that should be cast. 39 | * 40 | * @var array 41 | */ 42 | protected $casts = [ 43 | 'email_verified_at' => 'datetime', 44 | ]; 45 | } 46 | -------------------------------------------------------------------------------- /app/Models/UserMeta.php: -------------------------------------------------------------------------------- 1 | belongsTo('App\User'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/Policies/RolePolicy.php: -------------------------------------------------------------------------------- 1 | hasPermission('administrator')) { 15 | return true; 16 | } 17 | } 18 | /** 19 | * Determine whether the user can view the role. 20 | * 21 | * @param \App\Models\User $user 22 | * @param \App\Models\Role $role 23 | * @return mixed 24 | */ 25 | public function view(User $user) 26 | { 27 | return $user->hasPermission('role.view'); 28 | } 29 | 30 | /** 31 | * Determine whether the user can create roles. 32 | * 33 | * @param \App\Models\User $user 34 | * @return mixed 35 | */ 36 | public function create(User $user) 37 | { 38 | return $user->hasPermission('role.create'); 39 | } 40 | 41 | /** 42 | * Determine whether the user can update the role. 43 | * 44 | * @param \App\Models\User $user 45 | * @param \App\Models\Role $role 46 | * @return mixed 47 | */ 48 | public function update(User $user, Role $role) 49 | { 50 | return $user->hasPermission('role.update'); 51 | } 52 | 53 | /** 54 | * Determine whether the user can delete the role. 55 | * 56 | * @param \App\Models\User $user 57 | * @param \App\Models\Role $role 58 | * @return mixed 59 | */ 60 | public function delete(User $user, Role $role) 61 | { 62 | return $user->hasPermission('role.delete'); 63 | } 64 | 65 | /** 66 | * Determine whether the user can restore the role. 67 | * 68 | * @param \App\Models\User $user 69 | * @param \App\Models\Role $role 70 | * @return mixed 71 | */ 72 | public function restore(User $user, Role $role) 73 | { 74 | return $user->hasPermission('role.restore'); 75 | } 76 | 77 | /** 78 | * Determine whether the user can permanently delete the role. 79 | * 80 | * @param \App\Models\User $user 81 | * @param \App\Models\Role $role 82 | * @return mixed 83 | */ 84 | public function forceDelete(User $user, Role $role) 85 | { 86 | return $user->hasPermission('role.forceDelete'); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /app/Policies/UserPolicy.php: -------------------------------------------------------------------------------- 1 | hasPermission('administrator')) { 15 | return true; 16 | } 17 | } 18 | 19 | /** 20 | * Determine whether the user can view the model. 21 | * 22 | * @param \App\Models\User $user 23 | * @param \App\Models\User $model 24 | * @return mixed 25 | */ 26 | public function view(User $user) 27 | { 28 | return $user->hasPermission('user.view'); 29 | } 30 | 31 | /** 32 | * Determine whether the user can create models. 33 | * 34 | * @param \App\Models\User $user 35 | * @return mixed 36 | */ 37 | public function create(User $user) 38 | { 39 | return $user->hasPermission('user.create'); 40 | } 41 | 42 | /** 43 | * Determine whether the user can update the model. 44 | * 45 | * @param \App\Models\User $user 46 | * @param \App\Models\User $model 47 | * @return mixed 48 | */ 49 | public function update(User $user) 50 | { 51 | return $user->hasPermission('user.update'); 52 | } 53 | 54 | /** 55 | * Determine whether the user can delete the model. 56 | * 57 | * @param \App\Models\User $user 58 | * @param \App\Models\User $model 59 | * @return mixed 60 | */ 61 | public function delete(User $user) 62 | { 63 | return $user->hasPermission('user.delete'); 64 | } 65 | 66 | /** 67 | * Determine whether the user can restore the model. 68 | * 69 | * @param \App\Models\User $user 70 | * @param \App\Models\User $model 71 | * @return mixed 72 | */ 73 | public function restore(User $user) 74 | { 75 | return $user->hasPermission('user.restore'); 76 | } 77 | 78 | /** 79 | * Determine whether the user can permanently delete the model. 80 | * 81 | * @param \App\Models\User $user 82 | * @param \App\Models\User $model 83 | * @return mixed 84 | */ 85 | public function forceDelete(User $user) 86 | { 87 | return $user->hasPermission('user.forceDelete'); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | 15 | */ 16 | protected $policies = [ 17 | \App\Models\Role::class => \App\Policies\RolePolicy::class, 18 | \App\Models\User::class => \App\Policies\UserPolicy::class, 19 | ]; 20 | 21 | /** 22 | * Register any authentication / authorization services. 23 | * 24 | * @return void 25 | */ 26 | public function boot() 27 | { 28 | $this->registerPolicies(); 29 | 30 | // 31 | Gate::before(function ($user, $ability) { 32 | return $user->hasRole(Role::ADMINISTRATOR) ? true : null; 33 | }); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /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/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | configureRateLimiting(); 30 | 31 | $this->routes(function () { 32 | Route::middleware('api') 33 | ->prefix('api') 34 | ->group(base_path('routes/api.php')); 35 | 36 | Route::middleware('web') 37 | ->group(base_path('routes/web.php')); 38 | }); 39 | } 40 | 41 | /** 42 | * Configure the rate limiters for the application. 43 | * 44 | * @return void 45 | */ 46 | protected function configureRateLimiting() 47 | { 48 | RateLimiter::for('api', function (Request $request) { 49 | return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); 50 | }); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/Repositories/RoleRepository.php: -------------------------------------------------------------------------------- 1 | model = $role; 30 | } 31 | 32 | /** 33 | * Get the list of all the user without. 34 | * 35 | * @return mixed 36 | */ 37 | public function getList() 38 | { 39 | return $this->model 40 | ->orderBy('id', 'desc') 41 | ->get(); 42 | } 43 | 44 | /** 45 | * Get the user by title. 46 | * 47 | * @param string $title 48 | * @return mixed 49 | */ 50 | public function getByName($name) 51 | { 52 | return $this->model 53 | ->where('name', $name) 54 | ->first(); 55 | } 56 | 57 | public function getPermissions($id) 58 | { 59 | $this->model = $this->getById($id); 60 | 61 | return $this->model->permissions; 62 | } 63 | 64 | public function attachUser($role_id, $user_id) 65 | { 66 | $this->model = $this->getById($role_id); 67 | 68 | return $this->model->users()->attach($user_id); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /app/Response/AudioVideoResponse.php: -------------------------------------------------------------------------------- 1 | disk); 18 | $size = $disk->size($entry->getStoragePath()); 19 | $time = date('r', $disk->lastModified($entry->getStoragePath())); 20 | $fm = $disk->getDriver()->readStream($entry->getStoragePath()); 21 | $begin = 0; 22 | $end = $size - 1; 23 | 24 | if (isset($_SERVER['HTTP_RANGE'])) 25 | { 26 | if (preg_match('/bytes=\h*(\d+)-(\d*)[\D.*]?/i', $_SERVER['HTTP_RANGE'], $matches)) 27 | { 28 | $begin = intval($matches[1]); 29 | if (!empty($matches[2])) 30 | { 31 | $end = intval($matches[2]); 32 | } 33 | } 34 | } 35 | 36 | if (isset($_SERVER['HTTP_RANGE'])) 37 | { 38 | header('HTTP/1.1 206 Partial Content'); 39 | } 40 | else 41 | { 42 | header('HTTP/1.1 200 OK'); 43 | } 44 | 45 | header("Content-Type: $entry->mime"); 46 | header('Cache-Control: public, must-revalidate, max-age=0'); 47 | header('Pragma: no-cache'); 48 | header('Accept-Ranges: bytes'); 49 | header('Content-Length:' . (($end - $begin) + 1)); 50 | if (isset($_SERVER['HTTP_RANGE'])) 51 | { 52 | header("Content-Range: bytes $begin-$end/$size"); 53 | } 54 | header("Content-Disposition: inline; filename=$entry->file_name"); 55 | header("Content-Transfer-Encoding: binary"); 56 | header("Last-Modified: $time"); 57 | 58 | $cur = $begin; 59 | fseek($fm, $begin, 0); 60 | 61 | while(!feof($fm) && $cur <= $end && (connection_status() == 0)) 62 | { 63 | print fread($fm, min(1024 * 16, ($end - $cur) + 1)); 64 | $cur += 1024 * 16; 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /app/Response/FileContentResponseCreator.php: -------------------------------------------------------------------------------- 1 | imageResponse = $imageResponse; 33 | $this->audioVideoResponse = $audioVideoResponse; 34 | } 35 | 36 | /** 37 | * Return download or preview response for given file. 38 | * 39 | * @param File $upload 40 | * 41 | * @return mixed 42 | */ 43 | public function create(File $upload) 44 | { 45 | if (!Storage::drive($upload->driver)->exists($upload->getStoragePath())) { 46 | abort(404); 47 | } 48 | 49 | list($mime, $type) = $this->getTypeFromModel($upload); 50 | 51 | if ($type === 'image') { 52 | return $this->imageResponse->create($upload); 53 | } elseif ($this->shouldStream($mime, $type)) { 54 | return $this->audioVideoResponse->create($upload); 55 | } else { 56 | return $this->createBasicResponse($upload); 57 | } 58 | } 59 | 60 | /** 61 | * Create a basic response for specified upload content. 62 | * 63 | * @param File $upload 64 | * 65 | * @return Response 66 | */ 67 | private function createBasicResponse(File $upload) 68 | { 69 | return response(Storage::drive($upload->driver)->get($upload->getStoragePath()), 200, ['Content-Type' => $upload->mime]); 70 | } 71 | 72 | /** 73 | * Extract file type from model. 74 | * 75 | * @param File $fileModel 76 | * 77 | * @return array 78 | */ 79 | private function getTypeFromModel(File $fileModel) 80 | { 81 | $mime = $fileModel->mime; 82 | $type = explode('/', $mime)[0]; 83 | 84 | return array($mime, $type); 85 | } 86 | 87 | /** 88 | * Should file with given mime be streamed. 89 | * 90 | * @param string $mime 91 | * @param string $type 92 | * 93 | * @return bool 94 | */ 95 | private function shouldStream($mime, $type) 96 | { 97 | return $type === 'video' || $type === 'audio' || $mime === 'application/ogg'; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /app/Response/ImageResponse.php: -------------------------------------------------------------------------------- 1 | driver)->get($upload->getStoragePath()); 22 | 23 | return response($content, 200, ['Content-Type' => $upload->mime]); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/Services/Shares/DetachUsersFromEntries.php: -------------------------------------------------------------------------------- 1 | whereIn('file_entry_id', $entryIds) 20 | ->whereIn('user_id', $userIds) 21 | ->where('owner', false) 22 | ->delete(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/Services/Shares/GetUsersWithAccessToEntry.php: -------------------------------------------------------------------------------- 1 | entry = $entry; 22 | } 23 | 24 | /** 25 | * @param int $entryId 26 | * @return Collection|User[] 27 | */ 28 | public function execute($entryId) 29 | { 30 | return $this->entry->with('users')->find($entryId)->users; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Services/Shares/Traits/GeneratesSharePermissions.php: -------------------------------------------------------------------------------- 1 | true, 20 | 'edit' => $permissions == 1, 21 | 'download' => $permissions == 2, 22 | ]; 23 | } 24 | } -------------------------------------------------------------------------------- /app/Services/Shares/UpdateEntryUsers.php: -------------------------------------------------------------------------------- 1 | map(function ($user) { 29 | $user['permissions'] = $this->generateSharePermissions($user['permissions']); 30 | return $user; 31 | }); 32 | 33 | $entriesAndChildren = $this->loadChildEntries($entries); 34 | 35 | // detach users (except owner) from entries 36 | (new DetachUsersFromEntries())->execute( 37 | $entriesAndChildren->pluck('id'), 38 | $users->pluck('id') 39 | ); 40 | 41 | // filter out removed users, so they are not re-attached 42 | $users = $users->filter(function ($user) { 43 | return ! Arr::get($user, 'removed'); 44 | }); 45 | 46 | $records = $this->createPivotRecords($users, $entriesAndChildren, false); 47 | 48 | DB::table('user_file_entry')->insert($records->toArray()); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /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 | "intervention/image": "^2.7", 11 | "laravel/framework": "^9.19", 12 | "laravel/sanctum": "^2.14.1", 13 | "laravel/tinker": "^2.7", 14 | "pion/laravel-chunk-upload": "^1.5", 15 | "spatie/laravel-permission": "^5.5" 16 | }, 17 | "require-dev": { 18 | "fakerphp/faker": "^1.9.1", 19 | "laravel/breeze": "^1.10", 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 | 'host' => env('PUSHER_HOST', 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', 40 | 'port' => env('PUSHER_PORT', 443), 41 | 'scheme' => env('PUSHER_SCHEME', 'https'), 42 | 'encrypted' => true, 43 | 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', 44 | ], 45 | 'client_options' => [ 46 | // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html 47 | ], 48 | ], 49 | 50 | 'ably' => [ 51 | 'driver' => 'ably', 52 | 'key' => env('ABLY_KEY'), 53 | ], 54 | 55 | 'redis' => [ 56 | 'driver' => 'redis', 57 | 'connection' => 'default', 58 | ], 59 | 60 | 'log' => [ 61 | 'driver' => 'log', 62 | ], 63 | 64 | 'null' => [ 65 | 'driver' => 'null', 66 | ], 67 | 68 | ], 69 | 70 | ]; 71 | -------------------------------------------------------------------------------- /config/chunk-upload.php: -------------------------------------------------------------------------------- 1 | [ 11 | /* 12 | * Returns the folder name of the chunks. The location is in storage/app/{folder_name} 13 | */ 14 | 'chunks' => 'chunks', 15 | 'disk' => 'local', 16 | ], 17 | 'clear' => [ 18 | /* 19 | * How old chunks we should delete 20 | */ 21 | 'timestamp' => '-3 HOURS', 22 | 'schedule' => [ 23 | 'enabled' => true, 24 | 'cron' => '25 * * * *', // run every hour on the 25th minute 25 | ], 26 | ], 27 | 'chunk' => [ 28 | // setup for the chunk naming setup to ensure same name upload at same time 29 | 'name' => [ 30 | 'use' => [ 31 | 'session' => true, // should the chunk name use the session id? The uploader must send cookie!, 32 | 'browser' => false, // instead of session we can use the ip and browser? 33 | ], 34 | ], 35 | ], 36 | 'handlers' => [ 37 | // A list of handlers/providers that will be appended to existing list of handlers 38 | 'custom' => [], 39 | // Overrides the list of handlers - use only what you really want 40 | 'override' => [ 41 | // \Pion\Laravel\ChunkUpload\Handler\DropZoneUploadHandler::class 42 | ], 43 | ], 44 | ]; 45 | -------------------------------------------------------------------------------- /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/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/UserFactory.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class UserFactory extends Factory 12 | { 13 | /** 14 | * Define the model's default state. 15 | * 16 | * @return array 17 | */ 18 | public function definition() 19 | { 20 | return [ 21 | 'firstname' => $this->faker->firstName(), 22 | 'lastname' => $this->faker->lastName(), 23 | 'name' => $this->faker->name(), 24 | 'email' => $this->faker->unique()->safeEmail(), 25 | 'email_verified_at' => now(), 26 | 'password_set_at' => now(), 27 | 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 28 | 'remember_token' => Str::random(10), 29 | ]; 30 | } 31 | 32 | /** 33 | * Indicate that the model's email address should be unverified. 34 | * 35 | * @return static 36 | */ 37 | public function unverified() 38 | { 39 | return $this->state(function (array $attributes) { 40 | return [ 41 | 'email_verified_at' => null, 42 | ]; 43 | }); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('firstname', 100); 18 | $table->string('lastname', 100); 19 | $table->string('name'); 20 | $table->string('email')->unique(); 21 | $table->timestamp('email_verified_at')->nullable(); 22 | $table->timestamp('password_set_at')->nullable(); 23 | $table->string('password'); 24 | $table->rememberToken(); 25 | $table->string('phone', 14)->nullable(); 26 | $table->string('avatar', 2048)->nullable(); 27 | $table->string('locale', 5)->default('en'); 28 | $table->string('address')->nullable(); 29 | $table->string('city')->nullable(); 30 | $table->string('country')->nullable(); 31 | $table->string('zip')->nullable(); 32 | $table->string('timezone')->nullable(); 33 | $table->enum('gender', ['male', 'female', 'none'])->default('male'); 34 | $table->enum('online', ['online', 'offline', 'away'])->default('offline'); 35 | $table->enum('status', ['pending', 'active', 'suspend', 'cencel'])->default('pending'); 36 | $table->timestamp('last_login_at')->nullable(); 37 | $table->softDeletes(); 38 | $table->timestamps(); 39 | }); 40 | } 41 | 42 | /** 43 | * Reverse the migrations. 44 | * 45 | * @return void 46 | */ 47 | public function down() 48 | { 49 | Schema::dropIfExists('users'); 50 | } 51 | }; 52 | -------------------------------------------------------------------------------- /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/2018_09_08_054426_create_files_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 19 | 20 | $table->string('name')->index(); 21 | $table->string('description')->nullable(); 22 | $table->string('path')->nullable()->index(); 23 | $table->string('type', 20)->nullable()->index(); 24 | $table->string('public_path', 255)->nullable(); 25 | $table->string('extension', 10)->nullable(); 26 | $table->string('mime', 50)->nullable(); 27 | $table->bigInteger('file_size')->nullable()->unsigned(); 28 | $table->string('file_name', 255); 29 | 30 | $table->integer('parent_id')->nullable(); 31 | $table->string('driver')->nullable(); 32 | $table->string('driver_data')->nullable(); 33 | $table->boolean('isdraft')->default(true); 34 | 35 | $table->integer('uploaded_by')->nullable(); 36 | $table->integer('deleted_by')->nullable(); 37 | $table->json('meta')->nullable(); 38 | $table->json('permissions')->nullable(); 39 | 40 | $table->timestamps(); 41 | $table->softDeletes(); 42 | 43 | }); 44 | } 45 | 46 | /** 47 | * Reverse the migrations. 48 | * 49 | * @return void 50 | */ 51 | public function down() 52 | { 53 | Schema::dropIfExists('files'); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /database/migrations/2019_01_01_054038_create_tags_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string("name")->unique(); 19 | $table->string("description")->nullable(); 20 | $table->string('type')->index()->default('custom'); 21 | $table->string('meta')->nullable(); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('tags'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /database/migrations/2019_01_01_054558_create_taggables_table.php: -------------------------------------------------------------------------------- 1 | integer('tag_id')->index(); 18 | $table->integer('taggable_id')->index(); 19 | $table->string('taggable_type')->index(); 20 | $table->string('user_id')->index()->nullable(); 21 | 22 | $table->unique(['tag_id', 'taggable_id', 'user_id', 'taggable_type']); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('taggables'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /database/migrations/2019_01_08_134334_file_user.php: -------------------------------------------------------------------------------- 1 | integer('user_id')->unsigned()->index(); 18 | $table->integer('file_id')->unsigned()->index(); 19 | $table->boolean('owner')->default(0)->index(); 20 | $table->text('permissions')->nullable(); 21 | $table->timestamps(); 22 | 23 | $table->unique(['file_id', 'user_id']); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('file_user'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /database/migrations/2019_01_15_093426_create_shareable_links_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('hash', 30)->unique(); 19 | $table->integer('user_id')->unsigned()->index(); 20 | $table->integer('file_id')->unsigned()->index(); 21 | $table->boolean('allow_edit')->default(0); 22 | $table->boolean('allow_download')->default(1); 23 | $table->string('password')->nullable(); 24 | $table->timestamp('expires_at')->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('shareable_links'); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /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 | 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/seeders/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call(UserSeeder::class); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /database/seeders/UserSeeder.php: -------------------------------------------------------------------------------- 1 | Role::ADMINISTRATOR]); 20 | Role::create(['name' => Role::ADMIN]); 21 | Role::create(['name' => Role::USER]); 22 | 23 | User::factory(100)->create(); 24 | 25 | User::get()->map(function (User $user) { 26 | $user->assignRole(Role::USER); 27 | }); 28 | 29 | $user = User::find(1); 30 | 31 | $user->email = 'admin@admin.com'; 32 | $user->firstname = 'admin'; 33 | $user->lastname = 'admin'; 34 | $user->name = 'admin'; 35 | $user->email_verified_at = now(); 36 | $user->status = 'active'; 37 | 38 | $user->save(); 39 | 40 | $user->assignRole(Role::ADMINISTRATOR); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /doc/screenshort/mydrive-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mshossain110/LaravelDrive/fbadeb319c8fc373b998363e8424c8b8d66f1db8/doc/screenshort/mydrive-page.png -------------------------------------------------------------------------------- /doc/screenshort/sharewithme-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mshossain110/LaravelDrive/fbadeb319c8fc373b998363e8424c8b8d66f1db8/doc/screenshort/sharewithme-page.png -------------------------------------------------------------------------------- /doc/screenshort/trash-pge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mshossain110/LaravelDrive/fbadeb319c8fc373b998363e8424c8b8d66f1db8/doc/screenshort/trash-pge.png -------------------------------------------------------------------------------- /doc/screenshort/users-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mshossain110/LaravelDrive/fbadeb319c8fc373b998363e8424c8b8d66f1db8/doc/screenshort/users-page.png -------------------------------------------------------------------------------- /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": "vite", 5 | "build": "vite build", 6 | "watch": "vite build --mode development --watch " 7 | }, 8 | "devDependencies": { 9 | "@mdi/font": "^7.0.96", 10 | "@vitejs/plugin-vue": "^2.3.3", 11 | "autoprefixer": "^10.4.2", 12 | "axios": "^0.25.0", 13 | "dropzone": "^6.0.0-beta.2", 14 | "laravel-vite-plugin": "^0.2.1", 15 | "lodash": "^4.17.19", 16 | "material-design-icons-iconfont": "^6.7.0", 17 | "mitt": "^3.0.0", 18 | "plyr": "^3.7.2", 19 | "postcss": "^8.4.6", 20 | "vite": "^2.9.11", 21 | "vue": "^3.2.37", 22 | "vue-multiselect": "^3.0.0-alpha.2", 23 | "vue-router": "^4.1.2", 24 | "vuetify": "^3.0.0-beta.5", 25 | "vuex": "^4.0.2" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | autoprefixer: {}, 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /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/mshossain110/LaravelDrive/fbadeb319c8fc373b998363e8424c8b8d66f1db8/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/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /resources/css/app.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mshossain110/LaravelDrive/fbadeb319c8fc373b998363e8424c8b8d66f1db8/resources/css/app.css -------------------------------------------------------------------------------- /resources/js/Components/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 16 | -------------------------------------------------------------------------------- /resources/js/Components/Dashboard/Dashboard.vue: -------------------------------------------------------------------------------- 1 | 78 | 79 | 103 | 104 | 107 | -------------------------------------------------------------------------------- /resources/js/Components/Dashboard/Widgets/Count.vue: -------------------------------------------------------------------------------- 1 | 24 | 25 | 44 | 45 | 55 | -------------------------------------------------------------------------------- /resources/js/Components/Dashboard/route.js: -------------------------------------------------------------------------------- 1 | import Dashboard from './Dashboard.vue'; 2 | 3 | const DashRoute = { 4 | path: 'dashboard', 5 | name: 'dashboard', 6 | component: Dashboard, 7 | meta: { 8 | icon: 'dashboard', 9 | text: 'Dashboard', 10 | disabled: false, 11 | permission: true 12 | } 13 | }; 14 | 15 | export default DashRoute; 16 | -------------------------------------------------------------------------------- /resources/js/Components/Layout/FavoriteFolders.vue: -------------------------------------------------------------------------------- 1 | 32 | 33 | 45 | 46 | 56 | -------------------------------------------------------------------------------- /resources/js/Components/Layout/index.js: -------------------------------------------------------------------------------- 1 | import Layout from './Layout.vue'; 2 | 3 | export default Layout; 4 | -------------------------------------------------------------------------------- /resources/js/Components/MyDrive/NewFolderForm.vue: -------------------------------------------------------------------------------- 1 | 49 | 50 | 88 | 89 | 94 | -------------------------------------------------------------------------------- /resources/js/Components/MyDrive/RecursiveFolder.vue: -------------------------------------------------------------------------------- 1 | 49 | 50 | 83 | 84 | 87 | -------------------------------------------------------------------------------- /resources/js/Components/MyDrive/RenameFile.vue: -------------------------------------------------------------------------------- 1 | 53 | 54 | 92 | 93 | 98 | -------------------------------------------------------------------------------- /resources/js/Components/MyDrive/route.js: -------------------------------------------------------------------------------- 1 | import MyDrive from './MyDrive.vue'; 2 | import Stare from './Stared.vue'; 3 | import Trash from './Trash.vue'; 4 | import SharedWithMe from './SharedWithMe.vue'; 5 | 6 | const MediaRoute = [ 7 | { 8 | path: 'media', 9 | name: 'media', 10 | component: MyDrive 11 | }, 12 | { 13 | path: 'media/folder/:folderId', 14 | name: 'singleFolder', 15 | component: MyDrive 16 | }, 17 | { 18 | path: 'media/starred', 19 | name: 'starred', 20 | component: Stare 21 | }, 22 | { 23 | path: 'media/trash', 24 | name: 'trash', 25 | component: Trash 26 | }, 27 | { 28 | path: 'media/trash/:folderId', 29 | name: 'trashFolder', 30 | component: Trash 31 | }, 32 | { 33 | path: 'media/shared', 34 | name: 'shared', 35 | component: SharedWithMe 36 | }, 37 | { 38 | path: 'media/shared/:folderId', 39 | name: 'sharedFolder', 40 | component: SharedWithMe 41 | } 42 | ]; 43 | 44 | export default MediaRoute; 45 | -------------------------------------------------------------------------------- /resources/js/Components/Translation/Languages.vue: -------------------------------------------------------------------------------- 1 | 40 | 41 | 84 | 85 | 88 | -------------------------------------------------------------------------------- /resources/js/Components/Translation/NewLanguage.vue: -------------------------------------------------------------------------------- 1 | 37 | 75 | 76 | 79 | -------------------------------------------------------------------------------- /resources/js/Components/Translation/NewTranslation.vue: -------------------------------------------------------------------------------- 1 | 52 | 53 | 99 | 100 | 103 | -------------------------------------------------------------------------------- /resources/js/Components/Translation/Translation.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 25 | 26 | 29 | -------------------------------------------------------------------------------- /resources/js/Components/Translation/TranslationInput.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 72 | 73 | 83 | -------------------------------------------------------------------------------- /resources/js/Components/Translation/route.js: -------------------------------------------------------------------------------- 1 | import Translation from './Translation'; 2 | 3 | const TranslationRoute = [ 4 | { 5 | path: 'translation', 6 | name: 'translation', 7 | component: Translation 8 | } 9 | 10 | ]; 11 | 12 | export default TranslationRoute; 13 | -------------------------------------------------------------------------------- /resources/js/Components/Users/Permissions.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 20 | 21 | 24 | -------------------------------------------------------------------------------- /resources/js/Components/Users/Profile.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 20 | 21 | 24 | -------------------------------------------------------------------------------- /resources/js/Components/Users/Role.vue: -------------------------------------------------------------------------------- 1 | 38 | 39 | 68 | -------------------------------------------------------------------------------- /resources/js/Components/Users/Roles.vue: -------------------------------------------------------------------------------- 1 | 42 | 43 | 72 | 73 | 80 | -------------------------------------------------------------------------------- /resources/js/Components/Users/Users.vue: -------------------------------------------------------------------------------- 1 | 53 | 54 | 74 | 75 | 80 | -------------------------------------------------------------------------------- /resources/js/Components/Users/route.js: -------------------------------------------------------------------------------- 1 | import Users from './Users.vue'; 2 | import Roles from './Roles.vue'; 3 | import Profile from './Profile.vue'; 4 | import Permissions from './Permissions.vue'; 5 | 6 | const UsersRoute = [ 7 | { 8 | path: 'users', 9 | name: 'users', 10 | component: Users 11 | }, 12 | { 13 | path: 'users/roles', 14 | name: 'users-role', 15 | component: Roles, 16 | children: [ 17 | { 18 | path: ':id/permissions', 19 | name: 'role-permissions', 20 | component: Permissions 21 | } 22 | ] 23 | }, 24 | { 25 | path: 'users/:id', 26 | name: 'users-profile', 27 | component: Profile 28 | } 29 | ]; 30 | 31 | export default UsersRoute; 32 | -------------------------------------------------------------------------------- /resources/js/Components/dropzone/index.js: -------------------------------------------------------------------------------- 1 | import Dropzone from './dropzone.vue'; 2 | 3 | export default Dropzone; 4 | -------------------------------------------------------------------------------- /resources/js/Vuetify.js: -------------------------------------------------------------------------------- 1 | import "vuetify/styles"; 2 | import 'material-design-icons-iconfont/dist/material-design-icons.css' 3 | import { createVuetify } from "vuetify"; 4 | import { aliases, md } from "vuetify/iconsets/md"; 5 | import * as components from "vuetify/components"; 6 | import * as directives from "vuetify/directives"; 7 | import colors from "vuetify/lib/util/colors"; 8 | 9 | const LaravelDrive = { 10 | dark: false, 11 | colors: { 12 | header: colors.indigo.darken1, 13 | nav: colors.grey.lighten4, 14 | footer: colors.indigo.lighten3, 15 | primary: colors.indigo.lighten3, 16 | secondary: colors.indigo.darken3, 17 | accent: colors.indigo.accent1, 18 | error: colors.red.darken1, 19 | warning: colors.yellow.darken1, 20 | info: colors.blue.lighten5, 21 | success: colors.green.darken1, 22 | }, 23 | }; 24 | 25 | export default createVuetify({ 26 | icons: { 27 | defaultSet: "md", 28 | aliases, 29 | sets: { 30 | md, 31 | }, 32 | }, 33 | components, 34 | directives, 35 | theme: { 36 | defaultTheme: "LaravelDrive", 37 | themes: { 38 | LaravelDrive, 39 | }, 40 | }, 41 | }); 42 | -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | import './bootstrap'; 2 | import Vuetify from './Vuetify'; 3 | import { createApp } from 'vue'; 4 | import mitt from "mitt"; 5 | import App from '@/Components/App.vue'; 6 | import router from '@/router/index.js' 7 | import store from '@/store/index.js'; 8 | import mixin from '@/plugins/mixin.js'; 9 | 10 | 11 | const app = createApp(App) 12 | 13 | app.config.devtools = true; 14 | 15 | app.use(Vuetify); 16 | app.use(router) 17 | app.use(store) 18 | app.mixin(mixin) 19 | 20 | app.config.globalProperties.emmiter = mitt(); 21 | app.mount('#root') 22 | -------------------------------------------------------------------------------- /resources/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | import _ from 'lodash'; 2 | window._ = _; 3 | 4 | /** 5 | * We'll load the axios HTTP library which allows us to easily issue requests 6 | * to our Laravel back-end. This library automatically handles sending the 7 | * CSRF token as a header based on the value of the "XSRF" token cookie. 8 | */ 9 | 10 | import axios from 'axios'; 11 | window.axios = axios; 12 | 13 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 14 | 15 | /** 16 | * Echo exposes an expressive API for subscribing to channels and listening 17 | * for events that are broadcast by Laravel. Echo and event broadcasting 18 | * allows your team to easily build robust real-time web applications. 19 | */ 20 | 21 | // import Echo from 'laravel-echo'; 22 | 23 | // import Pusher from 'pusher-js'; 24 | // window.Pusher = Pusher; 25 | 26 | // window.Echo = new Echo({ 27 | // broadcaster: 'pusher', 28 | // key: import.meta.env.VITE_PUSHER_APP_KEY, 29 | // wsHost: import.meta.env.VITE_PUSHER_HOST ?? `ws-${import.meta.env.VITE_PUSHER_CLUSTER}.pusher.com`, 30 | // wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80, 31 | // wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443, 32 | // forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https', 33 | // enabledTransports: ['ws', 'wss'], 34 | // }); 35 | 36 | window.LD.getUserPermissions = function getUserPermissions () { 37 | return LD.user.permissions || null; 38 | }; 39 | window.LD.hasPermission = function hasPermission (p) { 40 | if (!LD.user.permissions || !LD.user.permissions.length) { 41 | return false; 42 | } 43 | if (LD.user.permissions.indexOf('administrator') !== -1) { 44 | return true; 45 | } 46 | 47 | return LD.user.permissions.indexOf(p) !== -1; 48 | }; -------------------------------------------------------------------------------- /resources/js/plugins/auth.js: -------------------------------------------------------------------------------- 1 | export default { 2 | methods: { 3 | parseJWT (token) { 4 | var base64Url = token.split('.')[1]; 5 | var base64 = base64Url.replace('-', '+').replace('_', '/'); 6 | return JSON.parse(window.atob(base64)); 7 | }, 8 | 9 | saveToken (token, name) { 10 | name = name || 'auth_token'; 11 | window.localStorage[name] = token; 12 | }, 13 | 14 | getToken (name) { 15 | name = name || 'auth_token'; 16 | return window.localStorage[name]; 17 | }, 18 | 19 | removeToken (name) { 20 | name = name || 'auth_token'; 21 | window.localStorage.removeItem(name); 22 | }, 23 | login (params) { 24 | const remember = params.remember ? params.remember : false; 25 | const data = { 26 | email: params.email, 27 | password: params.password, 28 | remember: remember 29 | }; 30 | return new Promise((resolve, reject) => { 31 | axios.post('/login', data) 32 | .then((res) => { 33 | this.saveToken(res.data.token); 34 | resolve(res.data); 35 | }) 36 | .catch((err) => { 37 | this.errors.record(err.response.data.errors); 38 | reject(err.response.data); 39 | }); 40 | }); 41 | }, 42 | register (params) { 43 | return new Promise((resolve, reject) => { 44 | axios.post('/register', params) 45 | .then((res) => { 46 | this.saveToken(res.data.token); 47 | resolve(res.data); 48 | }) 49 | .catch((err) => { 50 | this.errors.record(err.response.data.errors); 51 | reject(err.response.data); 52 | }); 53 | }); 54 | }, 55 | logout () { 56 | return new Promise((resolve, reject) => { 57 | axios.post('/logout') 58 | .then((res) => { 59 | this.removeToken(); 60 | location.replace('/login'); 61 | resolve(res.data); 62 | }) 63 | .catch((err) => { 64 | reject(err.response.data); 65 | }); 66 | }); 67 | } 68 | } 69 | }; 70 | -------------------------------------------------------------------------------- /resources/js/plugins/mixin.js: -------------------------------------------------------------------------------- 1 | export default { 2 | data () { 3 | return { 4 | currentUser: LD.user /* globals LD:true */ 5 | }; 6 | }, 7 | computed: { 8 | fullname () { 9 | if (this.currentUser.firstname || this.currentUser.lastname) { 10 | return this.currentUser.firstname + ' ' + this.currentUser.lastname; 11 | } else { 12 | return this.currentUser.name; 13 | } 14 | } 15 | }, 16 | 17 | methods: { 18 | getUserPermissions () { 19 | return LD.user.permissions; 20 | }, 21 | hasPermission (p) { 22 | if (!LD.user.permissions || !LD.user.permissions.length) { 23 | return false; 24 | } 25 | if (LD.user.permissions.indexOf('administrator') !== -1) { 26 | return true; 27 | } 28 | 29 | return LD.user.permissions.indexOf(p) !== -1; 30 | } 31 | } 32 | 33 | }; 34 | -------------------------------------------------------------------------------- /resources/js/router/index.js: -------------------------------------------------------------------------------- 1 | import { createRouter, createWebHashHistory } from "vue-router"; 2 | import { h, resolveComponent } from 'vue' 3 | import DashRoute from '@/Components/Dashboard/route'; 4 | import UserRoute from '@/Components/Users/route'; 5 | import MyDrive from '@/Components/MyDrive/route'; 6 | // import TranslationRoute from '@ac/Translation/route'; 7 | let Routes = []; 8 | 9 | Routes.push(DashRoute); 10 | Routes = Routes.concat(UserRoute); 11 | console.log(Routes) 12 | Routes = Routes.concat(MyDrive); 13 | // Routes = Routes.concat(TranslationRoute); 14 | 15 | export default createRouter({ 16 | history: createWebHashHistory(), 17 | routes: [ 18 | { 19 | path: '/', 20 | component: { 21 | render () { 22 | return h(resolveComponent('router-view')); 23 | } 24 | }, 25 | redirect: { name: 'dashboard' }, 26 | children: Routes 27 | } 28 | ], 29 | }) 30 | -------------------------------------------------------------------------------- /resources/js/store/index.js: -------------------------------------------------------------------------------- 1 | 2 | import { createStore } from 'vuex' 3 | import UsersStore from '@/Components/Users/store'; 4 | import MyDriveStore from '@/Components/MyDrive/store'; 5 | import TranslationStore from '@/Components/Translation/store'; 6 | 7 | 8 | export default new createStore({ 9 | root: true, 10 | state: { 11 | isAuthenticated: false, 12 | snackbar: {}, 13 | status: '', 14 | hasLoadedOnce: false 15 | }, 16 | getters: { 17 | snackbar: state => state.snackbar, 18 | isAuthenticated: state => !!state.access_token 19 | }, 20 | mutations: { 21 | setSnackbar (state, payload) { 22 | state.snackbar = payload; 23 | }, 24 | setSnackbarHide (state) { 25 | state.snackbar.show = !state.snackbar.show; 26 | }, 27 | auth (state, payload) { 28 | state.isAuthenticated = payload; 29 | } 30 | }, 31 | actions: { 32 | authRequest: ({ commit }, payload) => { 33 | const remember = payload.remember ? payload.remember : false; 34 | const data = { 35 | email: payload.email, 36 | password: payload.password, 37 | remember: remember 38 | }; 39 | return new Promise((resolve, reject) => { 40 | axios.post('/login', data) 41 | .then(() => { 42 | commit('auth', true); 43 | resolve(); 44 | }) 45 | .catch((err) => { 46 | reject(err); 47 | }); 48 | }); 49 | }, 50 | authLogout: ({ commit }) => { 51 | return new Promise((resolve, reject) => { 52 | axios.post('/logout') 53 | .then(() => { 54 | commit('auth', false); 55 | resolve(); 56 | }) 57 | .catch((err) => { 58 | reject(err); 59 | }); 60 | }); 61 | } 62 | }, 63 | modules: { 64 | Users: UsersStore, 65 | Media: MyDriveStore, 66 | Translation: TranslationStore 67 | } 68 | }); 69 | -------------------------------------------------------------------------------- /resources/views/auth/confirm-password.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | {{ __('This is a secure area of the application. Please confirm your password before continuing.') }} 11 |
12 | 13 | 14 | 15 | 16 |
17 | @csrf 18 | 19 | 20 |
21 | 22 | 23 | 27 |
28 | 29 |
30 | 31 | {{ __('Confirm') }} 32 | 33 |
34 |
35 |
36 |
37 | -------------------------------------------------------------------------------- /resources/views/auth/forgot-password.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | {{ __('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.') }} 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | @csrf 21 | 22 | 23 |
24 | 25 | 26 | 27 |
28 | 29 |
30 | 31 | {{ __('Email Password Reset Link') }} 32 | 33 |
34 |
35 |
36 |
37 | -------------------------------------------------------------------------------- /resources/views/auth/login.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | @csrf 17 | 18 | 19 |
20 | 21 | 22 | 23 |
24 | 25 | 26 |
27 | 28 | 29 | 33 |
34 | 35 | 36 |
37 | 41 |
42 | 43 |
44 | @if (Route::has('password.request')) 45 | 46 | {{ __('Forgot your password?') }} 47 | 48 | @endif 49 | 50 | 51 | {{ __('Log in') }} 52 | 53 |
54 |
55 |
56 |
57 | -------------------------------------------------------------------------------- /resources/views/auth/register.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | @csrf 14 | 15 | 16 |
17 | 18 | 19 | 20 |
21 | 22 | 23 |
24 | 25 | 26 | 27 |
28 | 29 | 30 |
31 | 32 | 33 | 37 |
38 | 39 | 40 |
41 | 42 | 43 | 46 |
47 | 48 |
49 | 50 | {{ __('Already registered?') }} 51 | 52 | 53 | 54 | {{ __('Register') }} 55 | 56 |
57 |
58 |
59 |
60 | -------------------------------------------------------------------------------- /resources/views/auth/reset-password.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | @csrf 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 |
24 | 25 | 26 |
27 | 28 | 29 | 30 |
31 | 32 | 33 |
34 | 35 | 36 | 39 |
40 | 41 |
42 | 43 | {{ __('Reset Password') }} 44 | 45 |
46 |
47 |
48 |
49 | -------------------------------------------------------------------------------- /resources/views/auth/verify-email.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | {{ __('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.') }} 11 |
12 | 13 | @if (session('status') == 'verification-link-sent') 14 |
15 | {{ __('A new verification link has been sent to the email address you provided during registration.') }} 16 |
17 | @endif 18 | 19 |
20 |
21 | @csrf 22 | 23 |
24 | 25 | {{ __('Resend Verification Email') }} 26 | 27 |
28 |
29 | 30 |
31 | @csrf 32 | 33 | 36 |
37 |
38 |
39 |
40 | -------------------------------------------------------------------------------- /resources/views/components/auth-card.blade.php: -------------------------------------------------------------------------------- 1 |
2 |
3 | {{ $logo }} 4 |
5 | 6 |
7 | {{ $slot }} 8 |
9 |
10 | -------------------------------------------------------------------------------- /resources/views/components/auth-session-status.blade.php: -------------------------------------------------------------------------------- 1 | @props(['status']) 2 | 3 | @if ($status) 4 |
merge(['class' => 'font-medium text-sm text-green-600']) }}> 5 | {{ $status }} 6 |
7 | @endif 8 | -------------------------------------------------------------------------------- /resources/views/components/auth-validation-errors.blade.php: -------------------------------------------------------------------------------- 1 | @props(['errors']) 2 | 3 | @if ($errors->any()) 4 |
5 |
6 | {{ __('Whoops! Something went wrong.') }} 7 |
8 | 9 |
    10 | @foreach ($errors->all() as $error) 11 |
  • {{ $error }}
  • 12 | @endforeach 13 |
14 |
15 | @endif 16 | -------------------------------------------------------------------------------- /resources/views/components/button.blade.php: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /resources/views/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 duration-150 ease-in-out']) }}>{{ $slot }} 2 | -------------------------------------------------------------------------------- /resources/views/components/dropdown.blade.php: -------------------------------------------------------------------------------- 1 | @props(['align' => 'right', 'width' => '48', 'contentClasses' => 'py-1 bg-white']) 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 'right': 12 | default: 13 | $alignmentClasses = 'origin-top-right right-0'; 14 | break; 15 | } 16 | 17 | switch ($width) { 18 | case '48': 19 | $width = 'w-48'; 20 | break; 21 | } 22 | @endphp 23 | 24 |
25 |
26 | {{ $trigger }} 27 |
28 | 29 | 43 |
44 | -------------------------------------------------------------------------------- /resources/views/components/input.blade.php: -------------------------------------------------------------------------------- 1 | @props(['disabled' => false]) 2 | 3 | merge(['class' => 'rounded-md shadow-sm border-gray-300 focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50']) !!}> 4 | -------------------------------------------------------------------------------- /resources/views/components/label.blade.php: -------------------------------------------------------------------------------- 1 | @props(['value']) 2 | 3 | 6 | -------------------------------------------------------------------------------- /resources/views/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 duration-150 ease-in-out' 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 duration-150 ease-in-out'; 7 | @endphp 8 | 9 | merge(['class' => $classes]) }}> 10 | {{ $slot }} 11 | 12 | -------------------------------------------------------------------------------- /resources/views/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 duration-150 ease-in-out' 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 duration-150 ease-in-out'; 7 | @endphp 8 | 9 | merge(['class' => $classes]) }}> 10 | {{ $slot }} 11 | 12 | -------------------------------------------------------------------------------- /resources/views/dashboard.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{ config('app.name', 'Laravel') }} 9 | 10 | 11 | 12 | 13 | 14 | @vite(['resources/css/app.css', 'resources/js/app.js']) 15 | 16 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | -------------------------------------------------------------------------------- /resources/views/drive/index.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | {{ config('app.name', 'Laravel') }} 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 28 | 29 | 30 | @vite(['resources/js/app.js']) 31 | 32 | 33 | 34 | 35 |
36 |
37 |
38 | 39 | 40 | -------------------------------------------------------------------------------- /resources/views/home.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
Dashboard
9 | 10 |
11 | @if (session('status')) 12 | 15 | @endif 16 | 17 | You are logged in! 18 |
19 |
20 |
21 |
22 |
23 | @endsection 24 | -------------------------------------------------------------------------------- /resources/views/layouts/app.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{ config('app.name', 'Laravel') }} 9 | 10 | 11 | 12 | 13 | 14 | @vite(['resources/css/app.css', 'resources/js/app.js']) 15 | 16 | 17 |
18 | @include('layouts.navigation') 19 | 20 | 21 |
22 |
23 | {{ $header }} 24 |
25 |
26 | 27 | 28 |
29 | {{ $slot }} 30 |
31 |
32 | 33 | 34 | -------------------------------------------------------------------------------- /routes/auth.php: -------------------------------------------------------------------------------- 1 | group(function () { 14 | Route::get('register', [RegisteredUserController::class, 'create']) 15 | ->name('register'); 16 | 17 | Route::post('register', [RegisteredUserController::class, 'store']); 18 | 19 | Route::get('login', [AuthenticatedSessionController::class, 'create']) 20 | ->name('login'); 21 | 22 | Route::post('login', [AuthenticatedSessionController::class, 'store']); 23 | 24 | Route::get('forgot-password', [PasswordResetLinkController::class, 'create']) 25 | ->name('password.request'); 26 | 27 | Route::post('forgot-password', [PasswordResetLinkController::class, 'store']) 28 | ->name('password.email'); 29 | 30 | Route::get('reset-password/{token}', [NewPasswordController::class, 'create']) 31 | ->name('password.reset'); 32 | 33 | Route::post('reset-password', [NewPasswordController::class, 'store']) 34 | ->name('password.update'); 35 | }); 36 | 37 | Route::middleware('auth')->group(function () { 38 | Route::get('verify-email', [EmailVerificationPromptController::class, '__invoke']) 39 | ->name('verification.notice'); 40 | 41 | Route::get('verify-email/{id}/{hash}', [VerifyEmailController::class, '__invoke']) 42 | ->middleware(['signed', 'throttle:6,1']) 43 | ->name('verification.verify'); 44 | 45 | Route::post('email/verification-notification', [EmailVerificationNotificationController::class, 'store']) 46 | ->middleware('throttle:6,1') 47 | ->name('verification.send'); 48 | 49 | Route::get('confirm-password', [ConfirmablePasswordController::class, 'show']) 50 | ->name('password.confirm'); 51 | 52 | Route::post('confirm-password', [ConfirmablePasswordController::class, 'store']); 53 | 54 | Route::post('logout', [AuthenticatedSessionController::class, 'destroy']) 55 | ->name('logout'); 56 | }); 57 | -------------------------------------------------------------------------------- /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 | ['web']], function () { 28 | 29 | Route::get('/home', [HomeController::class, 'index'])->name('home'); 30 | 31 | Route::get('/drive/{any?}', [HomeController::class, 'drive'])->where('any', '.*')->name('drive'); 32 | 33 | Route::get('/uploads/{id}/{any?}', UploadController::class)->where('any', '.*'); 34 | 35 | Route::get('file/s/{hash}', ShareableController::class)->name('shareable'); 36 | // Socialite Register Routes 37 | Route::get('/login/redirect/{provider}', [SocialController::class, 'getSocialRedirect'])->name('social.redirect'); 38 | Route::get('/login/handle/{provider}', [SocialController::class, 'getSocialHandle'])->name('social.handle'); 39 | }); 40 | 41 | -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/app/public/.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 | /** @type {import('tailwindcss').Config} */ 4 | module.exports = { 5 | content: [ 6 | './vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.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 | }, 17 | }, 18 | 19 | plugins: [require('@tailwindcss/forms')], 20 | }; 21 | -------------------------------------------------------------------------------- /tests/CreatesApplication.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 19 | 20 | return $app; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/Feature/Auth/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/Auth/EmailVerificationTest.php: -------------------------------------------------------------------------------- 1 | create([ 20 | 'email_verified_at' => null, 21 | ]); 22 | 23 | $response = $this->actingAs($user)->get('/verify-email'); 24 | 25 | $response->assertStatus(200); 26 | } 27 | 28 | public function test_email_can_be_verified() 29 | { 30 | $user = User::factory()->create([ 31 | 'email_verified_at' => null, 32 | ]); 33 | 34 | Event::fake(); 35 | 36 | $verificationUrl = URL::temporarySignedRoute( 37 | 'verification.verify', 38 | now()->addMinutes(60), 39 | ['id' => $user->id, 'hash' => sha1($user->email)] 40 | ); 41 | 42 | $response = $this->actingAs($user)->get($verificationUrl); 43 | 44 | Event::assertDispatched(Verified::class); 45 | $this->assertTrue($user->fresh()->hasVerifiedEmail()); 46 | $response->assertRedirect(RouteServiceProvider::HOME.'?verified=1'); 47 | } 48 | 49 | public function test_email_is_not_verified_with_invalid_hash() 50 | { 51 | $user = User::factory()->create([ 52 | 'email_verified_at' => null, 53 | ]); 54 | 55 | $verificationUrl = URL::temporarySignedRoute( 56 | 'verification.verify', 57 | now()->addMinutes(60), 58 | ['id' => $user->id, 'hash' => sha1('wrong-email')] 59 | ); 60 | 61 | $this->actingAs($user)->get($verificationUrl); 62 | 63 | $this->assertFalse($user->fresh()->hasVerifiedEmail()); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /tests/Feature/Auth/PasswordConfirmationTest.php: -------------------------------------------------------------------------------- 1 | create(); 16 | 17 | $response = $this->actingAs($user)->get('/confirm-password'); 18 | 19 | $response->assertStatus(200); 20 | } 21 | 22 | public function test_password_can_be_confirmed() 23 | { 24 | $user = User::factory()->create(); 25 | 26 | $response = $this->actingAs($user)->post('/confirm-password', [ 27 | 'password' => 'password', 28 | ]); 29 | 30 | $response->assertRedirect(); 31 | $response->assertSessionHasNoErrors(); 32 | } 33 | 34 | public function test_password_is_not_confirmed_with_invalid_password() 35 | { 36 | $user = User::factory()->create(); 37 | 38 | $response = $this->actingAs($user)->post('/confirm-password', [ 39 | 'password' => 'wrong-password', 40 | ]); 41 | 42 | $response->assertSessionHasErrors(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /tests/Feature/Auth/PasswordResetTest.php: -------------------------------------------------------------------------------- 1 | get('/forgot-password'); 18 | 19 | $response->assertStatus(200); 20 | } 21 | 22 | public function test_reset_password_link_can_be_requested() 23 | { 24 | Notification::fake(); 25 | 26 | $user = User::factory()->create(); 27 | 28 | $this->post('/forgot-password', ['email' => $user->email]); 29 | 30 | Notification::assertSentTo($user, ResetPassword::class); 31 | } 32 | 33 | public function test_reset_password_screen_can_be_rendered() 34 | { 35 | Notification::fake(); 36 | 37 | $user = User::factory()->create(); 38 | 39 | $this->post('/forgot-password', ['email' => $user->email]); 40 | 41 | Notification::assertSentTo($user, ResetPassword::class, function ($notification) { 42 | $response = $this->get('/reset-password/'.$notification->token); 43 | 44 | $response->assertStatus(200); 45 | 46 | return true; 47 | }); 48 | } 49 | 50 | public function test_password_can_be_reset_with_valid_token() 51 | { 52 | Notification::fake(); 53 | 54 | $user = User::factory()->create(); 55 | 56 | $this->post('/forgot-password', ['email' => $user->email]); 57 | 58 | Notification::assertSentTo($user, ResetPassword::class, function ($notification) use ($user) { 59 | $response = $this->post('/reset-password', [ 60 | 'token' => $notification->token, 61 | 'email' => $user->email, 62 | 'password' => 'password', 63 | 'password_confirmation' => 'password', 64 | ]); 65 | 66 | $response->assertSessionHasNoErrors(); 67 | 68 | return true; 69 | }); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /tests/Feature/Auth/RegistrationTest.php: -------------------------------------------------------------------------------- 1 | get('/register'); 16 | 17 | $response->assertStatus(200); 18 | } 19 | 20 | public function test_new_users_can_register() 21 | { 22 | $response = $this->post('/register', [ 23 | 'name' => 'Test User', 24 | 'email' => 'test@example.com', 25 | 'password' => 'password', 26 | 'password_confirmation' => 'password', 27 | ]); 28 | 29 | $this->assertAuthenticated(); 30 | $response->assertRedirect(RouteServiceProvider::HOME); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/Feature/ExampleTest.php: -------------------------------------------------------------------------------- 1 | get('/'); 18 | 19 | $response->assertStatus(200); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite'; 2 | import laravel from 'laravel-vite-plugin'; 3 | import vue from '@vitejs/plugin-vue'; 4 | 5 | export default defineConfig({ 6 | plugins: [ 7 | laravel([ 8 | 'resources/css/app.css', 9 | 'resources/js/app.js', 10 | ]), 11 | vue({ 12 | template: { 13 | transformAssetUrls: { 14 | // The Vue plugin will re-write asset URLs, when referenced 15 | // in Single File Components, to point to the Laravel web 16 | // server. Setting this to `null` allows the Laravel plugin 17 | // to instead re-write asset URLs to point to the Vite 18 | // server instead. 19 | base: null, 20 | 21 | // The Vue plugin will parse absolute URLs and treat them 22 | // as absolute paths to files on disk. Setting this to 23 | // `false` will leave absolute URLs un-touched so they can 24 | // reference assets in the public directly as expected. 25 | includeAbsolute: false, 26 | }, 27 | }, 28 | }), 29 | ], 30 | resolve: { 31 | alias: { 32 | '@': '/resources/js', 33 | }, 34 | }, 35 | }); 36 | --------------------------------------------------------------------------------