diff --git a/.env.testing b/.env.testing new file mode 100644 index 0000000..47705cc --- /dev/null +++ b/.env.testing @@ -0,0 +1,5 @@ +APP_NAME=MauCuti +APP_KEY=base64:Sf4lkQVbx/5zVvdEfCV+NyOK1ck7AaDX17IgB5/GZbg= + +DB_CONNECTION=sqlite +DB_DATABASE=database/testing.sqlite diff --git a/app/Models/FormCuti.php b/app/Models/FormCuti.php new file mode 100644 index 0000000..1e61b85 --- /dev/null +++ b/app/Models/FormCuti.php @@ -0,0 +1,76 @@ + 'array', + ]; + + /** + * The table associated with the model. + * + * @var string + */ + protected $table = 'form_cuti'; + + public function staff(): BelongsTo + { + return $this->belongsTo(User::class, 'staff_id'); + } + + public function creator(): BelongsTo + { + return $this->belongsTo(User::class, 'creator_id'); + } + + // public function createRow(array $row): void + // { + // $row = Arr::only($row, ['tgl_mulai', 'tgl_selesai']); + + // $row['form_cuti_id'] = $this->id; + + // $row['supervisor'] = [ + // 'id' => null, + // 'terima' => false, + // 'keterangan' => null, + // ]; + + // $row['personalia'] = [ + // 'id' => $this->creator->id, + // 'terima' => false, + // 'keterangan' => null, + // ]; + + // // this runs setDataAttribute + // if (isset($this->attributes['data'])) { + // $this->data = array_merge($this->attributes['data'], [$row]); + // } else { + // $this->data = [$row]; + // } + // } +} diff --git a/app/Models/Group.php b/app/Models/Group.php new file mode 100644 index 0000000..bcd5e65 --- /dev/null +++ b/app/Models/Group.php @@ -0,0 +1,22 @@ +belongsTo(User::class, 'terima_personalia'); + } + + public function supervisor(): BelongsTo + { + return $this->belongsTo(User::class, 'terima_supervisor'); + } + + public function disetujuiOleh(): Attribute + { + return new Attribute( + get: fn ($value) => collect($this->personalia, $this->supervisor) + ); + } +} diff --git a/app/Models/User.php b/app/Models/User.php index 8996368..4f70439 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -4,13 +4,15 @@ use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Database\Eloquent\Factories\HasFactory; +use Illuminate\Database\Eloquent\Relations\HasOne; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; +use Junges\ACL\Concerns\HasGroups; use Laravel\Sanctum\HasApiTokens; class User extends Authenticatable { - use HasApiTokens, HasFactory, Notifiable; + use HasApiTokens, HasFactory, HasGroups, Notifiable; /** * The attributes that are mass assignable. @@ -41,4 +43,13 @@ class User extends Authenticatable protected $casts = [ 'email_verified_at' => 'datetime', ]; + + public function formCuti(): HasOne + { + if ($this->hasGroup('personalia')) { + return $this->hasOne(FormCuti::class, 'creator'); + } else { + return $this->hasOne(FormCuti::class, 'staff'); + } + } } diff --git a/composer.json b/composer.json index 2b0c115..b5fc613 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,8 @@ "guzzlehttp/guzzle": "^7.0.1", "laravel/framework": "^8.75", "laravel/sanctum": "^2.11", - "laravel/tinker": "^2.5" + "laravel/tinker": "^2.5", + "mateusjunges/laravel-acl": "^4.1" }, "require-dev": { "facade/ignition": "^2.5", diff --git a/composer.lock b/composer.lock index e309a38..33dd312 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c61ff82cbf0142a401a48a8161e1595a", + "content-hash": "253db0ace68ab9463cac7bf84d93cf4f", "packages": [ { "name": "asm89/stack-cors", @@ -493,6 +493,59 @@ ], "time": "2020-12-29T14:50:06+00:00" }, + { + "name": "facade/ignition-contracts", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/facade/ignition-contracts.git", + "reference": "3c921a1cdba35b68a7f0ccffc6dffc1995b18267" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/facade/ignition-contracts/zipball/3c921a1cdba35b68a7f0ccffc6dffc1995b18267", + "reference": "3c921a1cdba35b68a7f0ccffc6dffc1995b18267", + "shasum": "" + }, + "require": { + "php": "^7.3|^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^v2.15.8", + "phpunit/phpunit": "^9.3.11", + "vimeo/psalm": "^3.17.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Facade\\IgnitionContracts\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://flareapp.io", + "role": "Developer" + } + ], + "description": "Solution contracts for Ignition", + "homepage": "https://github.com/facade/ignition-contracts", + "keywords": [ + "contracts", + "flare", + "ignition" + ], + "support": { + "issues": "https://github.com/facade/ignition-contracts/issues", + "source": "https://github.com/facade/ignition-contracts/tree/1.0.2" + }, + "time": "2020-10-16T08:27:54+00:00" + }, { "name": "fruitcake/laravel-cors", "version": "v2.2.0", @@ -1660,6 +1713,89 @@ ], "time": "2022-04-17T13:12:02+00:00" }, + { + "name": "mateusjunges/laravel-acl", + "version": "v4.1.1", + "source": { + "type": "git", + "url": "https://github.com/mateusjunges/laravel-acl.git", + "reference": "83e9c8cc11b004ff6402fa60046c4fb9282c10ce" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mateusjunges/laravel-acl/zipball/83e9c8cc11b004ff6402fa60046c4fb9282c10ce", + "reference": "83e9c8cc11b004ff6402fa60046c4fb9282c10ce", + "shasum": "" + }, + "require": { + "facade/ignition-contracts": "^1.0", + "illuminate/auth": "^8.0|^9.0", + "illuminate/container": "^8.0|^9.0", + "illuminate/database": "^8.0|^9.0", + "illuminate/support": "^8.0|^9.0", + "php": "^7.4|^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.4", + "orchestra/testbench": "^6.0|^7.0", + "phpunit/phpunit": "^9.4", + "predis/predis": "^1.1" + }, + "suggest": { + "facade/igntion": "Needed to be able to use the ignition solutions for laravel-acl" + }, + "type": "laravel-package", + "extra": { + "laravel": { + "providers": [ + "Junges\\ACL\\Providers\\ACLServiceProvider", + "Junges\\ACL\\Providers\\ACLAuthServiceProvider", + "Junges\\ACL\\Providers\\ACLEventsServiceProvider" + ] + } + }, + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Junges\\ACL\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mateus Junges", + "email": "mateus@junges.dev", + "homepage": "https://twitter.com/mateusjungess", + "role": "Backend Software Engineer" + } + ], + "description": "This package provides a complete Access Control List management", + "homepage": "https://github.com/mateusjunges/laravel-acl", + "keywords": [ + "access-control-list", + "acl", + "junges", + "laravel", + "permissions", + "security" + ], + "support": { + "issues": "https://github.com/mateusjunges/laravel-acl/issues", + "source": "https://github.com/mateusjunges/laravel-acl" + }, + "funding": [ + { + "url": "https://www.patreon.com/mateusjunges", + "type": "patreon" + } + ], + "time": "2022-06-06T17:36:20+00:00" + }, { "name": "monolog/monolog", "version": "2.8.0", @@ -2463,30 +2599,30 @@ }, { "name": "psr/log", - "version": "1.1.4", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "url": "https://api.github.com/repos/php-fig/log/zipball/ef29f6d262798707a9edd554e2b82517ef3a9376", + "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\Log\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -2507,9 +2643,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" + "source": "https://github.com/php-fig/log/tree/2.0.0" }, - "time": "2021-05-03T11:20:27+00:00" + "time": "2021-07-14T16:41:46+00:00" }, { "name": "psr/simple-cache", @@ -2763,25 +2899,24 @@ }, { "name": "ramsey/uuid", - "version": "4.2.3", + "version": "4.3.1", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df" + "reference": "8505afd4fea63b81a85d3b7b53ac3cb8dc347c28" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df", - "reference": "fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/8505afd4fea63b81a85d3b7b53ac3cb8dc347c28", + "reference": "8505afd4fea63b81a85d3b7b53ac3cb8dc347c28", "shasum": "" }, "require": { "brick/math": "^0.8 || ^0.9", + "ext-ctype": "*", "ext-json": "*", - "php": "^7.2 || ^8.0", - "ramsey/collection": "^1.0", - "symfony/polyfill-ctype": "^1.8", - "symfony/polyfill-php80": "^1.14" + "php": "^8.0", + "ramsey/collection": "^1.0" }, "replace": { "rhumsaa/uuid": "self.version" @@ -2818,9 +2953,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "4.x-dev" - }, "captainhook": { "force-install": true } @@ -2845,7 +2977,7 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.2.3" + "source": "https://github.com/ramsey/uuid/tree/4.3.1" }, "funding": [ { @@ -2857,7 +2989,7 @@ "type": "tidelift" } ], - "time": "2021-09-25T23:10:38+00:00" + "time": "2022-03-27T21:42:02+00:00" }, { "name": "swiftmailer/swiftmailer", @@ -3036,21 +3168,20 @@ }, { "name": "symfony/css-selector", - "version": "v5.4.3", + "version": "v6.1.0", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "b0a190285cd95cb019237851205b8140ef6e368e" + "reference": "05c40f02f621609404b8820ff8bc39acb46e19cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/b0a190285cd95cb019237851205b8140ef6e368e", - "reference": "b0a190285cd95cb019237851205b8140ef6e368e", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/05c40f02f621609404b8820ff8bc39acb46e19cf", + "reference": "05c40f02f621609404b8820ff8bc39acb46e19cf", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1" }, "type": "library", "autoload": { @@ -3082,7 +3213,7 @@ "description": "Converts CSS selectors to XPath expressions", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/css-selector/tree/v5.4.3" + "source": "https://github.com/symfony/css-selector/tree/v6.1.0" }, "funding": [ { @@ -3098,29 +3229,29 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2022-02-25T11:15:52+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.2", + "version": "v3.1.1", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" + "reference": "07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918", + "reference": "07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.1-dev" }, "thanks": { "name": "symfony/contracts", @@ -3149,7 +3280,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.1.1" }, "funding": [ { @@ -3165,7 +3296,7 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2022-02-25T11:15:52+00:00" }, { "name": "symfony/error-handler", @@ -3240,40 +3371,38 @@ }, { "name": "symfony/event-dispatcher", - "version": "v5.4.9", + "version": "v6.1.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "8e6ce1cc0279e3ff3c8ff0f43813bc88d21ca1bc" + "reference": "a0449a7ad7daa0f7c0acd508259f80544ab5a347" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/8e6ce1cc0279e3ff3c8ff0f43813bc88d21ca1bc", - "reference": "8e6ce1cc0279e3ff3c8ff0f43813bc88d21ca1bc", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a0449a7ad7daa0f7c0acd508259f80544ab5a347", + "reference": "a0449a7ad7daa0f7c0acd508259f80544ab5a347", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/event-dispatcher-contracts": "^2|^3", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1", + "symfony/event-dispatcher-contracts": "^2|^3" }, "conflict": { - "symfony/dependency-injection": "<4.4" + "symfony/dependency-injection": "<5.4" }, "provide": { "psr/event-dispatcher-implementation": "1.0", - "symfony/event-dispatcher-implementation": "2.0" + "symfony/event-dispatcher-implementation": "2.0|3.0" }, "require-dev": { "psr/log": "^1|^2|^3", - "symfony/config": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/error-handler": "^4.4|^5.0|^6.0", - "symfony/expression-language": "^4.4|^5.0|^6.0", - "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/error-handler": "^5.4|^6.0", + "symfony/expression-language": "^5.4|^6.0", + "symfony/http-foundation": "^5.4|^6.0", "symfony/service-contracts": "^1.1|^2|^3", - "symfony/stopwatch": "^4.4|^5.0|^6.0" + "symfony/stopwatch": "^5.4|^6.0" }, "suggest": { "symfony/dependency-injection": "", @@ -3305,7 +3434,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.9" + "source": "https://github.com/symfony/event-dispatcher/tree/v6.1.0" }, "funding": [ { @@ -3321,24 +3450,24 @@ "type": "tidelift" } ], - "time": "2022-05-05T16:45:39+00:00" + "time": "2022-05-05T16:51:07+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v2.5.2", + "version": "v3.1.1", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "f98b54df6ad059855739db6fcbc2d36995283fe1" + "reference": "02ff5eea2f453731cfbc6bc215e456b781480448" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/f98b54df6ad059855739db6fcbc2d36995283fe1", - "reference": "f98b54df6ad059855739db6fcbc2d36995283fe1", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/02ff5eea2f453731cfbc6bc215e456b781480448", + "reference": "02ff5eea2f453731cfbc6bc215e456b781480448", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1", "psr/event-dispatcher": "^1" }, "suggest": { @@ -3347,7 +3476,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.1-dev" }, "thanks": { "name": "symfony/contracts", @@ -3384,7 +3513,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.1.1" }, "funding": [ { @@ -3400,7 +3529,7 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2022-02-25T11:15:52+00:00" }, { "name": "symfony/finder", @@ -4787,34 +4916,33 @@ }, { "name": "symfony/string", - "version": "v5.4.10", + "version": "v6.1.2", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "4432bc7df82a554b3e413a8570ce2fea90e94097" + "reference": "1903f2879875280c5af944625e8246d81c2f0604" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/4432bc7df82a554b3e413a8570ce2fea90e94097", - "reference": "4432bc7df82a554b3e413a8570ce2fea90e94097", + "url": "https://api.github.com/repos/symfony/string/zipball/1903f2879875280c5af944625e8246d81c2f0604", + "reference": "1903f2879875280c5af944625e8246d81c2f0604", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "~1.15" + "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": ">=3.0" + "symfony/translation-contracts": "<2.0" }, "require-dev": { - "symfony/error-handler": "^4.4|^5.0|^6.0", - "symfony/http-client": "^4.4|^5.0|^6.0", - "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0|^6.0" + "symfony/error-handler": "^5.4|^6.0", + "symfony/http-client": "^5.4|^6.0", + "symfony/translation-contracts": "^2.0|^3.0", + "symfony/var-exporter": "^5.4|^6.0" }, "type": "library", "autoload": { @@ -4853,7 +4981,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.10" + "source": "https://github.com/symfony/string/tree/v6.1.2" }, "funding": [ { @@ -4869,52 +4997,51 @@ "type": "tidelift" } ], - "time": "2022-06-26T15:57:47+00:00" + "time": "2022-06-26T16:35:04+00:00" }, { "name": "symfony/translation", - "version": "v5.4.9", + "version": "v6.1.0", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "1639abc1177d26bcd4320e535e664cef067ab0ca" + "reference": "b254416631615bc6fe49b0a67f18658827288147" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/1639abc1177d26bcd4320e535e664cef067ab0ca", - "reference": "1639abc1177d26bcd4320e535e664cef067ab0ca", + "url": "https://api.github.com/repos/symfony/translation/zipball/b254416631615bc6fe49b0a67f18658827288147", + "reference": "b254416631615bc6fe49b0a67f18658827288147", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", + "php": ">=8.1", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.16", - "symfony/translation-contracts": "^2.3" + "symfony/translation-contracts": "^2.3|^3.0" }, "conflict": { - "symfony/config": "<4.4", - "symfony/console": "<5.3", - "symfony/dependency-injection": "<5.0", - "symfony/http-kernel": "<5.0", - "symfony/twig-bundle": "<5.0", - "symfony/yaml": "<4.4" + "symfony/config": "<5.4", + "symfony/console": "<5.4", + "symfony/dependency-injection": "<5.4", + "symfony/http-kernel": "<5.4", + "symfony/twig-bundle": "<5.4", + "symfony/yaml": "<5.4" }, "provide": { - "symfony/translation-implementation": "2.3" + "symfony/translation-implementation": "2.3|3.0" }, "require-dev": { "psr/log": "^1|^2|^3", - "symfony/config": "^4.4|^5.0|^6.0", + "symfony/config": "^5.4|^6.0", "symfony/console": "^5.4|^6.0", - "symfony/dependency-injection": "^5.0|^6.0", - "symfony/finder": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/finder": "^5.4|^6.0", "symfony/http-client-contracts": "^1.1|^2.0|^3.0", - "symfony/http-kernel": "^5.0|^6.0", - "symfony/intl": "^4.4|^5.0|^6.0", + "symfony/http-kernel": "^5.4|^6.0", + "symfony/intl": "^5.4|^6.0", "symfony/polyfill-intl-icu": "^1.21", + "symfony/routing": "^5.4|^6.0", "symfony/service-contracts": "^1.1.2|^2|^3", - "symfony/yaml": "^4.4|^5.0|^6.0" + "symfony/yaml": "^5.4|^6.0" }, "suggest": { "psr/log-implementation": "To use logging capability in translator", @@ -4950,7 +5077,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v5.4.9" + "source": "https://github.com/symfony/translation/tree/v6.1.0" }, "funding": [ { @@ -4966,24 +5093,24 @@ "type": "tidelift" } ], - "time": "2022-05-06T12:33:37+00:00" + "time": "2022-05-11T12:12:29+00:00" }, { "name": "symfony/translation-contracts", - "version": "v2.5.2", + "version": "v3.1.1", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "136b19dd05cdf0709db6537d058bcab6dd6e2dbe" + "reference": "606be0f48e05116baef052f7f3abdb345c8e02cc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/136b19dd05cdf0709db6537d058bcab6dd6e2dbe", - "reference": "136b19dd05cdf0709db6537d058bcab6dd6e2dbe", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/606be0f48e05116baef052f7f3abdb345c8e02cc", + "reference": "606be0f48e05116baef052f7f3abdb345c8e02cc", "shasum": "" }, "require": { - "php": ">=7.2.5" + "php": ">=8.1" }, "suggest": { "symfony/translation-implementation": "" @@ -4991,7 +5118,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.1-dev" }, "thanks": { "name": "symfony/contracts", @@ -5001,7 +5128,10 @@ "autoload": { "psr-4": { "Symfony\\Contracts\\Translation\\": "" - } + }, + "exclude-from-classmap": [ + "/Test/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -5028,7 +5158,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/translation-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/translation-contracts/tree/v3.1.1" }, "funding": [ { @@ -5044,7 +5174,7 @@ "type": "tidelift" } ], - "time": "2022-06-27T16:58:25+00:00" + "time": "2022-06-27T17:24:16+00:00" }, { "name": "symfony/var-dumper", @@ -5615,59 +5745,6 @@ }, "time": "2022-06-30T18:26:59+00:00" }, - { - "name": "facade/ignition-contracts", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/facade/ignition-contracts.git", - "reference": "3c921a1cdba35b68a7f0ccffc6dffc1995b18267" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/facade/ignition-contracts/zipball/3c921a1cdba35b68a7f0ccffc6dffc1995b18267", - "reference": "3c921a1cdba35b68a7f0ccffc6dffc1995b18267", - "shasum": "" - }, - "require": { - "php": "^7.3|^8.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^v2.15.8", - "phpunit/phpunit": "^9.3.11", - "vimeo/psalm": "^3.17.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "Facade\\IgnitionContracts\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Freek Van der Herten", - "email": "freek@spatie.be", - "homepage": "https://flareapp.io", - "role": "Developer" - } - ], - "description": "Solution contracts for Ignition", - "homepage": "https://github.com/facade/ignition-contracts", - "keywords": [ - "contracts", - "flare", - "ignition" - ], - "support": { - "issues": "https://github.com/facade/ignition-contracts/issues", - "source": "https://github.com/facade/ignition-contracts/tree/1.0.2" - }, - "time": "2020-10-16T08:27:54+00:00" - }, { "name": "fakerphp/faker", "version": "v1.20.0", diff --git a/config/acl.php b/config/acl.php new file mode 100644 index 0000000..b63763f --- /dev/null +++ b/config/acl.php @@ -0,0 +1,106 @@ + [ + /* + | The model you want to use as Permission model must use the MateusJunges\ACL\Traits\PermissionsTrait + */ + 'permission' => Junges\ACL\Models\Permission::class, + + /* + | The model you want to use as Group model must use the MateusJunges\ACL\Traits\GroupsTrait + */ + 'group' => Junges\ACL\Models\Group::class, + ], + + /* + |-------------------------------------------------------------------------- + | Route Model Binding + |-------------------------------------------------------------------------- + | + | If you would like model binding to use a database column other than id when + | retrieving a given model class, you may override the getRouteKeyName method + | on the Eloquent model with yours. The default key used for route model binding + | in this package is the `id` database column. You can modify it by changing the + | following configuration: + | + */ + 'route_model_binding_keys' => [ + 'group_model' => 'id', + 'permission_model' => 'id', + ], + + /* + |-------------------------------------------------------------------------- + | Tables + |-------------------------------------------------------------------------- + | Specify the basics authentication tables that you are using. + | Once you required this package, the following tables are + | created by default when you run the command + | + | php artisan migrate + | + | If you want to change this tables, please keep the basic structure unchanged. + | + */ + 'tables' => [ + 'groups' => 'groups', + 'permissions' => 'permissions', + 'users' => 'users', + 'group_has_permissions' => 'group_has_permissions', + 'model_has_permissions' => 'model_has_permissions', + 'model_has_groups' => 'model_has_groups', + ], + + 'column_names' => [ + 'group_pivot_key' => null, + 'permission_pivot_key' => null, + 'model_morph_key' => 'model_id', + 'team_foreign_key' => 'team_id' + ], + + 'teams' => false, + + /* + |-------------------------------------------------------------------------- + | Ignition Solution Suggestions + |-------------------------------------------------------------------------- + | + | To enable the ignition solutions for laravel-acl, set this flag to true. + | + | The solutions will then be automatically registered with ignition if its installed. + | + */ + 'offer_solutions' => false, + + 'register_permission_check_method' => true, + + 'cache' => [ + /* + * All permissions are cached for 24 hours by default. If permissions or groups are updated, + * then the cache is flushed automatically. + */ + 'expiration_time' => DateInterval::createFromDateString('24 hours'), + + /* + * The cache key used to store permissions. + */ + 'key' => 'junges.acl.cache', + + /* + * You can optionally specify a cache driver to use for permissions caching using + * store drivers listed in config/cache.php. + */ + 'store' => 'default' + ] +]; diff --git a/config/app.php b/config/app.php index a8d1a82..ac24dcc 100644 --- a/config/app.php +++ b/config/app.php @@ -67,7 +67,7 @@ | */ - 'timezone' => 'UTC', + 'timezone' => 'Asia/Jakarta', /* |-------------------------------------------------------------------------- @@ -80,7 +80,7 @@ | */ - 'locale' => 'en', + 'locale' => 'id', /* |-------------------------------------------------------------------------- diff --git a/database/factories/AclGroupFactory.php b/database/factories/AclGroupFactory.php new file mode 100644 index 0000000..d2e808d --- /dev/null +++ b/database/factories/AclGroupFactory.php @@ -0,0 +1,58 @@ + $this->faker->unique()->randomElement([ + 'personalia', 'supervisor', 'staff', + ]), + 'guard_name' => 'web', + ]; + } + + public function personalia(): static + { + return $this->state(function (array $attributes) { + return [ + 'name' => 'personalia', + ]; + }); + } + + public function supervisor(): static + { + return $this->state(function (array $attributes) { + return [ + 'name' => 'supervisor', + ]; + }); + } + + public function staff(): static + { + return $this->state(function (array $attributes) { + return [ + 'name' => 'staff', + ]; + }); + } +} diff --git a/database/factories/FormCutiFactory.php b/database/factories/FormCutiFactory.php new file mode 100644 index 0000000..9e879ca --- /dev/null +++ b/database/factories/FormCutiFactory.php @@ -0,0 +1,20 @@ +has(Group::factory()->personalia()->count(1)); + } + + public function supervisor() + { + return $this->has(Group::factory()->supervisor()->count(1)); + } + + public function staff() + { + return $this->has(Group::factory()->staff()->count(1)); + } } diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 621a24e..42d1c34 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -21,6 +21,7 @@ public function up() $table->string('password'); $table->rememberToken(); $table->timestamps(); + $table->softDeletes(); }); } diff --git a/database/migrations/2022_07_25_213532_create_permissions_table.php b/database/migrations/2022_07_25_213532_create_permissions_table.php new file mode 100644 index 0000000..87b28e1 --- /dev/null +++ b/database/migrations/2022_07_25_213532_create_permissions_table.php @@ -0,0 +1,29 @@ +bigIncrements('id'); + $table->string('name'); + $table->string('guard_name'); + $table->text('description')->nullable(); + $table->softDeletes(); + $table->timestamps(); + + $table->unique(['name', 'guard_name']); + }); + } + + public function down() + { + $tables = config('acl.tables'); + Schema::dropIfExists($tables['permissions']); + } +} diff --git a/database/migrations/2022_07_25_213534_create_groups_table.php b/database/migrations/2022_07_25_213534_create_groups_table.php new file mode 100644 index 0000000..7c7ccc7 --- /dev/null +++ b/database/migrations/2022_07_25_213534_create_groups_table.php @@ -0,0 +1,42 @@ +bigIncrements('id'); + + if ($teams || config("acl.testing")) { + $table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable(); + $table->index($columnNames['team_foreign_key'], 'groups_team_foreign_key_index'); + } + + $table->string('name'); + $table->string('guard_name'); + $table->text('description')->nullable(); + $table->softDeletes(); + $table->timestamps(); + + if ($teams || config('acl.testing')) { + $table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']); + } else { + $table->unique(['name', 'guard_name']); + } + }); + } + + public function down() + { + $groupsTable = config('acl.tables.groups', 'groups'); + Schema::dropIfExists($groupsTable); + } +} diff --git a/database/migrations/2022_07_25_213536_create_model_has_permissions_table.php b/database/migrations/2022_07_25_213536_create_model_has_permissions_table.php new file mode 100644 index 0000000..87a9224 --- /dev/null +++ b/database/migrations/2022_07_25_213536_create_model_has_permissions_table.php @@ -0,0 +1,47 @@ +unsignedBigInteger(AclRegistrar::$pivotPermission); + $table->string('model_type'); + $table->unsignedBigInteger($columnNames['model_morph_key']); + $table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_id_model_type_index'); + + $table->foreign(AclRegistrar::$pivotPermission) + ->references('id') + ->on($permissionsTable) + ->cascadeOnDelete(); + + if ($teams) { + $table->unsignedBigInteger($columnNames['team_foreign_key']); + $table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index'); + + $table->primary([$columnNames['team_foreign_key'], AclRegistrar::$pivotPermission, $columnNames['model_morph_key'], 'model_type'], + 'model_has_permissions_permission_model_type_primary'); + } else { + $table->primary([AclRegistrar::$pivotPermission, $columnNames['model_morph_key'], 'model_type'], + 'model_has_permissions_permission_model_type_primary'); + } + }); + } + + public function down() + { + $modelHasPermissionTable = config('acl.tables.model_has_permissions', 'model_has_permissions'); + Schema::dropIfExists($modelHasPermissionTable); + } +} diff --git a/database/migrations/2022_07_25_213538_create_model_has_groups_table.php b/database/migrations/2022_07_25_213538_create_model_has_groups_table.php new file mode 100644 index 0000000..601ee37 --- /dev/null +++ b/database/migrations/2022_07_25_213538_create_model_has_groups_table.php @@ -0,0 +1,47 @@ +unsignedBigInteger(AclRegistrar::$pivotGroup); + + $table->string('model_type'); + $table->unsignedBigInteger($columnNames['model_morph_key']); + $table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_groups_model_id_model_type_index'); + + $table->foreign(AclRegistrar::$pivotGroup) + ->references('id') + ->on($groupsTable) + ->cascadeOnDelete(); + + if ($teams) { + $table->unsignedBigInteger($columnNames['team_foreign_key']); + $table->index($columnNames['team_foreign_key'], 'model_has_groups_team_foreign_key_index'); + + $table->primary([$columnNames['team_foreign_key'], AclRegistrar::$pivotGroup, $columnNames['model_morph_key'], 'model_type'], + 'model_has_groups_group_model_type_primary'); + } else { + $table->primary([AclRegistrar::$pivotGroup, $columnNames['model_morph_key'], 'model_type'], + 'model_has_groups_group_model_type_primary'); + } + }); + } + + public function down() + { + $modelHasGroupsTable = config('acl.tables.model_has_groups', 'model_has_groups'); + Schema::dropIfExists($modelHasGroupsTable); + } +} diff --git a/database/migrations/2022_07_25_213540_create_group_has_permissions_table.php b/database/migrations/2022_07_25_213540_create_group_has_permissions_table.php new file mode 100644 index 0000000..ca45663 --- /dev/null +++ b/database/migrations/2022_07_25_213540_create_group_has_permissions_table.php @@ -0,0 +1,40 @@ +unsignedBigInteger(AclRegistrar::$pivotPermission); + $table->unsignedBigInteger(AclRegistrar::$pivotGroup); + + $table->foreign(AclRegistrar::$pivotPermission) + ->references('id') + ->on($permissionsTable) + ->cascadeOnDelete(); + + $table->foreign(AclRegistrar::$pivotGroup) + ->references('id') + ->on($groupsTable) + ->cascadeOnDelete(); + + $table->primary([AclRegistrar::$pivotPermission, AclRegistrar::$pivotGroup], 'group_has_permission_permission_id_group_id_primary'); + }); + } + + public function down() + { + $groupHasPermissionsTable = config('acl.tables.group_has_permissions', 'group_has_permissions'); + + Schema::dropIfExists($groupHasPermissionsTable); + } +} diff --git a/database/migrations/2022_07_25_213714_create_form_cuti_table.php b/database/migrations/2022_07_25_213714_create_form_cuti_table.php new file mode 100644 index 0000000..758bbfa --- /dev/null +++ b/database/migrations/2022_07_25_213714_create_form_cuti_table.php @@ -0,0 +1,37 @@ +id(); + $table->text('keterangan')->nullable(); + $table->json('data')->nullable(); + $table->foreignIdFor(User::class, 'staff_id'); + $table->foreignIdFor(User::class, 'creator_id'); + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('form_cuti'); + } +} diff --git a/database/migrations/2022_07_26_064748_create_pengajuan_table.php b/database/migrations/2022_07_26_064748_create_pengajuan_table.php new file mode 100644 index 0000000..9bed961 --- /dev/null +++ b/database/migrations/2022_07_26_064748_create_pengajuan_table.php @@ -0,0 +1,39 @@ +id(); + $table->foreignIdFor(FormCuti::class); + $table->date('tgl_mulai'); + $table->date('tgl_selesai'); + $table->foreignIdFor(User::class, 'terima_personalia')->nullable(); + $table->foreignIdFor(User::class, 'terima_supervisor')->nullable(); + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('pengajuans'); + } +} diff --git a/database/seeders/AclTableSeeder.php b/database/seeders/AclTableSeeder.php new file mode 100644 index 0000000..f0b1f1f --- /dev/null +++ b/database/seeders/AclTableSeeder.php @@ -0,0 +1,60 @@ +groupSeeder(); + $this->permissionSeeder(); + $this->assignPermissionsToGroups(); + } + + protected function groupSeeder(): void + { + $this->groups['personalia'] = Group::create(['name' => 'personalia']); + $this->groups['supervisor'] = Group::create(['name' => 'supervisor']); + $this->groups['staff'] = Group::create(['name' => 'staff']); + } + + protected function permissionSeeder(): void + { + Permission::create(['name' => 'view-user']); + Permission::create(['name' => 'view-user.group']); + Permission::create(['name' => 'view-form']); + Permission::create(['name' => 'view-form.group']); + Permission::create(['name' => 'create-form']); + Permission::create(['name' => 'update-form']); + Permission::create(['name' => 'delete-form']); + Permission::create(['name' => 'create-row']); + Permission::create(['name' => 'update-row']); + // Permission::create(['name' => 'delete-row']); + } + + protected function assignPermissionsToGroups(): void + { + $this->groups['personalia']->assignPermission([ + 'view-user', 'view-form', 'create-form', 'update-form', 'delete-form', 'update-row', + ]); + + $this->groups['supervisor']->assignPermission([ + 'view-user.group', 'view-form.group', 'update-row', + ]); + + $this->groups['staff']->assignPermission([ + 'create-row', + ]); + } +} diff --git a/resources/lang/vendor/acl/de/acl.php b/resources/lang/vendor/acl/de/acl.php new file mode 100644 index 0000000..95a2f63 --- /dev/null +++ b/resources/lang/vendor/acl/de/acl.php @@ -0,0 +1,18 @@ + 'Dieser Benutzer verfügt nicht über die erforderlichen Gruppen, um auf diese Route zuzugreifen.', + 'forPermissions' => 'Dieser Benutzer verfügt nicht über die erforderlichen Berechtigungen, um auf diese Route zuzugreifen', + 'notLoggedIn' => 'Sie sind nicht angemeldet', + 'forGroupsOrPermissions' => 'Sie haben keine Berechtigungen, um auf diese Route zuzugreifen', + 'permission_already_exists' => 'Eine Genehmigung mit dieser Schnecke existiert bereits!', + 'group_already_exists' => 'Eine Gruppe mit diesem Slug oder Namen existiert bereits!', + 'permission_does_not_exist' => 'Es gibt keine Erlaubnis mit dieser ID:', + 'permission_does_not_exist_with_slug' => 'Es gibt keine Erlaubnis für diesen Slug:', + 'group_does_not_exist' => 'Es gibt keine Gruppe mit dieser ID:', + 'group_does_not_exist_with_slug' => 'Es gibt keine Gruppe mit dieser Schnecke:', + 'user_does_not_exist_with_name' => 'Es gibt keinen Benutzer mit diesem Namen:', + 'user_does_not_exist' => 'Es gibt keinen Benutzer mit dieser ID:', + 'null_model' => 'Sie verwenden ein Nullmodell als Parameter.', + 'ignition_not_installed' => 'Die Zündung ist nicht installiert, bitte installieren, um Lösungen zu verwenden. composer require --dev facade/ignition', + ]; diff --git a/resources/lang/vendor/acl/en/acl.php b/resources/lang/vendor/acl/en/acl.php new file mode 100644 index 0000000..0cb9202 --- /dev/null +++ b/resources/lang/vendor/acl/en/acl.php @@ -0,0 +1,18 @@ + 'This user does not have the necessary groups to access this route.', + 'forPermissions' => 'This user does not have the necessary permissions to access this route', + 'notLoggedIn' => 'You are not logged in.', + 'forGroupsOrPermissions' => 'You do not have any of the permissions required to access this route', + 'permission_already_exists' => 'One permission with this slug already exists!', + 'group_already_exists' => 'One group with this slug or name already exists!', + 'permission_does_not_exist' => 'There is no permission with this id:', + 'permission_does_not_exist_with_slug' => 'There is no permission with this slug:', + 'group_does_not_exist' => 'There is no group with this Id:', + 'group_does_not_exist_with_slug' => 'There is no group with this slug:', + 'user_does_not_exist_with_name' => 'There is no user with this name:', + 'user_does_not_exist' => 'There is no user with this id:', + 'null_model' => 'You are passing a null model as parameter', + 'ignition_not_installed' => 'Ignition is not installed, please install to use solutions. composer require --dev facade/ignition', + ]; diff --git a/resources/lang/vendor/acl/es/acl.php b/resources/lang/vendor/acl/es/acl.php new file mode 100644 index 0000000..110a449 --- /dev/null +++ b/resources/lang/vendor/acl/es/acl.php @@ -0,0 +1,18 @@ + 'No perteneces a ningún grupo con los permisos necesarios para acceder a esta ruta.', + 'forPermissions' => 'No tienes los permisos necesarios para acceder a esta ruta', + 'notLoggedIn' => 'No has iniciado sesión.', + 'forGroupsOrPermissions' => 'No tiene ninguno de los permisos necesarios para acceder a esta ruta', + 'permission_already_exists' => '¡Ya existe un permiso con esta slug o nombre!', + 'group_already_exists' => '¡Ya existe un grupo con esta slug o nombre!', + 'permission_does_not_exist' => 'No hay permiso con esta Id:', + 'permission_does_not_exist_with_slug' => 'No hay permiso con este slug:', + 'group_does_not_exist' => 'No hay grupo con esta Id:', + 'group_does_not_exist_with_slug' => 'No hay grupo con este slug:', + 'user_does_not_exist_with_name' => 'No hay usuario con este nombre:', + 'user_does_not_exist' => 'No hay usuario con esta Id:', + 'null_model' => 'Está pasando un modelo nulo como parámetro', + 'ignition_not_installed' => 'Ignition no está instalado, por favor instalar para utilizar solutions. composer require --dev facade/ignition', + ]; diff --git a/resources/lang/vendor/acl/fr/acl.php b/resources/lang/vendor/acl/fr/acl.php new file mode 100644 index 0000000..776b5bc --- /dev/null +++ b/resources/lang/vendor/acl/fr/acl.php @@ -0,0 +1,18 @@ + 'Cet utilisateur ne dispose pas des groupes nécessaires pour accéder à cet itinéraire.', + 'forPermissions' => 'Cet utilisateur ne dispose pas des autorisations nécessaires pour accéder à cette route.', + 'notLoggedIn' => "Vous n'êtes pas connecté", + 'forGroupsOrPermissions' => "Vous ne disposez d'aucune des autorisations requises pour accéder à cette route", + 'permission_already_exists' => 'Un permis avec cette limace existe déjà!', + 'group_already_exists' => 'Un groupe avec cette limace ou ce nom existe déjà!', + 'permission_does_not_exist' => "Il n'y a pas de permission avec cet identifiant:", + 'permission_does_not_exist_with_slug' => "Il n'y a pas d'autorisation avec cette limace:", + 'group_does_not_exist' => "Il n'y a pas de groupe avec cet identifiant:", + 'group_does_not_exist_with_slug' => "Il n'y a pas de groupe avec cette limace:", + 'user_does_not_exist_with_name' => "Il n'y a pas d'utilisateur avec ce nom:", + 'user_does_not_exist' => "Il n'y a pas d'utilisateur avec cet identifiant:", + 'null_model' => 'Vous utilisez un modèle null en tant que paramètre.', + 'ignition_not_installed' => "L'allumage n'est pas installé, veuillez l'installer pour utiliser les solutions. composer require --dev facade/ignition", + ]; diff --git a/resources/lang/vendor/acl/it/acl.php b/resources/lang/vendor/acl/it/acl.php new file mode 100644 index 0000000..2132431 --- /dev/null +++ b/resources/lang/vendor/acl/it/acl.php @@ -0,0 +1,18 @@ + 'Questo utente non ha i gruppi necessari per accedere a questa rotta.', + 'forPermissions' => 'Questo utente non ha le autorizzazioni necessarie per accedere a questa rotta', + 'notLoggedIn' => 'Non sei loggato.', + 'forGroupsOrPermissions' => 'Non hai nessuna delle autorizzazioni richieste per accedere a questa rotta', + 'permission_already_exists' => 'Esiste già un permesso con questo proiettile!', + 'group_already_exists' => 'Esiste già un gruppo con questo slug o nome!', + 'permission_does_not_exist' => 'Non ci sono permessi con questo ID:', + 'permission_does_not_exist_with_slug' => "Non c'è autorizzazione con questo slug:", + 'group_does_not_exist' => "Non c'è gruppo con questo ID:", + 'group_does_not_exist_with_slug' => "Non c'è gruppo con questo slug:", + 'user_does_not_exist_with_name' => "Non c'è nessun utente con questo nome:", + 'user_does_not_exist' => 'Non ci sono utenti con questo ID:', + 'null_model' => 'Si sta utilizzando un modello null come parametro.', + 'ignition_not_installed' => "L'accensione non è installata, installare per utilizzare le soluzioni. composer require --dev facade/ignition", + ]; diff --git a/resources/lang/vendor/acl/pt-br/acl.php b/resources/lang/vendor/acl/pt-br/acl.php new file mode 100644 index 0000000..c2ab66d --- /dev/null +++ b/resources/lang/vendor/acl/pt-br/acl.php @@ -0,0 +1,18 @@ + 'Este usuário não possui os grupos necessários para acessar esta rota.', + 'forPermissions' => 'Este usuário não possui as permissões necessárias para acessar esta rota', + 'notLoggedIn' => 'Você não está logado no sistema.', + 'forGroupsOrPermissions' => 'Você não possui nenhuma das permissões necessárias para acessar esta rota', + 'permission_already_exists' => 'Uma permissão com este slug já existe!', + 'group_already_exists' => 'Um grupo com este slug ou nome já existe!', + 'permission_does_not_exist' => 'Não existe nenhuma permissão com esse id:', + 'permission_does_not_exist_with_slug' => 'Não existe nenhuma permissão com esse slug:', + 'group_does_not_exist' => 'Não existe nenhum grupo com esse Id:', + 'group_does_not_exist_with_slug' => 'Não existe nenhum groupo com esse slug:', + 'user_does_not_exist_with_name' => 'Não existe nenhum usuário com este nome:', + 'user_does_not_exist' => 'Não existe nenhum usuário com este id:', + 'null_model' => 'Você está usando um model nulo como parâmetro.', + 'ignition_not_installed' => 'A ignição não está instalada, instale para usar soluções. composer require --dev facade/ignition', + ]; diff --git a/resources/lang/vendor/acl/ru/acl.php b/resources/lang/vendor/acl/ru/acl.php new file mode 100644 index 0000000..8d42ec9 --- /dev/null +++ b/resources/lang/vendor/acl/ru/acl.php @@ -0,0 +1,18 @@ + 'У этого пользователя нет необходимых групп для доступа к этому маршруту.', + 'forPermissions' => 'У этого пользователя нет необходимых прав доступа к этому маршруту.', + 'notLoggedIn' => 'Вы не авторизованы.', + 'forGroupsOrPermissions' => 'У вас нет каких-либо разрешений, необходимых для доступа к этому маршруту', + 'permission_already_exists' => 'Разрешение с этим слагом уже существует!', + 'group_already_exists' => 'Группа с этим слагом или именем уже существует!', + 'permission_does_not_exist' => 'Нет разрешения с этим идентификатором:', + 'permission_does_not_exist_with_slug' => 'Нет разрешения с этим слагом:', + 'group_does_not_exist' => 'Нет группы с таким идентификатором:', + 'group_does_not_exist_with_slug' => 'Нет группы с этим слизнем:', + 'user_does_not_exist_with_name' => 'Нет пользователя с таким именем:', + 'user_does_not_exist' => 'Нет пользователя с таким идентификатором:', + 'null_model' => 'Вы используете нулевую модель в качестве параметра.', + 'ignition_not_installed' => 'Зажигание не установлено, пожалуйста, установите, чтобы использовать решения. composer require --dev facade/ignition', + ]; diff --git a/resources/views/vendor/junges/acl/_forms/groups/group.blade.php b/resources/views/vendor/junges/acl/_forms/groups/group.blade.php new file mode 100644 index 0000000..9da1e1a --- /dev/null +++ b/resources/views/vendor/junges/acl/_forms/groups/group.blade.php @@ -0,0 +1,73 @@ + +
+ + + @if($errors->has('name')) + {{ $errors->first('name') }} + @endif +
+
+ + + @if($errors->has('slug')) + {{ $errors->first('slug') }} + @endif +
+ +
+ + @if($errors->has('description')) + {{ $errors->first('description') }} + @endif +
+
+ + + @if($errors->has('permissions')) + {{ $errors->first('permissions') }} + @endif +
\ No newline at end of file diff --git a/resources/views/vendor/junges/acl/_forms/users/add-group.blade.php b/resources/views/vendor/junges/acl/_forms/users/add-group.blade.php new file mode 100644 index 0000000..d2ed386 --- /dev/null +++ b/resources/views/vendor/junges/acl/_forms/users/add-group.blade.php @@ -0,0 +1,56 @@ +
+ + + @if($errors->has('users')) + {{ $errors->first('users') }} + @endif +
+
+ + +
diff --git a/resources/views/vendor/junges/acl/_forms/users/add-permission.blade.php b/resources/views/vendor/junges/acl/_forms/users/add-permission.blade.php new file mode 100644 index 0000000..7339274 --- /dev/null +++ b/resources/views/vendor/junges/acl/_forms/users/add-permission.blade.php @@ -0,0 +1,59 @@ +@csrf +
+ + + @if($errors->has('user')) + {{ $errors->first('user') }} + @endif +
+
+ + + @if($errors->has('permissions')) + {{ $errors->first('permissions') }} +@endif \ No newline at end of file diff --git a/tests/Feature/App/TesMembuatPengajuanCuti.php b/tests/Feature/App/TesMembuatPengajuanCuti.php new file mode 100644 index 0000000..77eb686 --- /dev/null +++ b/tests/Feature/App/TesMembuatPengajuanCuti.php @@ -0,0 +1,62 @@ +personalia = User::factory()->personalia()->create(); + $this->supervisor = User::factory()->supervisor()->create(); + $this->staff = User::factory()->staff()->create(); + + $this->formCuti = FormCuti::factory()->for($this->staff, 'staff')->for($this->personalia, 'creator')->create(); + } + + /** @test */ + public function dapat_membuat_pengajuan_cuti() + { + $row = [ + 'tgl_mulai' => today(), + 'tgl_selesai' => today()->addDays(4), + ]; + + $this->formCuti->createRow($row); + + $this->formCuti->save(); + + $this->assertSame( + [ + 'tgl_mulai' => $row['tgl_mulai']->toISOString(), + 'tgl_selesai' => $row['tgl_selesai']->toISOString(), + 'form_cuti_id' => $this->formCuti->id, + 'supervisor' => [ + 'id' => null, + 'terima' => false, + 'keterangan' => null, + ], + 'personalia' => [ + 'id' => $this->personalia->id, + 'terima' => false, + 'keterangan' => null, + ], + ], + $this->formCuti->data[0] + ); + } +}