├── .editorconfig ├── .env.example ├── .gitattributes ├── .gitignore ├── Makefile ├── README.md ├── app ├── Actions │ └── Fortify │ │ ├── CreateNewUser.php │ │ ├── PasswordValidationRules.php │ │ ├── ResetUserPassword.php │ │ ├── UpdateUserPassword.php │ │ └── UpdateUserProfileInformation.php ├── Console │ └── Kernel.php ├── Exceptions │ └── Handler.php ├── Http │ ├── Controllers │ │ ├── BookController.php │ │ ├── BorrowBookController.php │ │ ├── BorrowController.php │ │ ├── Controller.php │ │ ├── Datatables │ │ │ ├── BookDatatables.php │ │ │ ├── BorrowBookDatatables.php │ │ │ ├── BorrowDatatables.php │ │ │ ├── MemberDatatables.php │ │ │ ├── ModuleDatatables.php │ │ │ ├── RoleDatatables.php │ │ │ └── UserDatatables.php │ │ ├── HomeController.php │ │ ├── LocalizationController.php │ │ ├── MemberController.php │ │ ├── ModuleController.php │ │ ├── RoleController.php │ │ ├── RolePermissionController.php │ │ ├── UserController.php │ │ ├── UserPasswordController.php │ │ └── UserVerificationController.php │ ├── Kernel.php │ ├── Middleware │ │ ├── Authenticate.php │ │ ├── EncryptCookies.php │ │ ├── Localization.php │ │ ├── PreventRequestsDuringMaintenance.php │ │ ├── RedirectIfAuthenticated.php │ │ ├── TrimStrings.php │ │ ├── TrustHosts.php │ │ ├── TrustProxies.php │ │ ├── ValidateSignature.php │ │ ├── VerifyCsrfToken.php │ │ └── WebPermission.php │ └── Requests │ │ ├── BookStoreRequest.php │ │ ├── BookUpdateRequest.php │ │ ├── BorrowBookStoreRequest.php │ │ ├── BorrowDestroyRequest.php │ │ ├── BorrowStoreRequest.php │ │ ├── BorrowUpdateRequest.php │ │ ├── StoreUserRequest.php │ │ ├── UpdateUserRequest.php │ │ └── VerificationUserRequest.php ├── Mail │ └── MemberCard.php ├── Models │ ├── Book.php │ ├── Borrow.php │ ├── BorrowBook.php │ ├── Card.php │ ├── Category.php │ └── User.php ├── Notifications │ ├── NewUserNotification.php │ └── WelcomeNotification.php ├── Providers │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── BroadcastServiceProvider.php │ ├── EventServiceProvider.php │ ├── FortifyServiceProvider.php │ └── RouteServiceProvider.php ├── Traits │ └── Randomizer.php └── View │ └── Components │ └── Datatable.php ├── artisan ├── bootstrap ├── app.php └── cache │ └── .gitignore ├── composer.json ├── composer.lock ├── config ├── app.php ├── auth.php ├── broadcasting.php ├── cache.php ├── cors.php ├── database.php ├── datatables.php ├── filesystems.php ├── fortify.php ├── hashing.php ├── logging.php ├── mail.php ├── modules.php ├── nurfachmi.php ├── permission.php ├── perpustakaan.php ├── queue.php ├── sanctum.php ├── services.php ├── session.php ├── sweetalert.php └── view.php ├── database ├── .gitignore ├── factories │ ├── BookFactory.php │ ├── CategoryFactory.php │ └── UserFactory.php ├── migrations │ ├── 2014_10_12_000000_create_users_table.php │ ├── 2014_10_12_100000_create_password_reset_tokens_table.php │ ├── 2014_10_12_200000_add_two_factor_columns_to_users_table.php │ ├── 2019_08_19_000000_create_failed_jobs_table.php │ ├── 2019_12_14_000001_create_personal_access_tokens_table.php │ ├── 2023_07_29_064500_create_permission_tables.php │ ├── 2023_10_01_063833_create_cards_table.php │ ├── 2023_10_01_224407_create_categories_table.php │ ├── 2023_10_01_224919_create_books_table.php │ ├── 2023_10_02_200305_create_borrows_table.php │ ├── 2023_10_02_201108_create_borrow_books_table.php │ └── 2023_10_06_212602_add_some_columns_to_books_table.php └── seeders │ ├── AdminSeeder.php │ ├── AnggotaSeeder.php │ ├── BookSeeder.php │ ├── CategorySeeder.php │ ├── DatabaseSeeder.php │ ├── PermissionSeeder.php │ ├── Permissions │ ├── BorrowPermission.php │ ├── MemberPermissions.php │ ├── ModulePermissions.php │ └── UserPermissions.php │ └── PustakawanSeeder.php ├── docker-compose.yml ├── lang ├── en │ ├── auth.php │ ├── buku.php │ ├── general.php │ ├── pagination.php │ ├── passwords.php │ └── validation.php └── id │ ├── auth.php │ ├── buku.php │ ├── general.php │ ├── pagination.php │ ├── passwords.php │ └── validation.php ├── package.json ├── phpunit.xml ├── public ├── .htaccess ├── css │ ├── bootstrap.min.css │ └── sticky-footer-navbar.css ├── icon.ico ├── index.php ├── js │ └── barcodescanner.js ├── robots.txt └── vendor │ ├── bootstrap │ ├── css │ │ ├── bootstrap-grid.css │ │ ├── bootstrap-grid.css.map │ │ ├── bootstrap-grid.min.css │ │ ├── bootstrap-grid.min.css.map │ │ ├── bootstrap-reboot.css │ │ ├── bootstrap-reboot.css.map │ │ ├── bootstrap-reboot.min.css │ │ ├── bootstrap-reboot.min.css.map │ │ ├── bootstrap.css │ │ ├── bootstrap.css.map │ │ ├── bootstrap.min.css │ │ ├── bootstrap.min.css.bak │ │ └── bootstrap.min.css.map │ └── js │ │ ├── bootstrap.bundle.js │ │ ├── bootstrap.bundle.js.map │ │ ├── bootstrap.bundle.min.js │ │ ├── bootstrap.bundle.min.js.map │ │ ├── bootstrap.js │ │ ├── bootstrap.js.map │ │ ├── bootstrap.min.js │ │ └── bootstrap.min.js.map │ ├── datatables │ ├── dataTables.bootstrap4.css │ ├── dataTables.bootstrap4.js │ ├── dataTables.bootstrap4.min.css │ ├── dataTables.bootstrap4.min.js │ ├── jquery.dataTables.js │ └── jquery.dataTables.min.js │ ├── jquery │ └── jquery-3.7.0.min.js │ ├── log-viewer │ ├── app.css │ ├── app.js │ ├── app.js.LICENSE.txt │ ├── img │ │ ├── log-viewer-128.png │ │ ├── log-viewer-32.png │ │ └── log-viewer-64.png │ └── mix-manifest.json │ ├── popper │ └── popper.min.js │ ├── select2 │ ├── img │ │ ├── droparrows.png │ │ ├── select2-spinner.gif │ │ ├── select2.png │ │ └── select2x2.png │ ├── select2.min.css │ └── select2.min.js │ └── sweetalert │ └── sweetalert.all.js ├── resources ├── css │ └── app.css ├── js │ ├── app.js │ └── bootstrap.js └── views │ ├── components │ ├── datatable-action.blade.php │ ├── datatable.blade.php │ └── select2.blade.php │ ├── emails │ └── members │ │ └── card.blade.php │ ├── layouts │ ├── app.blade.php │ ├── menu.blade.php │ └── modal.blade.php │ ├── pages │ ├── auth │ │ ├── login.blade.php │ │ ├── set-password.blade.php │ │ └── verify-email.blade.php │ ├── book │ │ ├── create.blade.php │ │ ├── edit.blade.php │ │ └── index.blade.php │ ├── borrow │ │ ├── book │ │ │ └── index.blade.php │ │ ├── create.blade.php │ │ └── index.blade.php │ ├── home.blade.php │ ├── member │ │ ├── create.blade.php │ │ ├── edit.blade.php │ │ └── index.blade.php │ ├── module │ │ ├── action.blade.php │ │ └── index.blade.php │ ├── permission │ │ └── index.blade.php │ ├── role │ │ └── index.blade.php │ └── user │ │ ├── create.blade.php │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ ├── password.blade.php │ │ ├── profile.blade.php │ │ └── set-password.blade.php │ ├── pdf │ └── member │ │ └── card.blade.php │ ├── vendor │ └── sweetalert │ │ ├── alert.blade.php │ │ ├── alert.blade.php.bak │ │ └── sweetalert.all.js │ └── welcome.blade.php ├── routes ├── api.php ├── channels.php ├── console.php ├── datatables.php └── web.php ├── storage ├── app │ ├── .gitignore │ └── public │ │ └── .gitignore ├── framework │ ├── .gitignore │ ├── cache │ │ ├── .gitignore │ │ └── data │ │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ ├── testing │ │ └── .gitignore │ └── views │ │ └── .gitignore └── logs │ └── .gitignore ├── stubs └── nwidart-stubs │ ├── assets │ ├── js │ │ └── app.stub │ └── sass │ │ └── app.stub │ ├── command.stub │ ├── component-class.stub │ ├── component-view.stub │ ├── composer.stub │ ├── controller-api.stub │ ├── controller-plain.stub │ ├── controller.stub │ ├── event.stub │ ├── factory.stub │ ├── feature-test.stub │ ├── job-queued.stub │ ├── job.stub │ ├── json.stub │ ├── listener-duck.stub │ ├── listener-queued-duck.stub │ ├── listener-queued.stub │ ├── listener.stub │ ├── mail.stub │ ├── middleware.stub │ ├── migration │ ├── add.stub │ ├── create.stub │ ├── delete.stub │ ├── drop.stub │ └── plain.stub │ ├── model.stub │ ├── notification.stub │ ├── package.stub │ ├── policy.plain.stub │ ├── provider.stub │ ├── request.stub │ ├── resource-collection.stub │ ├── resource.stub │ ├── route-provider.stub │ ├── routes │ ├── api.stub │ └── web.stub │ ├── rule.stub │ ├── scaffold │ ├── config.stub │ └── provider.stub │ ├── seeder.stub │ ├── unit-test.stub │ ├── views │ ├── index.stub │ └── master.stub │ └── vite.stub ├── tests ├── CreatesApplication.php ├── Datasets │ └── UserDataset.php ├── Feature │ ├── BooksTest.php │ ├── BorrowsTest.php │ ├── HomeTest.php │ ├── MembersTest.php │ ├── ModulesTest.php │ ├── RoleTest.php │ └── UserTest.php ├── Pest.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 | indent_size = 4 7 | indent_style = space 8 | insert_final_newline = false 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 -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME=Perpustakaan 2 | APP_ENV=local 3 | APP_KEY= 4 | APP_DEBUG=true 5 | APP_URL=http://localhost:8000 6 | 7 | DENDA_RUPIAH=500 8 | 9 | LOG_CHANNEL=stack 10 | LOG_DEPRECATIONS_CHANNEL=null 11 | LOG_LEVEL=debug 12 | 13 | DB_CONNECTION=mysql 14 | DB_HOST=127.0.0.1 15 | DB_PORT=3306 16 | DB_DATABASE=perpustakaan_sederhana 17 | DB_USERNAME=root 18 | DB_PASSWORD= 19 | 20 | BROADCAST_DRIVER=log 21 | CACHE_DRIVER=file 22 | FILESYSTEM_DISK=public 23 | QUEUE_CONNECTION=sync 24 | SESSION_DRIVER=file 25 | SESSION_LIFETIME=120 26 | 27 | MEMCACHED_HOST=127.0.0.1 28 | 29 | REDIS_HOST=127.0.0.1 30 | REDIS_PASSWORD=null 31 | REDIS_PORT=6379 32 | 33 | MAIL_MAILER=smtp 34 | MAIL_HOST=mailpit 35 | MAIL_PORT=1025 36 | MAIL_USERNAME=null 37 | MAIL_PASSWORD=null 38 | MAIL_ENCRYPTION=null 39 | MAIL_FROM_ADDRESS="hello@example.com" 40 | MAIL_FROM_NAME="${APP_NAME}" 41 | 42 | AWS_ACCESS_KEY_ID= 43 | AWS_SECRET_ACCESS_KEY= 44 | AWS_DEFAULT_REGION=us-east-1 45 | AWS_BUCKET= 46 | AWS_USE_PATH_STYLE_ENDPOINT=false 47 | 48 | PUSHER_APP_ID= 49 | PUSHER_APP_KEY= 50 | PUSHER_APP_SECRET= 51 | PUSHER_HOST= 52 | PUSHER_PORT=443 53 | PUSHER_SCHEME=https 54 | PUSHER_APP_CLUSTER=mt1 55 | 56 | VITE_APP_NAME="${APP_NAME}" 57 | VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 58 | VITE_PUSHER_HOST="${PUSHER_HOST}" 59 | VITE_PUSHER_PORT="${PUSHER_PORT}" 60 | VITE_PUSHER_SCHEME="${PUSHER_SCHEME}" 61 | VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 62 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 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 | .styleci.yml export-ignore 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.phpunit.cache 2 | /Modules 3 | /node_modules 4 | /public/build 5 | /public/hot 6 | /public/storage 7 | /storage/*.key 8 | /vendor 9 | .env 10 | .env.backup 11 | .env.production 12 | .phpunit.result.cache 13 | Homestead.json 14 | Homestead.yaml 15 | auth.json 16 | npm-debug.log 17 | yarn-error.log 18 | /.fleet 19 | /.idea 20 | /.vscode 21 | modules_statuses.json -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | all: install run migrate seed 2 | install: 3 | composer install 4 | run: 5 | ./vendor/bin/sail up -d 6 | migrate: 7 | # check mysql to be ready before doing db migration or seeding 8 | pass=$(. ./.env ; echo $DB_PASSWORD); \ 9 | while ! ./vendor/bin/sail exec mysql bash -c " mysqladmin ping -u sail -p$(echo $pass)"; do \ 10 | sleep 2; \ 11 | done; \ 12 | ./vendor/bin/sail artisan migrate 13 | seed: migrate 14 | pass=$(. ./.env ; echo $DB_PASSWORD); \ 15 | while ! ./vendor/bin/sail exec mysql bash -c " mysqladmin ping -u sail -p$(echo $pass)"; do \ 16 | sleep 2; \ 17 | done; \ 18 | ./vendor/bin/sail artisan db:seed 19 | restart: 20 | ./vendor/bin/sail restart 21 | stop: 22 | ./vendor/bin/sail stop 23 | rebuild: 24 | ./vendor/bin/sail build --no-cache -------------------------------------------------------------------------------- /app/Actions/Fortify/CreateNewUser.php: -------------------------------------------------------------------------------- 1 | $input 19 | */ 20 | public function create(array $input): User 21 | { 22 | Validator::make($input, [ 23 | 'name' => ['required', 'string', 'max:255'], 24 | 'email' => [ 25 | 'required', 26 | 'string', 27 | 'email', 28 | 'max:255', 29 | Rule::unique(User::class), 30 | ], 31 | 'password' => $this->passwordRules(), 32 | ])->validate(); 33 | 34 | return User::create([ 35 | 'name' => $input['name'], 36 | 'email' => $input['email'], 37 | 'password' => Hash::make($input['password']), 38 | ]); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/Actions/Fortify/PasswordValidationRules.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected function passwordRules(): array 15 | { 16 | return ['required', 'string', new Password, 'confirmed']; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/Actions/Fortify/ResetUserPassword.php: -------------------------------------------------------------------------------- 1 | $input 18 | */ 19 | public function reset(User $user, array $input): void 20 | { 21 | Validator::make($input, [ 22 | 'password' => $this->passwordRules(), 23 | ])->validate(); 24 | 25 | $user->forceFill([ 26 | 'password' => Hash::make($input['password']), 27 | ])->save(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/Actions/Fortify/UpdateUserPassword.php: -------------------------------------------------------------------------------- 1 | $input 18 | */ 19 | public function update(User $user, array $input): void 20 | { 21 | Validator::make($input, [ 22 | 'current_password' => ['required', 'string', 'current_password:web'], 23 | 'password' => $this->passwordRules(), 24 | ], [ 25 | 'current_password.current_password' => __('The provided password does not match your current password.'), 26 | ])->validateWithBag('updatePassword'); 27 | 28 | $user->forceFill([ 29 | 'password' => Hash::make($input['password']), 30 | ])->save(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Actions/Fortify/UpdateUserProfileInformation.php: -------------------------------------------------------------------------------- 1 | $input 17 | */ 18 | public function update(User $user, array $input): void 19 | { 20 | Validator::make($input, [ 21 | 'name' => ['required', 'string', 'max:255'], 22 | ])->validateWithBag('updateProfileInformation'); 23 | 24 | $user->forceFill([ 25 | 'name' => $input['name'], 26 | ])->save(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire')->hourly(); 16 | } 17 | 18 | /** 19 | * Register the commands for the application. 20 | */ 21 | protected function commands(): void 22 | { 23 | $this->load(__DIR__.'/Commands'); 24 | 25 | require base_path('routes/console.php'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | protected $dontFlash = [ 16 | 'current_password', 17 | 'password', 18 | 'password_confirmation', 19 | ]; 20 | 21 | /** 22 | * Register the exception handling callbacks for the application. 23 | */ 24 | public function register(): void 25 | { 26 | $this->reportable(function (Throwable $e) { 27 | // 28 | }); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Http/Controllers/BookController.php: -------------------------------------------------------------------------------- 1 | validated()); 41 | 42 | if (is_null($request->isbn)) $this->createISBN($book); 43 | 44 | return to_route('books.index')->withToastSuccess(__('buku.flash.store')); 45 | } 46 | 47 | /** 48 | * Display the specified resource. 49 | */ 50 | public function show(Book $book) 51 | { 52 | return self::edit($book); 53 | } 54 | 55 | /** 56 | * Show the form for editing the specified resource. 57 | */ 58 | public function edit(Book $book) 59 | { 60 | $data['title'] = __('buku.title.edit'); 61 | $data['book'] = $book; 62 | $data['category'] = Category::all(); 63 | return view('pages.book.edit', $data); 64 | } 65 | 66 | /** 67 | * Update the specified resource in storage. 68 | */ 69 | public function update(BookUpdateRequest $request, Book $book) 70 | { 71 | $book->update($request->validated()); 72 | 73 | return to_route('books.index')->withToastSuccess(__('buku.flash.update')); 74 | } 75 | 76 | /** 77 | * Remove the specified resource from storage. 78 | */ 79 | public function destroy(Book $book) 80 | { 81 | $book->delete(); 82 | return response()->json([ 83 | 'msg' => __('buku.flash.destroy') 84 | ], 200); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | orderBy('title'); 18 | return DataTables::of($query) 19 | ->addColumn('action', function ($row) { 20 | $data = [ 21 | 'edit_url' => route('books.edit', ['book' => $row->getKey()]), 22 | 'delete_url' => route('books.destroy', ['book' => $row->getKey()]), 23 | 'redirect_url' => route('books.index'), 24 | 'name' => $row->title, 25 | 'resource' => 'members', 26 | ]; 27 | 28 | return view('components.datatable-action', $data); 29 | }) 30 | ->editColumn('title', function ($row) { 31 | return "getKey()) . "' title='Detail' alt='Detail'>$row->title"; 32 | }) 33 | ->addColumn('category_id', function ($row) { 34 | return $row->category->category_name; // Access the author's name from the relationship 35 | }) 36 | ->rawColumns(["title"]) 37 | ->toJson(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/Http/Controllers/Datatables/BorrowBookDatatables.php: -------------------------------------------------------------------------------- 1 | where('borrow_id', $borrow->getKey())->orderByDesc('updated_at'); 19 | return DataTables::of($data) 20 | ->editColumn('return_at', function ($row) { 21 | return $row->return_at ? 'Returned' : '-'; 22 | }) 23 | ->addColumn('title', function ($row) { 24 | return $row->book->title; 25 | }) 26 | ->toJson(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Http/Controllers/Datatables/BorrowDatatables.php: -------------------------------------------------------------------------------- 1 | orderBy('start_at')->orderBy('return_at'); 18 | return DataTables::of($data) 19 | ->addColumn('name', function ($row) { 20 | $url = route('borrows.borrow_books.index', $row->getKey()); 21 | return "" . $row->user->name . " / " . $row->user->card->number . ""; 22 | }) 23 | ->addColumn('status', function ($row) { 24 | if (empty($row->start_at)) return "Processing"; 25 | if (empty($row->return_at)) return "Active"; 26 | return "Done"; 27 | }) 28 | ->addColumn('late_days', function ($row) { 29 | return $row->late_days; 30 | }) 31 | ->filterColumn('name', function ($query, $keyword) { 32 | $query->whereHas('user', function ($user) use ($keyword) { 33 | $user->where('name', 'like', "%$keyword%") 34 | ->orWhereHas('card', function ($card) use ($keyword) { 35 | $card->where('number', 'like', "%$keyword%"); 36 | }); 37 | }); 38 | }) 39 | ->rawColumns(['name']) 40 | ->toJson(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/Http/Controllers/Datatables/MemberDatatables.php: -------------------------------------------------------------------------------- 1 | orderBy('name'); 18 | return DataTables::of($data) 19 | ->addColumn('action', function ($row) { 20 | $data = [ 21 | 'edit_url' => route('members.edit', ['member' => $row->getKey()]), 22 | 'delete_url' => route('members.destroy', ['member' => $row->getKey()]), 23 | 'redirect_url' => route('members.index'), 24 | 'send_card_url' => route('members.send.card', ['member' => $row->getKey()]), 25 | 'name' => $row->name, 26 | 'resource' => 'members', 27 | 'custom_links' => [] 28 | ]; 29 | 30 | array_push($data['custom_links'], ['label' => 'Set Password', 'url' => route('users.reset.show', ['user' => $row->getKey()]), 'name' => 'users.reset.show']); 31 | 32 | return view('components.datatable-action', $data); 33 | }) 34 | ->editColumn('name', function ($row) { 35 | return "getKey()) . "' title='Detail' alt='Detail'>$row->name"; 36 | }) 37 | ->addColumn('kartu', function ($row) { 38 | return $row->card->number; 39 | }) 40 | ->rawColumns(['name', 'action']) 41 | ->toJson(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/Http/Controllers/Datatables/ModuleDatatables.php: -------------------------------------------------------------------------------- 1 | $module) { 20 | array_push($data, [ 21 | 'name' => $key 22 | ]); 23 | } 24 | 25 | return DataTables::of($data) 26 | ->addColumn('enabled', function ($row) { 27 | $status = self::status($row['name']) ? '✅' : '❌'; 28 | return $status; 29 | }) 30 | ->addColumn('action', function ($row) { 31 | $module = Module::find($row['name']); 32 | $data['status'] = self::status($row['name']); 33 | $data['module'] = $module->getName(); 34 | 35 | return view('pages.module.action', $data); 36 | }) 37 | ->rawColumns(['enabled', 'action']) 38 | ->toJson(); 39 | } 40 | 41 | private function status($module) { 42 | $status = Module::isEnabled($module) ? true : false; 43 | return $status; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/Http/Controllers/Datatables/RoleDatatables.php: -------------------------------------------------------------------------------- 1 | editColumn('name', function ($row) { 20 | return "getKey()) . "'>" . $row->name . ""; 21 | }) 22 | ->rawColumns(['name']) 23 | ->toJson(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/Http/Controllers/Datatables/UserDatatables.php: -------------------------------------------------------------------------------- 1 | orderBy('name')->where('id', '<>', auth()->id()); 18 | return DataTables::of($data) 19 | ->addColumn('action', function ($row) { 20 | $data = [ 21 | 'edit_url' => route('users.edit', ['user' => $row->getKey()]), 22 | 'delete_url' => route('users.destroy', ['user' => $row->getKey()]), 23 | 'redirect_url' => route('users.index'), 24 | 'name' => $row->name, 25 | 'resource' => 'users', 26 | 'custom_links' => [] 27 | ]; 28 | 29 | array_push($data['custom_links'], ['label' => 'Set Password', 'url' => route('users.reset.show', ['user' => $row->getKey()]), 'name' => 'users.reset.show']); 30 | 31 | return view('components.datatable-action', $data); 32 | }) 33 | ->editColumn('name', function ($row) { 34 | return "getKey()) . "' title='Detail' alt='Detail'>$row->name"; 35 | }) 36 | ->addColumn('kartu', function ($row) { 37 | return $row->card->number; 38 | }) 39 | ->addColumn('jabatan', function ($row) { 40 | return $row->jabatan; 41 | }) 42 | ->rawColumns(['name', 'action']) 43 | ->toJson(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/Http/Controllers/HomeController.php: -------------------------------------------------------------------------------- 1 | put('locale', $locale); 13 | return redirect()->back(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/Http/Controllers/ModuleController.php: -------------------------------------------------------------------------------- 1 | module); 24 | 25 | if (!$module) { 26 | throw new \Exception($request->module . ' module not found'); 27 | } 28 | 29 | if ($module->isEnabled()) { 30 | $module->disable(); 31 | $status = 'disabled'; 32 | } else { 33 | $module->enable(); 34 | $status = 'enabled'; 35 | } 36 | } catch (\Throwable $th) { 37 | Log::error( 38 | $th->getMessage(), 39 | [ 40 | 'action' => 'Update module status', 41 | 'data' => $request->module 42 | ] 43 | ); 44 | 45 | return to_route('modules.index')->withToastError($th->getMessage()); 46 | } 47 | 48 | return to_route('modules.index')->withToastSuccess($module->getName() . ' module ' . $status . ' successfully'); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/Http/Controllers/RoleController.php: -------------------------------------------------------------------------------- 1 | name; 18 | $data['role'] = $role; 19 | $data['permissions'] = Permission::pluck('name', 'id'); 20 | return view('pages.permission.index', $data); 21 | } 22 | 23 | /** 24 | * Store a newly created resource in storage. 25 | */ 26 | public function store(Request $request, Role $role) 27 | { 28 | try { 29 | DB::beginTransaction(); 30 | foreach($request->permissions as $permission) { 31 | $role->givePermissionTo($permission); 32 | } 33 | DB::commit(); 34 | } catch (\Throwable $th) { 35 | DB::rollBack(); 36 | return to_route('permissions.index', $role->getKey())->withToastError('Ups, ' . $th->getMessage()); 37 | } 38 | 39 | return to_route('permissions.index', $role->getKey())->withToastSuccess('Berhasil menambahkan permission'); 40 | } 41 | 42 | /** 43 | * Remove the specified resource from storage. 44 | */ 45 | public function destroy(Request $request, Role $role) 46 | { 47 | try { 48 | DB::beginTransaction(); 49 | foreach ($request->permissions as $permission) { 50 | $role->revokePermissionTo($permission); 51 | } 52 | DB::commit(); 53 | } catch (\Throwable $th) { 54 | DB::rollBack(); 55 | return to_route('permissions.index', $role->getKey())->withToastError('Ups, ' . $th->getMessage()); 56 | } 57 | 58 | return to_route('permissions.index', $role->getKey())->withToastSuccess('Berhasil mengurangi permission'); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /app/Http/Controllers/UserPasswordController.php: -------------------------------------------------------------------------------- 1 | name; 20 | $data['user'] = $user; 21 | } catch (\Throwable $th) { 22 | Log::error( 23 | $th->getMessage(), 24 | [ 25 | 'action' => 'Set password user', 26 | 'data' => $user ?? null 27 | ] 28 | ); 29 | return to_route('users.index')->withToastError($th->getMessage()); 30 | } 31 | 32 | return view('pages.user.set-password', $data); 33 | } 34 | 35 | /** 36 | * Update the specified resource in storage. 37 | */ 38 | public function update(Request $request, User $user) 39 | { 40 | $request->validate([ 41 | 'password' => 'required|string|min:8|confirmed' 42 | ]); 43 | try { 44 | DB::beginTransaction(); 45 | $user->password = bcrypt($request->password); 46 | if (is_null($user->email_verified_at)) { 47 | $user->email_verified_at = now(); 48 | $user->notify(new WelcomeNotification($user)); 49 | } 50 | $user->save(); 51 | DB::commit(); 52 | } catch (\Throwable $th) { 53 | DB::rollBack(); 54 | Log::error( 55 | $th->getMessage(), 56 | [ 57 | 'action' => 'Set password user', 58 | 'data' => $user ?? null 59 | ] 60 | ); 61 | 62 | return to_route('users.reset.show', $user->getKey())->withToastError($th->getMessage()); 63 | } 64 | 65 | return to_route('users.index')->withToastSuccess('Password set successfully!'); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | expectsJson() ? null : route('login'); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/Localization.php: -------------------------------------------------------------------------------- 1 | get('locale')); 20 | } 21 | return $next($request); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/Http/Middleware/PreventRequestsDuringMaintenance.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/RedirectIfAuthenticated.php: -------------------------------------------------------------------------------- 1 | check()) { 24 | return redirect(RouteServiceProvider::HOME); 25 | } 26 | } 27 | 28 | return $next($request); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /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(): array 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/ValidateSignature.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 'fbclid', 16 | // 'utm_campaign', 17 | // 'utm_content', 18 | // 'utm_medium', 19 | // 'utm_source', 20 | // 'utm_term', 21 | ]; 22 | } 23 | -------------------------------------------------------------------------------- /app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/WebPermission.php: -------------------------------------------------------------------------------- 1 | first(); 24 | if ($permissionRegistered) { 25 | $user = Auth::user(); 26 | if (!$user) abort(403); 27 | $roleId = $user->roles->pluck('id')->first(); 28 | $rolePermissions = DB::table('role_has_permissions')->where('role_id', $roleId) 29 | ->where('permission_id', $permissionRegistered->id) 30 | ->first(); 31 | 32 | $userPermission = DB::table('model_has_permissions')->where('model_id', $user->id) 33 | ->where('model_type', 'App\Models\User') 34 | ->where('permission_id', $permissionRegistered->id) 35 | ->first(); 36 | 37 | if (!$userPermission and !$rolePermissions) abort(404); 38 | } 39 | return $next($request); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/Http/Requests/BookStoreRequest.php: -------------------------------------------------------------------------------- 1 | user()->can('books.store'); 15 | } 16 | 17 | /** 18 | * Get the validation rules that apply to the request. 19 | * 20 | * @return array 21 | */ 22 | public function rules(): array 23 | { 24 | return [ 25 | 'title' => 'required|string|max:255', 26 | 'category_id' => 'required|exists:categories,id', 27 | 'author' => 'required|string|max:255', 28 | 'publish_year' => 'required|date_format:Y', 29 | 'description' => 'nullable|string', 30 | 'isbn' => 'nullable|unique:books' 31 | ]; 32 | } 33 | 34 | public function messages(): array 35 | { 36 | return [ 37 | 'publish_year.date_format' => 'Tahun terbit harus berformat tahun YYYY' 38 | ]; 39 | } 40 | 41 | public function attributes(): array 42 | { 43 | return [ 44 | 'title' => 'judul buku', 45 | 'category_id' => 'kategori', 46 | 'author' => 'penulis', 47 | 'publish_year' => 'tahun terbit', 48 | 'description' => 'sinopsis', 49 | ]; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/Http/Requests/BookUpdateRequest.php: -------------------------------------------------------------------------------- 1 | user()->can('books.update'); 15 | } 16 | 17 | /** 18 | * Get the validation rules that apply to the request. 19 | * 20 | * @return array 21 | */ 22 | public function rules(): array 23 | { 24 | return [ 25 | 'title' => 'required|string|max:255', 26 | 'category_id' => 'required|exists:categories,id', 27 | 'author' => 'required|string|max:255', 28 | 'publish_year' => 'required|date_format:Y', 29 | 'description' => 'nullable|string', 30 | ]; 31 | } 32 | 33 | public function messages(): array 34 | { 35 | return [ 36 | 'publish_year.date_format' => 'Tahun terbit harus berformat tahun YYYY' 37 | ]; 38 | } 39 | 40 | public function attributes(): array 41 | { 42 | return [ 43 | 'title' => 'judul buku', 44 | 'category_id' => 'kategori', 45 | 'author' => 'penulis', 46 | 'publish_year' => 'tahun terbit', 47 | 'description' => 'sinopsis', 48 | ]; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/Http/Requests/BorrowBookStoreRequest.php: -------------------------------------------------------------------------------- 1 | user()->can('borrows.borrow_books.store'); 15 | } 16 | 17 | /** 18 | * Get the validation rules that apply to the request. 19 | * 20 | * @return array 21 | */ 22 | public function rules(): array 23 | { 24 | return [ 25 | 'number' => 'required' 26 | ]; 27 | } 28 | 29 | public function messages(): array 30 | { 31 | return [ 32 | 'number.required' => 'Member card number not found' 33 | ]; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/Http/Requests/BorrowDestroyRequest.php: -------------------------------------------------------------------------------- 1 | user()->can('borrows.destroy'); 15 | } 16 | 17 | /** 18 | * Get the validation rules that apply to the request. 19 | * 20 | * @return array 21 | */ 22 | public function rules(): array 23 | { 24 | return [ 25 | 'number' => 'required|exists:cards,number' 26 | ]; 27 | } 28 | 29 | public function messages(): array 30 | { 31 | return [ 32 | 'number.exists' => 'Member card number not found' 33 | ]; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/Http/Requests/BorrowStoreRequest.php: -------------------------------------------------------------------------------- 1 | user()->can('borrows.store'); 15 | } 16 | 17 | /** 18 | * Get the validation rules that apply to the request. 19 | * 20 | * @return array 21 | */ 22 | public function rules(): array 23 | { 24 | return [ 25 | 'number' => 'required|exists:cards,number' 26 | ]; 27 | } 28 | 29 | public function messages(): array 30 | { 31 | return [ 32 | 'number.exists' => 'Member card number not found' 33 | ]; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/Http/Requests/BorrowUpdateRequest.php: -------------------------------------------------------------------------------- 1 | user()->can('borrows.update'); 15 | } 16 | 17 | /** 18 | * Get the validation rules that apply to the request. 19 | * 20 | * @return array 21 | */ 22 | public function rules(): array 23 | { 24 | return [ 25 | 'number' => 'required|exists:cards,number' 26 | ]; 27 | } 28 | 29 | public function messages(): array 30 | { 31 | return [ 32 | 'number.exists' => 'Member card number not found' 33 | ]; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/Http/Requests/StoreUserRequest.php: -------------------------------------------------------------------------------- 1 | user()->can('users.store'); 15 | } 16 | 17 | /** 18 | * Get the validation rules that apply to the request. 19 | * 20 | * @return array 21 | */ 22 | public function rules(): array 23 | { 24 | return [ 25 | 'name' => 'required|string|max:191', 26 | 'email' => 'required|email|max:191|unique:users', 27 | 'role' => 'required|exists:roles,name' 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Http/Requests/UpdateUserRequest.php: -------------------------------------------------------------------------------- 1 | user()->can('users.update'); 15 | } 16 | 17 | /** 18 | * Get the validation rules that apply to the request. 19 | * 20 | * @return array 21 | */ 22 | public function rules(): array 23 | { 24 | return [ 25 | 'name' => 'required|string|max:191', 26 | 'email' => 'required|email|max:191|unique:users,email,'. $this->user->id, 27 | 'role' => 'required|exists:roles,name' 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Http/Requests/VerificationUserRequest.php: -------------------------------------------------------------------------------- 1 | 21 | */ 22 | public function rules(): array 23 | { 24 | return [ 25 | 'email' => 'required|email|max:191|exists:users,email', 26 | 'password' => 'required|string|min:8|confirmed' 27 | ]; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/Mail/MemberCard.php: -------------------------------------------------------------------------------- 1 | $this->member->name, 45 | ] 46 | ); 47 | } 48 | 49 | /** 50 | * Get the attachments for the message. 51 | * 52 | * @return array 53 | */ 54 | public function attachments(): array 55 | { 56 | return [ 57 | Attachment::fromData(fn () => $this->memberCardPdf, $this->member->name . ' Member Card.pdf')->withMime('application/pdf'), 58 | ]; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /app/Models/Book.php: -------------------------------------------------------------------------------- 1 | belongsTo(Category::class); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Models/Borrow.php: -------------------------------------------------------------------------------- 1 | 'date', 19 | 'end_at' => 'date', 20 | 'return_at' => 'date', 21 | ]; 22 | 23 | protected $attributes = [ 24 | 'late_price' => 500, 25 | 'book_price' => 50000, 26 | // 'late_price' => config('perpustakaan.late_price'), 27 | // 'book_price' => config('perpustakaan.book_price'), 28 | ]; 29 | 30 | public function user(): BelongsTo 31 | { 32 | return $this->belongsTo(User::class); 33 | } 34 | 35 | public function borrow_books(): HasMany 36 | { 37 | return $this->hasMany(BorrowBook::class); 38 | } 39 | 40 | protected function lateDays(): Attribute 41 | { 42 | return Attribute::make( 43 | get: function () { 44 | $tanggal_kembali = $this->end_at; 45 | $tanggal_dikembalikan = $this->return_at; 46 | 47 | if (empty($tanggal_kembali) and empty($tanggal_dikembalikan)) return 0; 48 | 49 | if ($tanggal_kembali->isFuture()) return 0; 50 | 51 | if (empty($this->return_at)) $tanggal_dikembalikan = now(); 52 | 53 | return $tanggal_kembali->diffInDays($tanggal_dikembalikan); 54 | }, 55 | ); 56 | } 57 | 58 | protected function lateFee(): Attribute 59 | { 60 | return Attribute::make( 61 | get: function () { 62 | return $this->late_days * $this->late_price; 63 | } 64 | ); 65 | } 66 | 67 | protected function lostFee(): Attribute 68 | { 69 | return Attribute::make( 70 | get: function () { 71 | if (empty($this->return_at)) return 0; 72 | return ($this->books_borrowed - $this->books_returned) * $this->book_price; 73 | } 74 | ); 75 | } 76 | 77 | protected function totalFee(): Attribute 78 | { 79 | return Attribute::make( 80 | get: function () { 81 | if (empty($this->return_at)) return 0; 82 | return $this->late_fee + $this->lost_fee; 83 | } 84 | ); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /app/Models/BorrowBook.php: -------------------------------------------------------------------------------- 1 | belongsTo(Borrow::class); 18 | } 19 | 20 | public function book(): BelongsTo 21 | { 22 | return $this->belongsTo(Book::class, 'isbn', 'isbn'); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/Models/Card.php: -------------------------------------------------------------------------------- 1 | belongsTo(User::class); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/Models/Category.php: -------------------------------------------------------------------------------- 1 | 31 | */ 32 | protected $fillable = [ 33 | 'name', 34 | 'email', 35 | 'password', 36 | ]; 37 | 38 | /** 39 | * The attributes that should be hidden for serialization. 40 | * 41 | * @var array 42 | */ 43 | protected $hidden = [ 44 | 'password', 45 | 'remember_token', 46 | ]; 47 | 48 | /** 49 | * The attributes that should be cast. 50 | * 51 | * @var array 52 | */ 53 | protected $casts = [ 54 | 'email_verified_at' => 'datetime', 55 | 'password' => 'hashed', 56 | ]; 57 | 58 | protected function jabatan(): Attribute 59 | { 60 | return Attribute::make( 61 | get: function () { 62 | $user = User::find($this->id); 63 | return $user->getRoleNames()[0]; 64 | } 65 | ); 66 | } 67 | 68 | public function card(): HasOne 69 | { 70 | return $this->hasOne(Card::class); 71 | } 72 | 73 | public function borrows(): HasMany 74 | { 75 | return $this->hasMany(Borrow::class); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /app/Notifications/NewUserNotification.php: -------------------------------------------------------------------------------- 1 | 27 | */ 28 | public function via(object $notifiable): array 29 | { 30 | return ['mail']; 31 | } 32 | 33 | /** 34 | * Get the mail representation of the notification. 35 | */ 36 | public function toMail(object $notifiable): MailMessage 37 | { 38 | return (new MailMessage) 39 | ->subject('Account Confirmation') 40 | ->greeting('Salam, ' . $this->user->name . '!') 41 | ->line('Please confirm your account by clicking this link and set your secret password.') 42 | ->action('Confirm Account', route('user-verification.index', [$this->user->email, $this->user->remember_token])) 43 | ->line('If you didn\'t know about this, you don\'t have to do anything. '); 44 | } 45 | 46 | /** 47 | * Get the array representation of the notification. 48 | * 49 | * @return array 50 | */ 51 | public function toArray(object $notifiable): array 52 | { 53 | return [ 54 | // 55 | ]; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /app/Notifications/WelcomeNotification.php: -------------------------------------------------------------------------------- 1 | 27 | */ 28 | public function via(object $notifiable): array 29 | { 30 | return ['mail']; 31 | } 32 | 33 | /** 34 | * Get the mail representation of the notification. 35 | */ 36 | public function toMail(object $notifiable): MailMessage 37 | { 38 | return (new MailMessage) 39 | ->subject('Welcome, ' . $this->user->name . '!') 40 | ->greeting('Salam, ' . $this->user->name . '!') 41 | ->line('Congratulations on your new ' . config('app.name') . ' account ! ') 42 | ->line('You can access the site by clicking this link') 43 | ->action('Log in', route('login')) 44 | ->line('If you encounter any problem, please contact us.'); 45 | } 46 | 47 | /** 48 | * Get the array representation of the notification. 49 | * 50 | * @return array 51 | */ 52 | public function toArray(object $notifiable): array 53 | { 54 | return [ 55 | // 56 | ]; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | path() == '/'; 29 | return $isHomePath ? "active" : ""; 30 | } 31 | 32 | $routePrefix = route($routeName); 33 | $currentUrl = request()->url(); 34 | return Str::startsWith($currentUrl, $routePrefix) ? "active" : ""; 35 | }; 36 | $view->with('isActive', $isActive); 37 | }); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/Providers/AuthServiceProvider.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | protected $policies = [ 19 | // 20 | ]; 21 | 22 | /** 23 | * Register any authentication / authorization services. 24 | */ 25 | public function boot(): void 26 | { 27 | Gate::before(function ($user, $ability) { 28 | return $user->hasRole(User::ROLE_ADMINISTRATOR) ? true : null; 29 | }); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | > 16 | */ 17 | protected $listen = [ 18 | Registered::class => [ 19 | SendEmailVerificationNotification::class, 20 | ], 21 | ]; 22 | 23 | /** 24 | * Register any events for your application. 25 | */ 26 | public function boot(): void 27 | { 28 | // 29 | } 30 | 31 | /** 32 | * Determine if events and listeners should be automatically discovered. 33 | */ 34 | public function shouldDiscoverEvents(): bool 35 | { 36 | return false; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | by($request->user()?->id ?: $request->ip()); 29 | }); 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 | -------------------------------------------------------------------------------- /app/Traits/Randomizer.php: -------------------------------------------------------------------------------- 1 | padLeft(5, 0); 10 | 11 | $book->update([ 12 | 'isbn' => $isbn 13 | ]); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/View/Components/Datatable.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 | -------------------------------------------------------------------------------- /config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'null'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Broadcast Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the broadcast connections that will be used 26 | | to broadcast events to other systems or over websockets. Samples of 27 | | each available type of connection are provided inside this array. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'pusher' => [ 34 | 'driver' => 'pusher', 35 | 'key' => env('PUSHER_APP_KEY'), 36 | 'secret' => env('PUSHER_APP_SECRET'), 37 | 'app_id' => env('PUSHER_APP_ID'), 38 | 'options' => [ 39 | 'cluster' => env('PUSHER_APP_CLUSTER'), 40 | 'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', 41 | 'port' => env('PUSHER_PORT', 443), 42 | 'scheme' => env('PUSHER_SCHEME', 'https'), 43 | 'encrypted' => true, 44 | 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', 45 | ], 46 | 'client_options' => [ 47 | // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html 48 | ], 49 | ], 50 | 51 | 'ably' => [ 52 | 'driver' => 'ably', 53 | 'key' => env('ABLY_KEY'), 54 | ], 55 | 56 | 'redis' => [ 57 | 'driver' => 'redis', 58 | 'connection' => 'default', 59 | ], 60 | 61 | 'log' => [ 62 | 'driver' => 'log', 63 | ], 64 | 65 | 'null' => [ 66 | 'driver' => 'null', 67 | ], 68 | 69 | ], 70 | 71 | ]; 72 | -------------------------------------------------------------------------------- /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/nurfachmi.php: -------------------------------------------------------------------------------- 1 | '1.0.0', 8 | ]; -------------------------------------------------------------------------------- /config/perpustakaan.php: -------------------------------------------------------------------------------- 1 | 3, 8 | 9 | /** 10 | * Besar denda keterlambatan per hari. 11 | */ 12 | 'late_price' => 500, 13 | 14 | /** 15 | * Besar denda kehilangan per buku. 16 | */ 17 | 'book_price' => 50000, 18 | ]; -------------------------------------------------------------------------------- /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/BookFactory.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class BookFactory extends Factory 11 | { 12 | /** 13 | * Define the model's default state. 14 | * 15 | * @return array 16 | */ 17 | public function definition(): array 18 | { 19 | return [ 20 | 'isbn' => fake()->isbn10(), 21 | 'title' => str(fake('id_ID')->words(fake()->randomDigitNot(0), true))->title(), 22 | 'author' => fake('id_ID')->name(), 23 | 'publish_year' => fake()->year(), 24 | 'description' => fake('id_ID')->paragraph(2), 25 | 'category_id' => \App\Models\Category::inRandomOrder()->first()->id 26 | ]; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /database/factories/CategoryFactory.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class CategoryFactory extends Factory 11 | { 12 | /** 13 | * Define the model's default state. 14 | * 15 | * @return array 16 | */ 17 | public function definition(): array 18 | { 19 | return [ 20 | 'category_name' => str(fake('id_ID')->words(fake()->numberBetween(1,3), true))->title() 21 | ]; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /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(): array 19 | { 20 | return [ 21 | 'name' => fake()->name(), 22 | 'email' => fake()->unique()->safeEmail(), 23 | 'email_verified_at' => now(), 24 | 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 25 | 'remember_token' => Str::random(10), 26 | ]; 27 | } 28 | 29 | /** 30 | * Indicate that the model's email address should be unverified. 31 | */ 32 | public function unverified(): static 33 | { 34 | return $this->state(fn (array $attributes) => [ 35 | 'email_verified_at' => null, 36 | ]); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->string('name'); 17 | $table->string('email')->unique(); 18 | $table->timestamp('email_verified_at')->nullable(); 19 | $table->string('password'); 20 | $table->rememberToken(); 21 | $table->string('created_by')->nullable()->default('System'); 22 | $table->string('updated_by')->nullable()->default('System'); 23 | $table->string('deleted_by')->nullable(); 24 | $table->timestamps(); 25 | $table->softDeletes(); 26 | }); 27 | } 28 | 29 | /** 30 | * Reverse the migrations. 31 | */ 32 | public function down(): void 33 | { 34 | Schema::dropIfExists('users'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php: -------------------------------------------------------------------------------- 1 | string('email')->primary(); 16 | $table->string('token'); 17 | $table->timestamp('created_at')->nullable(); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | */ 24 | public function down(): void 25 | { 26 | Schema::dropIfExists('password_reset_tokens'); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_200000_add_two_factor_columns_to_users_table.php: -------------------------------------------------------------------------------- 1 | text('two_factor_secret') 17 | ->after('password') 18 | ->nullable(); 19 | 20 | $table->text('two_factor_recovery_codes') 21 | ->after('two_factor_secret') 22 | ->nullable(); 23 | 24 | if (Fortify::confirmsTwoFactorAuthentication()) { 25 | $table->timestamp('two_factor_confirmed_at') 26 | ->after('two_factor_recovery_codes') 27 | ->nullable(); 28 | } 29 | }); 30 | } 31 | 32 | /** 33 | * Reverse the migrations. 34 | */ 35 | public function down(): void 36 | { 37 | Schema::table('users', function (Blueprint $table) { 38 | $table->dropColumn(array_merge([ 39 | 'two_factor_secret', 40 | 'two_factor_recovery_codes', 41 | ], Fortify::confirmsTwoFactorAuthentication() ? [ 42 | 'two_factor_confirmed_at', 43 | ] : [])); 44 | }); 45 | } 46 | }; 47 | -------------------------------------------------------------------------------- /database/migrations/2019_08_19_000000_create_failed_jobs_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->string('uuid')->unique(); 17 | $table->text('connection'); 18 | $table->text('queue'); 19 | $table->longText('payload'); 20 | $table->longText('exception'); 21 | $table->timestamp('failed_at')->useCurrent(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | */ 28 | public function down(): void 29 | { 30 | Schema::dropIfExists('failed_jobs'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->morphs('tokenable'); 17 | $table->string('name'); 18 | $table->string('token', 64)->unique(); 19 | $table->text('abilities')->nullable(); 20 | $table->timestamp('last_used_at')->nullable(); 21 | $table->timestamp('expires_at')->nullable(); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | */ 29 | public function down(): void 30 | { 31 | Schema::dropIfExists('personal_access_tokens'); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /database/migrations/2023_10_01_063833_create_cards_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->foreignIdFor(User::class)->nullable()->constrained(); 18 | $table->string('number')->unique(); 19 | $table->date('start_date'); 20 | $table->date('end_date'); 21 | $table->tinyInteger('batch')->default(1); 22 | $table->text('note')->nullable(); 23 | $table->string('created_by')->nullable()->default('System'); 24 | $table->string('updated_by')->nullable()->default('System'); 25 | $table->timestamps(); 26 | }); 27 | } 28 | 29 | /** 30 | * Reverse the migrations. 31 | */ 32 | public function down(): void 33 | { 34 | Schema::dropIfExists('cards'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /database/migrations/2023_10_01_224407_create_categories_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->string("category_name"); 17 | $table->timestamps(); 18 | 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | */ 25 | public function down(): void 26 | { 27 | Schema::dropIfExists('categories'); 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /database/migrations/2023_10_01_224919_create_books_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string("isbn"); 18 | $table->string("title"); 19 | $table->string("author"); 20 | $table->foreignIdFor(Category::class)->constrained(); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | */ 28 | public function down(): void 29 | { 30 | Schema::dropIfExists('books'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /database/migrations/2023_10_02_200305_create_borrows_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->foreignIdFor(User::class)->constrained(); 18 | $table->date('start_at')->nullable(); 19 | $table->date('end_at')->nullable(); 20 | $table->date('return_at')->nullable(); 21 | $table->unsignedInteger('books_borrowed')->default(0); 22 | $table->unsignedInteger('books_returned')->default(0); 23 | $table->unsignedDouble('late_price')->default(config('perpustakaan.late_price')); 24 | $table->unsignedDouble('book_price')->default(config('perpustakaan.book_price')); 25 | $table->string('created_by')->nullable()->default('System'); 26 | $table->string('updated_by')->nullable()->default('System'); 27 | $table->timestamps(); 28 | }); 29 | } 30 | 31 | /** 32 | * Reverse the migrations. 33 | */ 34 | public function down(): void 35 | { 36 | Schema::dropIfExists('borrows'); 37 | } 38 | }; 39 | -------------------------------------------------------------------------------- /database/migrations/2023_10_02_201108_create_borrow_books_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->foreignIdFor(Borrow::class)->constrained(); 18 | $table->string('isbn'); 19 | $table->date('return_at')->nullable(); 20 | $table->timestamps(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | */ 27 | public function down(): void 28 | { 29 | Schema::dropIfExists('borrow_books'); 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /database/migrations/2023_10_06_212602_add_some_columns_to_books_table.php: -------------------------------------------------------------------------------- 1 | after('author', function (Blueprint $table) { 16 | $table->year('publish_year')->nullable(); 17 | $table->text('description')->nullable()->comment('Sinopsis buku atau keterangan lain'); 18 | }); 19 | $table->string('isbn')->nullable()->unique()->change(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | */ 26 | public function down(): void 27 | { 28 | Schema::table('books', function (Blueprint $table) { 29 | $table->dropUnique(['isbn']); 30 | $table->string('isbn')->nullable()->change(); 31 | $table->dropColumn(['publish_year', 'description']); 32 | }); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /database/seeders/AdminSeeder.php: -------------------------------------------------------------------------------- 1 | User::ROLE_ADMINISTRATOR]); 20 | 21 | $administrator = User::updateOrCreate( 22 | [ 23 | 'name' => 'Administrator', 24 | 'email' => 'admin@nurfachmi.com', 25 | ], 26 | [ 27 | 'password' => bcrypt('password'), 28 | 'email_verified_at' => now(), 29 | 'remember_token' => Str::random(10) 30 | ] 31 | )->assignRole($role_administrator); 32 | 33 | $card = Card::updateOrCreate( 34 | [ 35 | 'number' => str($administrator->getKey())->padLeft(5, '0') 36 | ], 37 | [ 38 | 'start_date' => now(), 39 | 'end_date' => now()->addYear() 40 | ] 41 | ); 42 | $card->user()->associate($administrator); 43 | $card->save(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /database/seeders/AnggotaSeeder.php: -------------------------------------------------------------------------------- 1 | User::ROLE_ANGGOTA]); 20 | 21 | $anggota = User::updateOrCreate( 22 | [ 23 | 'name' => 'Anggota', 24 | 'email' => 'anggota@nurfachmi.com', 25 | ], 26 | [ 27 | 'password' => bcrypt('password'), 28 | 'email_verified_at' => now(), 29 | 'remember_token' => Str::random(10) 30 | ] 31 | )->assignRole($role_anggota); 32 | 33 | $card = Card::updateOrCreate( 34 | [ 35 | 'number' => str($anggota->getKey())->padLeft(5, '0') 36 | ], 37 | [ 38 | 'start_date' => now(), 39 | 'end_date' => now()->addYear() 40 | ] 41 | ); 42 | $card->user()->associate($anggota); 43 | $card->save(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /database/seeders/BookSeeder.php: -------------------------------------------------------------------------------- 1 | count(50)->create(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /database/seeders/CategorySeeder.php: -------------------------------------------------------------------------------- 1 | count(10)->create(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /database/seeders/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call([ 16 | AdminSeeder::class, 17 | PustakawanSeeder::class, 18 | AnggotaSeeder::class, 19 | PermissionSeeder::class, 20 | CategorySeeder::class, 21 | BookSeeder::class, 22 | ]); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /database/seeders/PermissionSeeder.php: -------------------------------------------------------------------------------- 1 | forgetCachedPermissions(); 20 | $this->call([ 21 | UserPermissions::class, 22 | ModulePermissions::class, 23 | MemberPermissions::class, 24 | BorrowPermission::class, 25 | ]); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /database/seeders/Permissions/BorrowPermission.php: -------------------------------------------------------------------------------- 1 | map(fn ($name) => DB::table('permissions')->insertGetId(['name' => $name, 'guard_name' => 'web'])) 34 | ->toArray(); 35 | 36 | foreach ($roles as $role) { 37 | DB::table('role_has_permissions') 38 | ->insert( 39 | collect($permissionIds)->map(fn ($id) => [ 40 | 'role_id' => $role->id, 41 | 'permission_id' => $id 42 | ])->toArray() 43 | ); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /database/seeders/Permissions/MemberPermissions.php: -------------------------------------------------------------------------------- 1 | $roles, 31 | ]; 32 | 33 | $insertPermissions = fn ($role) => collect($permissionsByRole[$role]) 34 | ->map(fn ($name) => DB::table('permissions')->insertGetId(['name' => $name, 'guard_name' => 'web'])) 35 | ->toArray(); 36 | 37 | $permissionIdsByRole = [ 38 | User::ROLE_PUSTAKAWAN => $insertPermissions(User::ROLE_PUSTAKAWAN), 39 | ]; 40 | 41 | foreach ($permissionIdsByRole as $role => $permissionIds) { 42 | $role = Role::whereName($role)->first(); 43 | 44 | DB::table('role_has_permissions') 45 | ->insert( 46 | collect($permissionIds)->map(fn ($id) => [ 47 | 'role_id' => $role->id, 48 | 'permission_id' => $id 49 | ])->toArray() 50 | ); 51 | } 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /database/seeders/Permissions/ModulePermissions.php: -------------------------------------------------------------------------------- 1 | $roles, 26 | ]; 27 | 28 | $insertPermissions = fn ($role) => collect($permissionsByRole[$role]) 29 | ->map(fn ($name) => DB::table('permissions')->insertGetId(['name' => $name, 'guard_name' => 'web'])) 30 | ->toArray(); 31 | 32 | $permissionIdsByRole = [ 33 | User::ROLE_ADMINISTRATOR => $insertPermissions(User::ROLE_ADMINISTRATOR), 34 | ]; 35 | 36 | foreach ($permissionIdsByRole as $role => $permissionIds) { 37 | $role = Role::whereName($role)->first(); 38 | 39 | DB::table('role_has_permissions') 40 | ->insert( 41 | collect($permissionIds)->map(fn ($id) => [ 42 | 'role_id' => $role->id, 43 | 'permission_id' => $id 44 | ])->toArray() 45 | ); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /database/seeders/Permissions/UserPermissions.php: -------------------------------------------------------------------------------- 1 | $roles, 31 | ]; 32 | 33 | $insertPermissions = fn ($role) => collect($permissionsByRole[$role]) 34 | ->map(fn ($name) => DB::table('permissions')->insertGetId(['name' => $name, 'guard_name' => 'web'])) 35 | ->toArray(); 36 | 37 | $permissionIdsByRole = [ 38 | User::ROLE_ADMINISTRATOR => $insertPermissions(User::ROLE_ADMINISTRATOR), 39 | ]; 40 | 41 | foreach ($permissionIdsByRole as $role => $permissionIds) { 42 | $role = Role::whereName($role)->first(); 43 | 44 | DB::table('role_has_permissions') 45 | ->insert( 46 | collect($permissionIds)->map(fn ($id) => [ 47 | 'role_id' => $role->id, 48 | 'permission_id' => $id 49 | ])->toArray() 50 | ); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /database/seeders/PustakawanSeeder.php: -------------------------------------------------------------------------------- 1 | User::ROLE_PUSTAKAWAN]); 20 | 21 | $pustakawan = User::updateOrCreate( 22 | [ 23 | 'name' => 'Pustakawan', 24 | 'email' => 'pustakawan@nurfachmi.com', 25 | ], 26 | [ 27 | 'password' => bcrypt('password'), 28 | 'email_verified_at' => now(), 29 | 'remember_token' => Str::random(10) 30 | ] 31 | )->assignRole($role_pustakawan); 32 | 33 | $card = Card::updateOrCreate( 34 | [ 35 | 'number' => str($pustakawan->getKey())->padLeft(5, '0') 36 | ], 37 | [ 38 | 'start_date' => now(), 39 | 'end_date' => now()->addYear() 40 | ] 41 | ); 42 | $card->user()->associate($pustakawan); 43 | $card->save(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | laravel.test: 3 | build: 4 | context: ./vendor/laravel/sail/runtimes/8.2 5 | dockerfile: Dockerfile 6 | args: 7 | WWWGROUP: '${WWWGROUP}' 8 | image: sail-8.2/app 9 | extra_hosts: 10 | - 'host.docker.internal:host-gateway' 11 | ports: 12 | - '${APP_PORT:-80}:80' 13 | - '${VITE_PORT:-5173}:${VITE_PORT:-5173}' 14 | environment: 15 | WWWUSER: '${WWWUSER}' 16 | LARAVEL_SAIL: 1 17 | XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' 18 | XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' 19 | IGNITION_LOCAL_SITES_PATH: '${PWD}' 20 | volumes: 21 | - '.:/var/www/html' 22 | networks: 23 | - sail 24 | depends_on: 25 | - mysql 26 | - redis 27 | mysql: 28 | image: 'mysql/mysql-server:8.0' 29 | ports: 30 | - '${FORWARD_DB_PORT:-3306}:3306' 31 | environment: 32 | MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}' 33 | MYSQL_ROOT_HOST: '%' 34 | MYSQL_DATABASE: '${DB_DATABASE}' 35 | MYSQL_USER: '${DB_USERNAME}' 36 | MYSQL_PASSWORD: '${DB_PASSWORD}' 37 | MYSQL_ALLOW_EMPTY_PASSWORD: 1 38 | volumes: 39 | - 'sail-mysql:/var/lib/mysql' 40 | - './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh' 41 | networks: 42 | - sail 43 | healthcheck: 44 | test: 45 | - CMD 46 | - mysqladmin 47 | - ping 48 | - '-p${DB_PASSWORD}' 49 | retries: 3 50 | timeout: 5s 51 | redis: 52 | image: 'redis:alpine' 53 | ports: 54 | - '${FORWARD_REDIS_PORT:-6379}:6379' 55 | volumes: 56 | - 'sail-redis:/data' 57 | networks: 58 | - sail 59 | healthcheck: 60 | test: 61 | - CMD 62 | - redis-cli 63 | - ping 64 | retries: 3 65 | timeout: 5s 66 | mailpit: 67 | image: 'axllent/mailpit:v1.9' 68 | ports: 69 | - '${MAIL_PORT:-1025}:1025' 70 | - '8025:8025' 71 | networks: 72 | - sail 73 | networks: 74 | sail: 75 | driver: bridge 76 | volumes: 77 | sail-mysql: 78 | driver: local 79 | sail-redis: 80 | driver: local 81 | -------------------------------------------------------------------------------- /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/buku.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'index' => 'Books', 6 | 'create' => 'New Book', 7 | 'edit' => 'Edit Book' 8 | ], 9 | 'form' => [ 10 | 'title' => 'Title', 11 | 'category_id' => 'Category', 12 | 'author' => 'Author', 13 | 'publish_year' => 'Published Year', 14 | 'description' => 'Summary', 15 | 'isbn' => [ 16 | 'title' => 'ISBN', 17 | 'description' => 'This will be filled automatically if empty.' 18 | ] 19 | ], 20 | 'flash' => [ 21 | 'store' => 'The book has been saved successfully', 22 | 'update' => 'The book has been updated successfully', 23 | 'destroy' => 'The book has been deleted successfully' 24 | ] 25 | ]; 26 | -------------------------------------------------------------------------------- /lang/en/general.php: -------------------------------------------------------------------------------- 1 | 'Home', 14 | 'users' => 'Users', 15 | 'roles' => 'Roles', 16 | 'modules' => 'Modules', 17 | 'members' => 'Members', 18 | 'books' => 'Books', 19 | 'borrowing books' => 'Borrowing Books', 20 | 21 | // User Section 22 | 'name' => 'Name', 23 | 'member number' => 'Member Number', 24 | 'email' => 'Email', 25 | /* 26 | role sudah ada di navbar 27 | 'roles' => 'Roles', 28 | */ 29 | 'action' => 'Action', 30 | 'new user' => 'New User', 31 | 'export users' => 'Export Users', 32 | 'edit' => 'Edit', 33 | 'delete' => 'Delete', 34 | 'set password' => 'Set Password', 35 | ]; 36 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lang/id/auth.php: -------------------------------------------------------------------------------- 1 | 'Informasi yang diberikan tidak sesuai.', 17 | 'password' => 'Password keliru.', 18 | 'throttle' => 'Terlalu banyak percobaan masuk. Mohon tunggu dalam :seconds detik.', 19 | 20 | ]; 21 | -------------------------------------------------------------------------------- /lang/id/buku.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'index' => 'Data Buku', 6 | 'create' => 'Tambah Buku', 7 | 'edit' => 'Ubah Buku' 8 | ], 9 | 'form' => [ 10 | 'title' => 'Judul Buku', 11 | 'category_id' => 'Kategori', 12 | 'author' => 'Penulis', 13 | 'publish_year' => 'Tahun Terbit', 14 | 'description' => 'Sinopsis', 15 | 'isbn' => [ 16 | 'title' => 'ISBN', 17 | 'description' => 'Jika dikosongkan, akan diisi otomatis oleh sistem.' 18 | ] 19 | ], 20 | 'flash' => [ 21 | 'store' => 'Buku berhasil disimpan', 22 | 'update' => 'Buku berhasil diubah', 23 | 'destroy' => 'Buku berhasil dihapus' 24 | ] 25 | ]; -------------------------------------------------------------------------------- /lang/id/general.php: -------------------------------------------------------------------------------- 1 | 'Beranda', 14 | 'users' => 'Pengguna', 15 | 'roles' => 'Peran', 16 | 'modules' => 'Modul', 17 | 'members' => 'Anggota', 18 | 'books' => 'Buku', 19 | 'borrowing books' => 'Peminjaman Buku', 20 | 21 | // User Section 22 | 'name' => 'Nama', 23 | 'member number' => 'Nomor Anggota', 24 | 'email' => 'Alamat Email', 25 | /* 26 | role sudah ada di navbar 27 | 'roles' => 'Roles', 28 | */ 29 | 'action' => 'Aksi', 30 | 'new user' => 'Pengguna Baru', 31 | 'export users' => 'Ekspor Pengguna', 32 | 'edit' => 'Ubah', 33 | 'delete' => 'Hapus', 34 | 'set password' => 'Atur Password', 35 | 36 | ]; 37 | -------------------------------------------------------------------------------- /lang/id/pagination.php: -------------------------------------------------------------------------------- 1 | '« Sebelumnya', 17 | 'next' => 'Selanjutnya »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /lang/id/passwords.php: -------------------------------------------------------------------------------- 1 | 'Password Anda telah dipulihkan!', 17 | 'sent' => 'Kami telah mengirimkan email tentang tautan pemulihan password Anda!', 18 | 'throttled' => 'Mohon tunggu sebelum mencoba kembali.', 19 | 'token' => 'Token pemulihan password ini tidak valid.', 20 | 'user' => "Sistem kami tidak mendapati akun dengan alamat surel tersebut.", 21 | 'wrong' => "Password lama Anda kurang tepat.", 22 | 'same' => "Password baru tidak boleh sama dengan password sebelumnya.", 23 | 24 | ]; 25 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "type": "module", 4 | "scripts": { 5 | "dev": "vite", 6 | "build": "vite build" 7 | }, 8 | "devDependencies": { 9 | "axios": "^1.1.2", 10 | "laravel-vite-plugin": "^0.7.5", 11 | "vite": "^4.0.0" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | tests/Unit 10 | 11 | 12 | tests/Feature 13 | 14 | 15 | 16 | 17 | app 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews -Indexes 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Handle Authorization Header 9 | RewriteCond %{HTTP:Authorization} . 10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 11 | 12 | # Redirect Trailing Slashes If Not A Folder... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_URI} (.+)/$ 15 | RewriteRule ^ %1 [L,R=301] 16 | 17 | # Send Requests To Front Controller... 18 | RewriteCond %{REQUEST_FILENAME} !-d 19 | RewriteCond %{REQUEST_FILENAME} !-f 20 | RewriteRule ^ index.php [L] 21 | 22 | -------------------------------------------------------------------------------- /public/css/sticky-footer-navbar.css: -------------------------------------------------------------------------------- 1 | /* Custom page CSS 2 | -------------------------------------------------- */ 3 | /* Not required for template or sticky footer method. */ 4 | 5 | main > .container { 6 | padding: 90px 15px 0; 7 | } 8 | 9 | .footer { 10 | background-color: #f5f5f5; 11 | } 12 | 13 | .footer > .container { 14 | padding-right: 15px; 15 | padding-left: 15px; 16 | } 17 | 18 | code { 19 | font-size: 80%; 20 | } 21 | -------------------------------------------------------------------------------- /public/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nurfachmi/perpustakaan/2fa718538106a62a18379ed1bc0f737a7323c781/public/icon.ico -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class); 50 | 51 | $response = $kernel->handle( 52 | $request = Request::capture() 53 | )->send(); 54 | 55 | $kernel->terminate($request, $response); 56 | -------------------------------------------------------------------------------- /public/js/barcodescanner.js: -------------------------------------------------------------------------------- 1 | class BarcodeScanner { 2 | timeoutHandler = 0 3 | inputString = '' 4 | 5 | initialize = () => { 6 | document.addEventListener('keypress', this.keypress) 7 | if (this.timeoutHandler) { 8 | clearTimeout(this.timeoutHandler) 9 | } 10 | 11 | this.timeoutHandler = setTimeout(() => { 12 | this.inputString = '' 13 | }, 10) 14 | } 15 | 16 | close = () => { 17 | // Currently not using this function 18 | // Can be use later for SPA, or in some pages where only want to enable one-time scan 19 | document.removeEventListener('keypress', this.keypress) 20 | } 21 | 22 | keypress = (e) => { 23 | if (this.timeoutHandler) { 24 | clearTimeout(this.timeoutHandler) 25 | const keyCode = e.which 26 | if ((keyCode >= 48 && keyCode <= 57) || keyCode === 13) { 27 | // Only listen keycode 0-9 and Enter, since ISBN and Member ID is numeric 28 | this.inputString += String.fromCharCode(keyCode); 29 | } 30 | } 31 | 32 | this.timeoutHandler = setTimeout(() => { 33 | if (this.inputString.length <= 3) { 34 | this.inputString = '' 35 | return 36 | } 37 | 38 | const event = new CustomEvent("onbarcodescanned", { detail: this.inputString }); 39 | document.dispatchEvent(event); 40 | 41 | this.inputString = '' 42 | }, 10) 43 | } 44 | } 45 | 46 | window.BarcodeScanner = BarcodeScanner; -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /public/vendor/datatables/dataTables.bootstrap4.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | DataTables Bootstrap 4 integration 3 | ©2011-2017 SpryMedia Ltd - datatables.net/license 4 | */ 5 | (function(c){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(a){return c(a,window,document)}):"object"===typeof exports?module.exports=function(a,d){a||(a=window);if(!d||!d.fn.dataTable)d=require("datatables.net")(a,d).$;return c(d,a,a.document)}:c(jQuery,window,document)})(function(c,a,d,m){var f=c.fn.dataTable;c.extend(!0,f.defaults,{dom:"<'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>", 6 | renderer:"bootstrap"});c.extend(f.ext.classes,{sWrapper:"dataTables_wrapper dt-bootstrap4",sFilterInput:"form-control form-control-sm",sLengthSelect:"custom-select custom-select-sm form-control form-control-sm",sProcessing:"dataTables_processing card",sPageButton:"paginate_button page-item"});f.ext.renderer.pageButton.bootstrap=function(a,h,r,s,j,n){var o=new f.Api(a),t=a.oClasses,k=a.oLanguage.oPaginate,u=a.oLanguage.oAria.paginate||{},e,g,p=0,q=function(d,f){var l,h,i,b,m=function(a){a.preventDefault(); 7 | !c(a.currentTarget).hasClass("disabled")&&o.page()!=a.data.action&&o.page(a.data.action).draw("page")};l=0;for(h=f.length;l", 8 | {"class":t.sPageButton+" "+g,id:0===r&&"string"===typeof b?a.sTableId+"_"+b:null}).append(c("",{href:"#","aria-controls":a.sTableId,"aria-label":u[b],"data-dt-idx":p,tabindex:a.iTabIndex,"class":"page-link"}).html(e)).appendTo(d),a.oApi._fnBindAction(i,{action:b},m),p++)}},i;try{i=c(h).find(d.activeElement).data("dt-idx")}catch(v){}q(c(h).empty().html('
    ').children("ul"),s);i!==m&&c(h).find("[data-dt-idx="+i+"]").trigger("focus")};return f}); 9 | -------------------------------------------------------------------------------- /public/vendor/log-viewer/app.js.LICENSE.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | * The buffer module from node.js, for the browser. 3 | * 4 | * @author Feross Aboukhadijeh 5 | * @license MIT 6 | */ 7 | 8 | /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ 9 | 10 | /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ 11 | 12 | /** 13 | * @license 14 | * Lodash 15 | * Copyright OpenJS Foundation and other contributors 16 | * Released under MIT license 17 | * Based on Underscore.js 1.8.3 18 | * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 19 | */ 20 | -------------------------------------------------------------------------------- /public/vendor/log-viewer/img/log-viewer-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nurfachmi/perpustakaan/2fa718538106a62a18379ed1bc0f737a7323c781/public/vendor/log-viewer/img/log-viewer-128.png -------------------------------------------------------------------------------- /public/vendor/log-viewer/img/log-viewer-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nurfachmi/perpustakaan/2fa718538106a62a18379ed1bc0f737a7323c781/public/vendor/log-viewer/img/log-viewer-32.png -------------------------------------------------------------------------------- /public/vendor/log-viewer/img/log-viewer-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nurfachmi/perpustakaan/2fa718538106a62a18379ed1bc0f737a7323c781/public/vendor/log-viewer/img/log-viewer-64.png -------------------------------------------------------------------------------- /public/vendor/log-viewer/mix-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "/app.js": "/app.js?id=5f574f36f456b103dffcfa21d5612785", 3 | "/app.css": "/app.css?id=b701a4344131bb2c00e9f0b1ef1ab3c1", 4 | "/img/log-viewer-128.png": "/img/log-viewer-128.png?id=d576c6d2e16074d3f064e60fe4f35166", 5 | "/img/log-viewer-32.png": "/img/log-viewer-32.png?id=f8ec67d10f996aa8baf00df3b61eea6d", 6 | "/img/log-viewer-64.png": "/img/log-viewer-64.png?id=8902d596fc883ca9eb8105bb683568c6" 7 | } 8 | -------------------------------------------------------------------------------- /public/vendor/select2/img/droparrows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nurfachmi/perpustakaan/2fa718538106a62a18379ed1bc0f737a7323c781/public/vendor/select2/img/droparrows.png -------------------------------------------------------------------------------- /public/vendor/select2/img/select2-spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nurfachmi/perpustakaan/2fa718538106a62a18379ed1bc0f737a7323c781/public/vendor/select2/img/select2-spinner.gif -------------------------------------------------------------------------------- /public/vendor/select2/img/select2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nurfachmi/perpustakaan/2fa718538106a62a18379ed1bc0f737a7323c781/public/vendor/select2/img/select2.png -------------------------------------------------------------------------------- /public/vendor/select2/img/select2x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nurfachmi/perpustakaan/2fa718538106a62a18379ed1bc0f737a7323c781/public/vendor/select2/img/select2x2.png -------------------------------------------------------------------------------- /resources/css/app.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nurfachmi/perpustakaan/2fa718538106a62a18379ed1bc0f737a7323c781/resources/css/app.css -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | import './bootstrap'; 2 | -------------------------------------------------------------------------------- /resources/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | /** 2 | * We'll load the axios HTTP library which allows us to easily issue requests 3 | * to our Laravel back-end. This library automatically handles sending the 4 | * CSRF token as a header based on the value of the "XSRF" token cookie. 5 | */ 6 | 7 | import axios from 'axios'; 8 | window.axios = axios; 9 | 10 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 11 | 12 | /** 13 | * Echo exposes an expressive API for subscribing to channels and listening 14 | * for events that are broadcast by Laravel. Echo and event broadcasting 15 | * allows your team to easily build robust real-time web applications. 16 | */ 17 | 18 | // import Echo from 'laravel-echo'; 19 | 20 | // import Pusher from 'pusher-js'; 21 | // window.Pusher = Pusher; 22 | 23 | // window.Echo = new Echo({ 24 | // broadcaster: 'pusher', 25 | // key: import.meta.env.VITE_PUSHER_APP_KEY, 26 | // cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER ?? 'mt1', 27 | // wsHost: import.meta.env.VITE_PUSHER_HOST ? import.meta.env.VITE_PUSHER_HOST : `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`, 28 | // wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80, 29 | // wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443, 30 | // forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https', 31 | // enabledTransports: ['ws', 'wss'], 32 | // }); 33 | -------------------------------------------------------------------------------- /resources/views/components/datatable-action.blade.php: -------------------------------------------------------------------------------- 1 | @php 2 | $tombolKirimKartuAnggota = isset($send_card_url) ? "Kirim Kartu Anggota" : ''; 3 | $tombolUbah = isset($edit_url) ? "Ubah" : ''; 4 | $tombolHapus = isset($delete_url) ? "Hapus" : ''; 5 | @endphp 6 | 7 | @if ($tombolUbah || $tombolHapus || isset($custom_links)) 8 |
    9 | 47 | @stack('opsi') 48 |
    49 | @endif -------------------------------------------------------------------------------- /resources/views/components/select2.blade.php: -------------------------------------------------------------------------------- 1 | @push('js') 2 | 3 | 11 | @endpush -------------------------------------------------------------------------------- /resources/views/layouts/menu.blade.php: -------------------------------------------------------------------------------- 1 | 4 | @can('users.index') 5 | 8 | @endcan 9 | @can('roles.index') 10 | 13 | @endcan 14 | @can('modules.index') 15 | 18 | @endcan 19 | @can('members.index') 20 | 23 | @endcan 24 | @can('members.index') 25 | 28 | @endcan 29 | @can('borrows.index') 30 | 33 | @endcan 34 | -------------------------------------------------------------------------------- /resources/views/layouts/modal.blade.php: -------------------------------------------------------------------------------- 1 | 21 | 22 | @stack('modal') -------------------------------------------------------------------------------- /resources/views/pages/auth/login.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('title') 4 | Log in 5 | @endsection 6 | 7 | @section('body') 8 |
    9 |
    10 |
    11 |
    12 | Log in 13 |
    14 |
    15 |
    16 | @csrf 17 |
    18 | 19 |
    20 | 23 |
    {{ $message ?? '' }}
    24 |
    25 |
    26 | 27 |
    28 | 29 |
    30 | 31 |
    32 |
    33 | 34 |
    35 |
    36 |
    37 | 40 |
    41 |
    42 |
    43 | 44 |
    45 | 48 |
    49 |
    50 |
    51 |
    52 |
    53 |
    54 | 55 | @endsection 56 | -------------------------------------------------------------------------------- /resources/views/pages/auth/verify-email.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('title') 4 | Verify Email 5 | @endsection 6 | 7 | @section('body') 8 |
    9 |
    10 |
    11 |
    12 | Verify Email 13 |
    14 |
    15 |

    You have to confirm your account before anything else. Please check your email's inbox or spam to verify.

    16 |
    17 |
    18 |
    19 |
    20 | 21 | @endsection 22 | -------------------------------------------------------------------------------- /resources/views/pages/book/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('title', $title) 4 | 5 | @section('body') 6 |
    7 |
    8 |
    9 |

    {{ $title }}

    10 | @can('members.create') 11 |
    12 | 13 | {{ __('buku.title.create') }} 14 | 15 |
    16 | 19 | 22 |
    23 |
    24 | @endcan 25 |
    26 |
    27 |
    28 | 29 |
    30 |
    31 |
    32 |
    33 | @endsection 34 | -------------------------------------------------------------------------------- /resources/views/pages/borrow/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('title', $title) 4 | 5 | @section('body') 6 |
    7 |
    8 |
    9 |

    {{ $title }}

    10 | @can('borrows.index') 11 |
    12 | Back 13 |
    14 | @endcan 15 |
    16 |
    17 |
    18 |
    19 | @csrf 20 | 21 |
    22 |
    23 |
    #
    24 |
    25 | 27 |
    28 | 29 | 30 |
    31 |
    32 |
    33 |
    34 |
    35 | @endsection 36 | -------------------------------------------------------------------------------- /resources/views/pages/borrow/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('title', $title) 4 | 5 | @section('body') 6 |
    7 |
    8 |
    9 |

    {{ $title }}

    10 | @can('borrows.create') 11 | 14 | @endcan 15 |
    16 |
    17 |
    18 | 19 |
    20 |
    21 |
    22 |
    23 | @endsection 24 | -------------------------------------------------------------------------------- /resources/views/pages/home.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('title') 4 | Home 5 | @endsection 6 | 7 | @section('body') 8 |

    Home

    9 | @endsection -------------------------------------------------------------------------------- /resources/views/pages/member/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('title', $title) 4 | 5 | @section('body') 6 |
    7 |
    8 |
    9 |

    {{ $title }}

    10 | 11 | Back 12 | 13 |
    14 |
    15 |
    16 |
    17 | @csrf 18 |
    19 | 20 |
    21 | 23 | @error('name') 24 |
    {{ $message }}
    25 | @enderror 26 |
    27 |
    28 |
    29 | 30 |
    31 | 33 | @error('email') 34 |
    {{ $message }}
    35 | @enderror 36 |
    37 |
    38 |
    39 |
    40 | 41 |
    42 |
    43 | 44 |
    45 |
    46 |
    47 |
    48 |
    49 | @endsection 50 | -------------------------------------------------------------------------------- /resources/views/pages/member/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('title', $title) 4 | 5 | @section('body') 6 |
    7 |
    8 |
    9 |

    {{ $title }}

    10 | 11 | Back 12 | 13 |
    14 |
    15 |
    16 |
    17 | @csrf @method('PUT') 18 |
    19 | 20 |
    21 | 23 | @error('name') 24 |
    {{ $message }}
    25 | @enderror 26 |
    27 |
    28 |
    29 | 30 |
    31 | 33 | @error('email') 34 |
    {{ $message }}
    35 | @enderror 36 |
    37 |
    38 |
    39 |
    40 | 41 |
    42 |
    43 | 44 |
    45 |
    46 |
    47 |
    48 |
    49 | @endsection 50 | -------------------------------------------------------------------------------- /resources/views/pages/member/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('title', $title) 4 | 5 | @section('body') 6 |
    7 |
    8 |
    9 |

    {{ $title }}

    10 | @can('members.create') 11 |
    12 | New {{ str($title)->singular }} 13 |
    14 | 17 | 20 |
    21 |
    22 | @endcan 23 |
    24 |
    25 |
    26 | 27 |
    28 |
    29 |
    30 |
    31 | @endsection 32 | -------------------------------------------------------------------------------- /resources/views/pages/module/action.blade.php: -------------------------------------------------------------------------------- 1 |
    2 | @csrf 3 | 4 | @php 5 | $text = ($status) ? 'Disable' : 'Enable'; 6 | $btn = ($status) ? 'btn-danger' : 'btn-success'; 7 | @endphp 8 | 9 |
    -------------------------------------------------------------------------------- /resources/views/pages/module/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('title', $title) 4 | 5 | @section('body') 6 |
    7 |
    8 |
    9 |

    {{ $title }}

    10 |
    11 |
    12 |
    13 | 14 |
    15 |
    16 |
    17 |
    18 | @endsection 19 | -------------------------------------------------------------------------------- /resources/views/pages/role/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('title', $title) 4 | 5 | @section('body') 6 |
    7 |
    8 |
    9 |

    {{ $title }}

    10 | @can('roles.create') 11 |
    12 | New {{ str($title)->singular }} 13 |
    14 | 17 | 20 |
    21 |
    22 | @endcan 23 |
    24 |
    25 |
    26 | 27 |
    28 |
    29 |
    30 |
    31 | @endsection 32 | -------------------------------------------------------------------------------- /resources/views/pages/user/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('title', $title) 4 | 5 | @section('body') 6 |
    7 |
    8 |
    9 |

    {{ $title }}

    10 | @can('users.create') 11 |
    12 | New {{ str($title)->singular }} 13 |
    14 | 17 | 20 |
    21 |
    22 | @endcan 23 |
    24 |
    25 |
    26 | 27 |
    28 |
    29 |
    30 |
    31 | @endsection 32 | -------------------------------------------------------------------------------- /resources/views/pdf/member/card.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 |

    Perpustakaan

    24 |
      25 |
    • {{ $cardMemberNo }}
    • 26 |
    • {{ $cardMemberName }}
    • 27 |
    • {{ $cardMemberEmail }}
    • 28 |
    29 | 30 | Berlaku sampai: {{ $cardMemberExpired }} 31 | 32 | -------------------------------------------------------------------------------- /resources/views/vendor/sweetalert/alert.blade.php: -------------------------------------------------------------------------------- 1 | @if (config('sweetalert.alwaysLoadJS') === true && config('sweetalert.neverLoadJS') === false ) 2 | 3 | @endif 4 | @if (Session::has('alert.config')) 5 | @if(config('sweetalert.animation.enable')) 6 | 7 | @endif 8 | @if (config('sweetalert.alwaysLoadJS') === false && config('sweetalert.neverLoadJS') === false) 9 | 10 | @endif 11 | 14 | @endif -------------------------------------------------------------------------------- /resources/views/vendor/sweetalert/alert.blade.php.bak: -------------------------------------------------------------------------------- 1 | {{-- @if (Session::has('alert.config') || Session::has('alert.delete')) --}} 2 | @if (config('sweetalert.animation.enable')) 3 | 4 | @endif 5 | 6 | @if (config('sweetalert.theme') != 'default') 7 | 8 | @endif 9 | 10 | @if (config('sweetalert.alwaysLoadJS') == true && config('sweetalert.neverLoadJS') == false) 11 | 12 | @endif 13 | 39 | {{-- @endif --}} 40 | -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | get('/user', function (Request $request) { 18 | return $request->user(); 19 | }); 20 | -------------------------------------------------------------------------------- /routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 18 | }); 19 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 19 | })->purpose('Display an inspiring quote'); 20 | -------------------------------------------------------------------------------- /routes/datatables.php: -------------------------------------------------------------------------------- 1 | name('roles'); 13 | Route::get('users', UserDatatables::class)->name('users'); 14 | Route::get('modules', ModuleDatatables::class)->name('modules'); 15 | Route::get('members', MemberDatatables::class)->name('members'); 16 | Route::get('borrows', BorrowDatatables::class)->name('borrows'); 17 | Route::get('borrow-books/{borrow}', BorrowBookDatatables::class)->name('borrow-books'); 18 | Route::get('books', BookDatatables::class)->name('books'); 19 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /stubs/nwidart-stubs/assets/js/app.stub: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nurfachmi/perpustakaan/2fa718538106a62a18379ed1bc0f737a7323c781/stubs/nwidart-stubs/assets/js/app.stub -------------------------------------------------------------------------------- /stubs/nwidart-stubs/assets/sass/app.stub: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nurfachmi/perpustakaan/2fa718538106a62a18379ed1bc0f737a7323c781/stubs/nwidart-stubs/assets/sass/app.stub -------------------------------------------------------------------------------- /stubs/nwidart-stubs/command.stub: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /stubs/nwidart-stubs/composer.stub: -------------------------------------------------------------------------------- 1 | { 2 | "name": "$VENDOR$/$LOWER_NAME$", 3 | "description": "", 4 | "authors": [ 5 | { 6 | "name": "$AUTHOR_NAME$", 7 | "email": "$AUTHOR_EMAIL$" 8 | } 9 | ], 10 | "extra": { 11 | "laravel": { 12 | "providers": [], 13 | "aliases": { 14 | 15 | } 16 | } 17 | }, 18 | "autoload": { 19 | "psr-4": { 20 | "$MODULE_NAMESPACE$\\$STUDLY_NAME$\\": "" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /stubs/nwidart-stubs/controller-api.stub: -------------------------------------------------------------------------------- 1 | get('/'); 19 | 20 | $response->assertStatus(200); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /stubs/nwidart-stubs/job-queued.stub: -------------------------------------------------------------------------------- 1 | view('view.name'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /stubs/nwidart-stubs/middleware.stub: -------------------------------------------------------------------------------- 1 | id(); 18 | $FIELDS$ 19 | $table->timestamps(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('$TABLE$'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /stubs/nwidart-stubs/migration/delete.stub: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 28 | $FIELDS$ 29 | $table->timestamps(); 30 | }); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /stubs/nwidart-stubs/migration/plain.stub: -------------------------------------------------------------------------------- 1 | line('The introduction to the notification.') 45 | ->action('Notification Action', 'https://laravel.com') 46 | ->line('Thank you for using our application!'); 47 | } 48 | 49 | /** 50 | * Get the array representation of the notification. 51 | * 52 | * @param mixed $notifiable 53 | * @return array 54 | */ 55 | public function toArray($notifiable) 56 | { 57 | return [ 58 | // 59 | ]; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /stubs/nwidart-stubs/package.stub: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "vite", 5 | "build": "vite build" 6 | }, 7 | "devDependencies": { 8 | "axios": "^0.21.4", 9 | "dotenv": "^10.0.0", 10 | "dotenv-expand": "^5.1.0", 11 | "laravel-vite-plugin": "^0.6.0", 12 | "lodash": "^4.17.21", 13 | "postcss": "^8.3.7", 14 | "vite": "^3.0.9" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /stubs/nwidart-stubs/policy.plain.stub: -------------------------------------------------------------------------------- 1 | mapApiRoutes(); 37 | 38 | $this->mapWebRoutes(); 39 | } 40 | 41 | /** 42 | * Define the "web" routes for the application. 43 | * 44 | * These routes all receive session state, CSRF protection, etc. 45 | * 46 | * @return void 47 | */ 48 | protected function mapWebRoutes() 49 | { 50 | Route::middleware('web') 51 | ->namespace($this->moduleNamespace) 52 | ->group(module_path('$MODULE$', '$WEB_ROUTES_PATH$')); 53 | } 54 | 55 | /** 56 | * Define the "api" routes for the application. 57 | * 58 | * These routes are typically stateless. 59 | * 60 | * @return void 61 | */ 62 | protected function mapApiRoutes() 63 | { 64 | Route::prefix('api') 65 | ->middleware('api') 66 | ->namespace($this->moduleNamespace) 67 | ->group(module_path('$MODULE$', '$API_ROUTES_PATH$')); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /stubs/nwidart-stubs/routes/api.stub: -------------------------------------------------------------------------------- 1 | get('/$LOWER_NAME$', function (Request $request) { 17 | return $request->user(); 18 | }); -------------------------------------------------------------------------------- /stubs/nwidart-stubs/routes/web.stub: -------------------------------------------------------------------------------- 1 | group(function() { 15 | Route::get('/', '$STUDLY_NAME$Controller@index'); 16 | }); 17 | -------------------------------------------------------------------------------- /stubs/nwidart-stubs/rule.stub: -------------------------------------------------------------------------------- 1 | '$STUDLY_NAME$' 5 | ]; 6 | -------------------------------------------------------------------------------- /stubs/nwidart-stubs/seeder.stub: -------------------------------------------------------------------------------- 1 | call("OthersTableSeeder"); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /stubs/nwidart-stubs/unit-test.stub: -------------------------------------------------------------------------------- 1 | assertTrue(true); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /stubs/nwidart-stubs/views/index.stub: -------------------------------------------------------------------------------- 1 | @extends('$LOWER_NAME$::layouts.master') 2 | 3 | @section('content') 4 |

    Hello World

    5 | 6 |

    7 | This view is loaded from module: {!! config('$LOWER_NAME$.name') !!} 8 |

    9 | @endsection 10 | -------------------------------------------------------------------------------- /stubs/nwidart-stubs/views/master.stub: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Module $STUDLY_NAME$ 8 | 9 | {{-- Laravel Vite - CSS File --}} 10 | {{-- {{ module_vite('build-$LOWER_NAME$', 'Resources/assets/sass/app.scss') }} --}} 11 | 12 | 13 | 14 | @yield('content') 15 | 16 | {{-- Laravel Vite - JS File --}} 17 | {{-- {{ module_vite('build-$LOWER_NAME$', 'Resources/assets/js/app.js') }} --}} 18 | 19 | 20 | -------------------------------------------------------------------------------- /stubs/nwidart-stubs/vite.stub: -------------------------------------------------------------------------------- 1 | const dotenvExpand = require('dotenv-expand'); 2 | dotenvExpand(require('dotenv').config({ path: '../../.env'/*, debug: true*/})); 3 | 4 | import { defineConfig } from 'vite'; 5 | import laravel from 'laravel-vite-plugin'; 6 | 7 | export default defineConfig({ 8 | build: { 9 | outDir: '../../public/build-$LOWER_NAME$', 10 | emptyOutDir: true, 11 | manifest: true, 12 | }, 13 | plugins: [ 14 | laravel({ 15 | publicDirectory: '../../public', 16 | buildDirectory: 'build-$LOWER_NAME$', 17 | input: [ 18 | __dirname + '/Resources/assets/sass/app.scss', 19 | __dirname + '/Resources/assets/js/app.js' 20 | ], 21 | refresh: true, 22 | }), 23 | ], 24 | }); 25 | -------------------------------------------------------------------------------- /tests/CreatesApplication.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 18 | 19 | return $app; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/Datasets/UserDataset.php: -------------------------------------------------------------------------------- 1 | create(); 8 | $user->assignRole(User::ROLE_ADMINISTRATOR); 9 | 10 | return $user; 11 | }; 12 | }); 13 | 14 | dataset('user_pustakawan', function () { 15 | return yield function () { 16 | $user = User::factory()->create(); 17 | $user->assignRole(User::ROLE_PUSTAKAWAN); 18 | 19 | return $user; 20 | }; 21 | }); 22 | -------------------------------------------------------------------------------- /tests/Feature/BooksTest.php: -------------------------------------------------------------------------------- 1 | assertStatus(302); 11 | $response->assertRedirectToRoute('login'); 12 | }); 13 | 14 | test('can access books page (authenticated)', function (User $user) { 15 | actingAs($user); 16 | 17 | $response = get(route('books.index')); 18 | 19 | $response->assertStatus(200); 20 | $response->assertViewIs('pages.book.index'); 21 | $response->assertSeeText('Data Buku'); 22 | })->with('user_admin'); 23 | -------------------------------------------------------------------------------- /tests/Feature/BorrowsTest.php: -------------------------------------------------------------------------------- 1 | assertStatus(302); 11 | $response->assertRedirectToRoute('login'); 12 | }); 13 | 14 | test('can access borrows page (authenticated)', function (User $user) { 15 | actingAs($user); 16 | 17 | $response = get(route('borrows.index')); 18 | 19 | $response->assertStatus(200); 20 | $response->assertViewIs('pages.borrow.index'); 21 | $response->assertSeeText('Borrowing Books'); 22 | })->with('user_admin'); 23 | -------------------------------------------------------------------------------- /tests/Feature/HomeTest.php: -------------------------------------------------------------------------------- 1 | assertStatus(302); 11 | $response->assertRedirectToRoute('login'); 12 | }); 13 | 14 | test('can access home page (authenticated)', function (User $user) { 15 | actingAs($user); 16 | 17 | $response = get(route('home')); 18 | 19 | $response->assertStatus(200); 20 | $response->assertViewIs('pages.home'); 21 | $response->assertSeeText('Home'); 22 | })->with('user_admin'); 23 | -------------------------------------------------------------------------------- /tests/Feature/MembersTest.php: -------------------------------------------------------------------------------- 1 | assertStatus(302); 11 | $response->assertRedirectToRoute('login'); 12 | }); 13 | 14 | test('can access members page (authenticated)', function (User $user) { 15 | actingAs($user); 16 | 17 | $response = get(route('members.index')); 18 | 19 | $response->assertStatus(200); 20 | $response->assertViewIs('pages.member.index'); 21 | $response->assertSeeText('Members'); 22 | })->with('user_pustakawan'); 23 | -------------------------------------------------------------------------------- /tests/Feature/ModulesTest.php: -------------------------------------------------------------------------------- 1 | assertStatus(302); 11 | $response->assertRedirectToRoute('login'); 12 | }); 13 | 14 | test('can access modules page (authenticated)', function (User $user) { 15 | actingAs($user); 16 | 17 | $response = get(route('modules.index')); 18 | 19 | $response->assertStatus(200); 20 | $response->assertViewIs('pages.module.index'); 21 | $response->assertSeeText('Modules'); 22 | })->with('user_admin'); 23 | -------------------------------------------------------------------------------- /tests/Feature/RoleTest.php: -------------------------------------------------------------------------------- 1 | assertStatus(302); 11 | $response->assertRedirectToRoute('login'); 12 | }); 13 | 14 | test('can access roles page (authenticated)', function (User $user) { 15 | actingAs($user); 16 | 17 | $response = get(route('roles.index')); 18 | 19 | $response->assertStatus(200); 20 | $response->assertViewIs('pages.role.index'); 21 | $response->assertSeeText('Roles'); 22 | })->with('user_admin'); 23 | -------------------------------------------------------------------------------- /tests/Feature/UserTest.php: -------------------------------------------------------------------------------- 1 | assertStatus(302); 11 | $response->assertRedirectToRoute('login'); 12 | }); 13 | 14 | test('can access users page (authenticated)', function (User $user) { 15 | actingAs($user); 16 | 17 | $response = get(route('users.index')); 18 | 19 | $response->assertStatus(200); 20 | $response->assertViewIs('pages.user.index'); 21 | $response->assertSeeText('Users'); 22 | })->with('user_admin'); 23 | -------------------------------------------------------------------------------- /tests/Pest.php: -------------------------------------------------------------------------------- 1 | in('Feature'); 18 | 19 | /* 20 | |-------------------------------------------------------------------------- 21 | | Expectations 22 | |-------------------------------------------------------------------------- 23 | | 24 | | When you're writing tests, you often need to check that values meet certain conditions. The 25 | | "expect()" function gives you access to a set of "expectations" methods that you can use 26 | | to assert different things. Of course, you may extend the Expectation API at any time. 27 | | 28 | */ 29 | 30 | expect()->extend('toBeOne', function () { 31 | return $this->toBe(1); 32 | }); 33 | 34 | /* 35 | |-------------------------------------------------------------------------- 36 | | Functions 37 | |-------------------------------------------------------------------------- 38 | | 39 | | While Pest is very powerful out-of-the-box, you may have some testing code specific to your 40 | | project that you don't want to repeat in every file. Here you can also expose helpers as 41 | | global functions to help you to reduce the number of lines of code in your test files. 42 | | 43 | */ 44 | 45 | function something() 46 | { 47 | // .. 48 | } 49 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | toBeTrue(); 5 | }); 6 | -------------------------------------------------------------------------------- /vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite'; 2 | import laravel from 'laravel-vite-plugin'; 3 | 4 | export default defineConfig({ 5 | plugins: [ 6 | laravel({ 7 | input: ['resources/css/app.css', 'resources/js/app.js'], 8 | refresh: true, 9 | }), 10 | ], 11 | }); 12 | --------------------------------------------------------------------------------