first commit
This commit is contained in:
commit
7dad410baf
|
@ -0,0 +1,18 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_size = 2
|
||||
|
||||
[docker-compose.yml]
|
||||
indent_size = 4
|
|
@ -0,0 +1,53 @@
|
|||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_KEY=base64:xzpEKUEcSyv9HvbAbtbm5Ofd+UBC1M3bgv0Rytr06HU=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
APP_FORCE_HTTPS=true
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=skripsi_ahp
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
FILESYSTEM_DRIVER=local
|
||||
QUEUE_CONNECTION=sync
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
# MAIL_MAILER=smtp
|
||||
# MAIL_HOST=kelola.biz.id
|
||||
# MAIL_PORT=465
|
||||
# MAIL_USERNAME=info@kelola.biz.id
|
||||
# MAIL_PASSWORD="default123@#"
|
||||
# MAIL_ENCRYPTION=ssl
|
||||
# MAIL_FROM_ADDRESS=info@kelola.biz.id
|
||||
# MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=auto
|
||||
AWS_BUCKET=cdn-progriva
|
||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_APP_KEY=
|
||||
PUSHER_APP_SECRET=
|
||||
PUSHER_APP_CLUSTER=mt1
|
||||
|
||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
|
@ -0,0 +1,52 @@
|
|||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=laravel
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
FILESYSTEM_DRIVER=local
|
||||
QUEUE_CONNECTION=sync
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=smtp
|
||||
MAIL_HOST=mailhog
|
||||
MAIL_PORT=1025
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_ENCRYPTION=null
|
||||
MAIL_FROM_ADDRESS=null
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_APP_KEY=
|
||||
PUSHER_APP_SECRET=
|
||||
PUSHER_APP_CLUSTER=mt1
|
||||
|
||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
|
@ -0,0 +1,8 @@
|
|||
RewriteEngine On
|
||||
RewriteCond %{HTTPS} off
|
||||
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteRule ^(.*)$ public/$1 [L]
|
||||
</IfModule>
|
|
@ -0,0 +1,8 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
|
@ -0,0 +1,148 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/Modules" isTestSource="false" packagePrefix="Modules\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/Modules/User/" isTestSource="false" packagePrefix="Modules\User\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/app" isTestSource="false" packagePrefix="App\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/database/factories" isTestSource="false" packagePrefix="Database\Factories\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/database/seeders" isTestSource="false" packagePrefix="Database\Seeders\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" packagePrefix="Tests\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/tests/Feature" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/tests/Unit" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/asm89/stack-cors" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/aws/aws-crt-php" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/aws/aws-sdk-php" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/brick/math" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/composer" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/darryldecode/cart" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/dflydev/dot-access-data" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/inflector" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/instantiator" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/lexer" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/dragonmantank/cron-expression" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/egulias/email-validator" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/ezyang/htmlpurifier" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/facade/flare-client-php" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/facade/ignition" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/facade/ignition-contracts" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/fakerphp/faker" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/filp/whoops" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/fruitcake/laravel-cors" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/graham-campbell/result-type" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/guzzlehttp/guzzle" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/guzzlehttp/promises" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/guzzlehttp/psr7" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/hamcrest/hamcrest-php" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/framework" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/sail" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/sanctum" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/serializable-closure" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/tinker" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/laravelcollective/html" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/league/commonmark" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/league/config" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/league/flysystem" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/league/flysystem-aws-s3-v3" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/league/mime-type-detection" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/livewire/livewire" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/mad-web/laravel-enum" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/maennchen/zipstream-php" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/markbaker/complex" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/markbaker/matrix" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/mews/purifier" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/mockery/mockery" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/monolog/monolog" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/mtdowling/jmespath.php" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/myclabs/deep-copy" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/myclabs/php-enum" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/nesbot/carbon" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/nette/schema" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/nette/utils" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/nikic/php-parser" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/nunomaduro/collision" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/nwidart/laravel-modules" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/opis/closure" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phar-io/manifest" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phar-io/version" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpoffice/phpspreadsheet" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpoption/phpoption" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/php-code-coverage" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/php-file-iterator" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/php-invoker" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/php-text-template" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/php-timer" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/phpunit" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/clock" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/container" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/event-dispatcher" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/http-client" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/http-factory" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/http-message" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/log" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/simple-cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psy/psysh" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/ralouphie/getallheaders" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/ramsey/collection" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/ramsey/uuid" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/realrashid/sweet-alert" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/cli-parser" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/code-unit" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/code-unit-reverse-lookup" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/comparator" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/complexity" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/diff" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/environment" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/exporter" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/global-state" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/lines-of-code" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/object-enumerator" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/object-reflector" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/recursion-context" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/resource-operations" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/type" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/version" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/spatie/db-dumper" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/spatie/regex" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/swiftmailer/swiftmailer" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/console" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/css-selector" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/deprecation-contracts" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/error-handler" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/event-dispatcher" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/event-dispatcher-contracts" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/finder" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/http-foundation" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/http-kernel" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/mime" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-ctype" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-iconv" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-intl-grapheme" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-intl-idn" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-intl-normalizer" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-mbstring" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-php72" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-php73" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-php80" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/process" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/routing" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/service-contracts" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/string" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/translation" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/translation-contracts" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/var-dumper" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/yaml" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/theanik/laravel-more-command" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/theseer/tokenizer" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/tijsverkoyen/css-to-inline-styles" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/vlucas/phpdotenv" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/voku/anti-xss" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/voku/portable-ascii" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/voku/portable-utf8" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/webmozart/assert" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/yajra/laravel-datatables-oracle" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="framework" type="frameworkType"/>
|
||||
<xs:complexType name="commandType">
|
||||
<xs:all>
|
||||
<xs:element type="xs:string" name="name" minOccurs="1" maxOccurs="1"/>
|
||||
<xs:element type="xs:string" name="params" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element type="xs:string" name="help" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element type="optionsBeforeType" name="optionsBefore" minOccurs="0" maxOccurs="1"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="frameworkType">
|
||||
<xs:sequence>
|
||||
<xs:element type="xs:string" name="extraData" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element type="commandType" name="command" maxOccurs="unbounded" minOccurs="0"/>
|
||||
<xs:element type="xs:string" name="help" minOccurs="0" maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute type="xs:string" name="name" use="required"/>
|
||||
<xs:attribute type="xs:string" name="invoke" use="required"/>
|
||||
<xs:attribute type="xs:string" name="alias" use="required"/>
|
||||
<xs:attribute type="xs:boolean" name="enabled" use="required"/>
|
||||
<xs:attribute type="xs:integer" name="version" use="required"/>
|
||||
<xs:attribute type="xs:string" name="frameworkId" use="optional"/>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="optionsBeforeType">
|
||||
<xs:sequence>
|
||||
<xs:element type="optionType" name="option" maxOccurs="unbounded" minOccurs="0"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="optionType">
|
||||
<xs:sequence>
|
||||
<xs:element type="xs:string" name="help" minOccurs="0" maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
<xs:attribute type="xs:string" name="name" use="required"/>
|
||||
<xs:attribute type="xs:string" name="shortcut" use="optional"/>
|
||||
<xs:attribute name="pattern" use="optional">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="space"/>
|
||||
<xs:enumeration value="equals"/>
|
||||
<xs:enumeration value="unknown"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:schema>
|
|
@ -0,0 +1,6 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
</profile>
|
||||
</component>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/Skripsi_AHP.iml" filepath="$PROJECT_DIR$/.idea/Skripsi_AHP.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,160 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="MessDetectorOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PHPCSFixerOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PHPCodeSnifferOptionsConfiguration">
|
||||
<option name="highlightLevel" value="WARNING" />
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PhpIncludePathManager">
|
||||
<include_path>
|
||||
<path value="$PROJECT_DIR$/vendor/darryldecode/cart" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/deprecation-contracts" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-mbstring" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/finder" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/routing" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-intl-grapheme" />
|
||||
<path value="$PROJECT_DIR$/vendor/realrashid/sweet-alert" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/css-selector" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-intl-normalizer" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php80" />
|
||||
<path value="$PROJECT_DIR$/vendor/doctrine/lexer" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/mime" />
|
||||
<path value="$PROJECT_DIR$/vendor/doctrine/instantiator" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-ctype" />
|
||||
<path value="$PROJECT_DIR$/vendor/doctrine/inflector" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php72" />
|
||||
<path value="$PROJECT_DIR$/vendor/mews/purifier" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/error-handler" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/event-dispatcher-contracts" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php73" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-intl-idn" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/console" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-iconv" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/event-dispatcher" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/var-dumper" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/http-foundation" />
|
||||
<path value="$PROJECT_DIR$/vendor/nesbot/carbon" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/http-kernel" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/translation-contracts" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/service-contracts" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/string" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/yaml" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/translation" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/process" />
|
||||
<path value="$PROJECT_DIR$/vendor/opis/closure" />
|
||||
<path value="$PROJECT_DIR$/vendor/swiftmailer/swiftmailer" />
|
||||
<path value="$PROJECT_DIR$/vendor/tijsverkoyen/css-to-inline-styles" />
|
||||
<path value="$PROJECT_DIR$/vendor/asm89/stack-cors" />
|
||||
<path value="$PROJECT_DIR$/vendor/laravel/sail" />
|
||||
<path value="$PROJECT_DIR$/vendor/mad-web/laravel-enum" />
|
||||
<path value="$PROJECT_DIR$/vendor/laravel/sanctum" />
|
||||
<path value="$PROJECT_DIR$/vendor/laravel/tinker" />
|
||||
<path value="$PROJECT_DIR$/vendor/voku/portable-ascii" />
|
||||
<path value="$PROJECT_DIR$/vendor/brick/math" />
|
||||
<path value="$PROJECT_DIR$/vendor/laravel/serializable-closure" />
|
||||
<path value="$PROJECT_DIR$/vendor/voku/anti-xss" />
|
||||
<path value="$PROJECT_DIR$/vendor/laravel/framework" />
|
||||
<path value="$PROJECT_DIR$/vendor/voku/portable-utf8" />
|
||||
<path value="$PROJECT_DIR$/vendor/dragonmantank/cron-expression" />
|
||||
<path value="$PROJECT_DIR$/vendor/league/flysystem-aws-s3-v3" />
|
||||
<path value="$PROJECT_DIR$/vendor/mockery/mockery" />
|
||||
<path value="$PROJECT_DIR$/vendor/league/config" />
|
||||
<path value="$PROJECT_DIR$/vendor/league/commonmark" />
|
||||
<path value="$PROJECT_DIR$/vendor/fruitcake/laravel-cors" />
|
||||
<path value="$PROJECT_DIR$/vendor/league/mime-type-detection" />
|
||||
<path value="$PROJECT_DIR$/vendor/league/flysystem" />
|
||||
<path value="$PROJECT_DIR$/vendor/graham-campbell/result-type" />
|
||||
<path value="$PROJECT_DIR$/vendor/nette/schema" />
|
||||
<path value="$PROJECT_DIR$/vendor/nette/utils" />
|
||||
<path value="$PROJECT_DIR$/vendor/aws/aws-crt-php" />
|
||||
<path value="$PROJECT_DIR$/vendor/aws/aws-sdk-php" />
|
||||
<path value="$PROJECT_DIR$/vendor/laravelcollective/html" />
|
||||
<path value="$PROJECT_DIR$/vendor/maennchen/zipstream-php" />
|
||||
<path value="$PROJECT_DIR$/vendor/phar-io/version" />
|
||||
<path value="$PROJECT_DIR$/vendor/phar-io/manifest" />
|
||||
<path value="$PROJECT_DIR$/vendor/phpoption/phpoption" />
|
||||
<path value="$PROJECT_DIR$/vendor/facade/flare-client-php" />
|
||||
<path value="$PROJECT_DIR$/vendor/webmozart/assert" />
|
||||
<path value="$PROJECT_DIR$/vendor/facade/ignition-contracts" />
|
||||
<path value="$PROJECT_DIR$/vendor/fakerphp/faker" />
|
||||
<path value="$PROJECT_DIR$/vendor/facade/ignition" />
|
||||
<path value="$PROJECT_DIR$/vendor/myclabs/deep-copy" />
|
||||
<path value="$PROJECT_DIR$/vendor/ralouphie/getallheaders" />
|
||||
<path value="$PROJECT_DIR$/vendor/myclabs/php-enum" />
|
||||
<path value="$PROJECT_DIR$/vendor/guzzlehttp/promises" />
|
||||
<path value="$PROJECT_DIR$/vendor/guzzlehttp/psr7" />
|
||||
<path value="$PROJECT_DIR$/vendor/guzzlehttp/guzzle" />
|
||||
<path value="$PROJECT_DIR$/vendor/sebastian/type" />
|
||||
<path value="$PROJECT_DIR$/vendor/sebastian/diff" />
|
||||
<path value="$PROJECT_DIR$/vendor/sebastian/lines-of-code" />
|
||||
<path value="$PROJECT_DIR$/vendor/livewire/livewire" />
|
||||
<path value="$PROJECT_DIR$/vendor/sebastian/object-enumerator" />
|
||||
<path value="$PROJECT_DIR$/vendor/sebastian/comparator" />
|
||||
<path value="$PROJECT_DIR$/vendor/sebastian/code-unit" />
|
||||
<path value="$PROJECT_DIR$/vendor/sebastian/exporter" />
|
||||
<path value="$PROJECT_DIR$/vendor/spatie/regex" />
|
||||
<path value="$PROJECT_DIR$/vendor/sebastian/cli-parser" />
|
||||
<path value="$PROJECT_DIR$/vendor/spatie/db-dumper" />
|
||||
<path value="$PROJECT_DIR$/vendor/sebastian/version" />
|
||||
<path value="$PROJECT_DIR$/vendor/sebastian/complexity" />
|
||||
<path value="$PROJECT_DIR$/vendor/sebastian/recursion-context" />
|
||||
<path value="$PROJECT_DIR$/vendor/sebastian/resource-operations" />
|
||||
<path value="$PROJECT_DIR$/vendor/sebastian/environment" />
|
||||
<path value="$PROJECT_DIR$/vendor/sebastian/global-state" />
|
||||
<path value="$PROJECT_DIR$/vendor/sebastian/code-unit-reverse-lookup" />
|
||||
<path value="$PROJECT_DIR$/vendor/sebastian/object-reflector" />
|
||||
<path value="$PROJECT_DIR$/vendor/nikic/php-parser" />
|
||||
<path value="$PROJECT_DIR$/vendor/psr/simple-cache" />
|
||||
<path value="$PROJECT_DIR$/vendor/psr/clock" />
|
||||
<path value="$PROJECT_DIR$/vendor/psr/http-factory" />
|
||||
<path value="$PROJECT_DIR$/vendor/psr/container" />
|
||||
<path value="$PROJECT_DIR$/vendor/psr/http-client" />
|
||||
<path value="$PROJECT_DIR$/vendor/psr/http-message" />
|
||||
<path value="$PROJECT_DIR$/vendor/psr/event-dispatcher" />
|
||||
<path value="$PROJECT_DIR$/vendor/psr/log" />
|
||||
<path value="$PROJECT_DIR$/vendor/markbaker/matrix" />
|
||||
<path value="$PROJECT_DIR$/vendor/markbaker/complex" />
|
||||
<path value="$PROJECT_DIR$/vendor/yajra/laravel-datatables-oracle" />
|
||||
<path value="$PROJECT_DIR$/vendor/nwidart/laravel-modules" />
|
||||
<path value="$PROJECT_DIR$/vendor/vlucas/phpdotenv" />
|
||||
<path value="$PROJECT_DIR$/vendor/phpunit/php-code-coverage" />
|
||||
<path value="$PROJECT_DIR$/vendor/phpunit/php-file-iterator" />
|
||||
<path value="$PROJECT_DIR$/vendor/phpunit/php-invoker" />
|
||||
<path value="$PROJECT_DIR$/vendor/phpunit/php-text-template" />
|
||||
<path value="$PROJECT_DIR$/vendor/phpunit/phpunit" />
|
||||
<path value="$PROJECT_DIR$/vendor/phpunit/php-timer" />
|
||||
<path value="$PROJECT_DIR$/vendor/hamcrest/hamcrest-php" />
|
||||
<path value="$PROJECT_DIR$/vendor/ezyang/htmlpurifier" />
|
||||
<path value="$PROJECT_DIR$/vendor/ramsey/collection" />
|
||||
<path value="$PROJECT_DIR$/vendor/ramsey/uuid" />
|
||||
<path value="$PROJECT_DIR$/vendor/mtdowling/jmespath.php" />
|
||||
<path value="$PROJECT_DIR$/vendor/theanik/laravel-more-command" />
|
||||
<path value="$PROJECT_DIR$/vendor/filp/whoops" />
|
||||
<path value="$PROJECT_DIR$/vendor/dflydev/dot-access-data" />
|
||||
<path value="$PROJECT_DIR$/vendor/nunomaduro/collision" />
|
||||
<path value="$PROJECT_DIR$/vendor/composer" />
|
||||
<path value="$PROJECT_DIR$/vendor/phpoffice/phpspreadsheet" />
|
||||
<path value="$PROJECT_DIR$/vendor/egulias/email-validator" />
|
||||
<path value="$PROJECT_DIR$/vendor/monolog/monolog" />
|
||||
<path value="$PROJECT_DIR$/vendor/psy/psysh" />
|
||||
<path value="$PROJECT_DIR$/vendor/theseer/tokenizer" />
|
||||
</include_path>
|
||||
</component>
|
||||
<component name="PhpProjectSharedConfiguration" php_language_level="7.3" />
|
||||
<component name="PhpStanOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PhpUnit">
|
||||
<phpunit_settings>
|
||||
<PhpUnitSettings configuration_file_path="$PROJECT_DIR$/phpunit.xml" custom_loader_path="$PROJECT_DIR$/vendor/autoload.php" use_configuration_file="true" />
|
||||
</phpunit_settings>
|
||||
</component>
|
||||
<component name="PsalmOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PHPUnit">
|
||||
<option name="directories">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/tests/Unit" />
|
||||
<option value="$PROJECT_DIR$/tests/Feature" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,14 @@
|
|||
php:
|
||||
preset: laravel
|
||||
version: 8
|
||||
disabled:
|
||||
- no_unused_imports
|
||||
finder:
|
||||
not-name:
|
||||
- index.php
|
||||
- server.php
|
||||
js:
|
||||
finder:
|
||||
not-name:
|
||||
- webpack.mix.js
|
||||
css: true
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'User'
|
||||
];
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\User\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class UserDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Model::unguard();
|
||||
|
||||
// $this->call("OthersTableSeeder");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\User\Http\Controllers;
|
||||
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use App\Models\Ranking;
|
||||
use App\Models\Alternatif;
|
||||
use App\Models\Kriteria;
|
||||
use App\Models\User;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Halaman Utama',
|
||||
];
|
||||
|
||||
$alternatif = Alternatif::count();
|
||||
$kriteria = Kriteria::count();
|
||||
|
||||
return view('user::index', compact('data', 'alternatif', 'kriteria'));
|
||||
}
|
||||
|
||||
public function profile()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Akun anda',
|
||||
];
|
||||
|
||||
return view('user::setting', compact('data'));
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
$id = user()->id;
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required',
|
||||
'email' => 'required',
|
||||
'password' => 'string',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->withErrors($validator)->withInput();
|
||||
}
|
||||
|
||||
$input = $request->all();
|
||||
$findUser = User::find($id);
|
||||
|
||||
if($findUser) {
|
||||
// update data
|
||||
$findUser->name = $input['name'];
|
||||
$findUser->email = $input['email'];
|
||||
if(!empty($input['password'])) {
|
||||
$findUser->password = bcrypt($input['password']);
|
||||
}
|
||||
|
||||
// save data
|
||||
$findUser->save();
|
||||
return redirect()->back()->with('success', 'Data berhasil disimpan');
|
||||
} else {
|
||||
return redirect()->back()->with('success', 'Tidak ditemukan data!');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\User\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The module namespace to assume when generating URLs to actions.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $moduleNamespace = 'Modules\User\Http\Controllers';
|
||||
|
||||
/**
|
||||
* Called before routes are registered.
|
||||
*
|
||||
* Register any model bindings or pattern based filters.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map()
|
||||
{
|
||||
$this->mapApiRoutes();
|
||||
|
||||
$this->mapWebRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapWebRoutes()
|
||||
{
|
||||
Route::middleware('web')
|
||||
->namespace($this->moduleNamespace)
|
||||
->group(module_path('User', '/Routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapApiRoutes()
|
||||
{
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->moduleNamespace)
|
||||
->group(module_path('User', '/Routes/api.php'));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\User\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Database\Eloquent\Factory;
|
||||
|
||||
class UserServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* @var string $moduleName
|
||||
*/
|
||||
protected $moduleName = 'User';
|
||||
|
||||
/**
|
||||
* @var string $moduleNameLower
|
||||
*/
|
||||
protected $moduleNameLower = 'user';
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/Migrations'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->app->register(RouteServiceProvider::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerConfig()
|
||||
{
|
||||
$this->publishes([
|
||||
module_path($this->moduleName, 'Config/config.php') => config_path($this->moduleNameLower . '.php'),
|
||||
], 'config');
|
||||
$this->mergeConfigFrom(
|
||||
module_path($this->moduleName, 'Config/config.php'), $this->moduleNameLower
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerViews()
|
||||
{
|
||||
$viewPath = resource_path('views/modules/' . $this->moduleNameLower);
|
||||
|
||||
$sourcePath = module_path($this->moduleName, 'Resources/views');
|
||||
|
||||
$this->publishes([
|
||||
$sourcePath => $viewPath
|
||||
], ['views', $this->moduleNameLower . '-module-views']);
|
||||
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerTranslations()
|
||||
{
|
||||
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path($this->moduleName, 'Resources/lang'), $this->moduleNameLower);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
private function getPublishableViewPaths(): array
|
||||
{
|
||||
$paths = [];
|
||||
foreach (\Config::get('view.paths') as $path) {
|
||||
if (is_dir($path . '/modules/' . $this->moduleNameLower)) {
|
||||
$paths[] = $path . '/modules/' . $this->moduleNameLower;
|
||||
}
|
||||
}
|
||||
return $paths;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
@include('components.theme.pages.header-user')
|
||||
<section>
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-4 mb-2">
|
||||
<div class="card border-left-primary shadow py-2">
|
||||
<div class="card-body">
|
||||
<div class="row no-gutters align-items-center">
|
||||
<div class="col mr-2">
|
||||
<div class="text-xs font-weight-bold text-primary text-uppercase mb-1">
|
||||
Alternatif</div>
|
||||
<div class="h5 mb-0 font-weight-bold text-gray-800">{{ $alternatif }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 mb-2">
|
||||
<div class="card border-left-primary shadow py-2">
|
||||
<div class="card-body">
|
||||
<div class="row no-gutters align-items-center">
|
||||
<div class="col mr-2">
|
||||
<div class="text-xs font-weight-bold text-primary text-uppercase mb-1">
|
||||
Kriteria</div>
|
||||
<div class="h5 mb-0 font-weight-bold text-gray-800">{{ $kriteria }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 mb-2">
|
||||
<div class="card border-left-primary shadow py-2">
|
||||
<div class="card-body">
|
||||
<div class="row no-gutters align-items-center">
|
||||
<div class="col mr-2">
|
||||
<div class="text-xs font-weight-bold text-primary text-uppercase mb-1">
|
||||
Tanggal</div>
|
||||
<div class="h5 mb-0 font-weight-bold text-gray-800">{{ date('j F Y, H:i:s') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 mt-4">
|
||||
<div id="container2" style="width:100%; height:400px;"></div>
|
||||
</div>
|
||||
<div class="col-md-4 mt-4">
|
||||
<div class="card shadow">
|
||||
<div class="card-header">
|
||||
<h6 class="m-0">Nilai Preferensi</h6>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@php
|
||||
$i = 1;
|
||||
@endphp
|
||||
@foreach(\App\Models\Nilai::all() as $nilai)
|
||||
<p class="mb-1">{{ $i++ }}. {{ $nilai->ket_nilai }}</p>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 mt-4">
|
||||
<div class="card shadow">
|
||||
<div class="card-header">
|
||||
<h6 class="m-0">Kriteria-Kriteria</h6>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@foreach(\App\Models\Kriteria::all() as $kriteria)
|
||||
<p class="mb-1">({{ $kriteria->id_kriteria }}) {{ $kriteria->nama_kriteria }}</p>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 mt-4">
|
||||
<div class="card shadow">
|
||||
<div class="card-header">
|
||||
<h6 class="m-0">Alternatif Items</h6>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@foreach(\App\Models\Alternatif::all() as $alternatif)
|
||||
<p class="mb-1">({{ $alternatif->id_alternatif }}) {{ $alternatif->nama_alternatif }}</p>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@push('scripts')
|
||||
<script src="https://code.highcharts.com/highcharts.js"></script>
|
||||
<script>
|
||||
var chart1; // globally available
|
||||
$(document).ready(function() {
|
||||
chart1 = new Highcharts.Chart({
|
||||
chart: {
|
||||
renderTo: 'container2',
|
||||
type: 'column'
|
||||
},
|
||||
title: {
|
||||
text: 'Grafik Perangkingan '
|
||||
},
|
||||
xAxis: {
|
||||
categories: ['Alternatif']
|
||||
},
|
||||
yAxis: {
|
||||
title: {
|
||||
text: 'Jumlah Nilai'
|
||||
}
|
||||
},
|
||||
series:
|
||||
[
|
||||
@foreach(\App\Models\Ranking::all() as $items)
|
||||
{
|
||||
name: '{{ $items->account->nama_alternatif }}',
|
||||
data: [{{ number_format($items->skor_bobot, 2) }}]
|
||||
},
|
||||
@endforeach
|
||||
]
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@include('components.theme.pages.footer')
|
|
@ -0,0 +1,47 @@
|
|||
@include('components.theme.pages.header-user')
|
||||
<section>
|
||||
<div class="row">
|
||||
<div class="col-md-12 mt-9">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="h6 m-0 text-primary font-weight-bold">Umum</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="{{ site_url('user', 'account/update') }}" method="POST">
|
||||
@csrf
|
||||
@if(session()->has('success'))
|
||||
<div class="alert alert-success">
|
||||
{{ session()->get('success') }}
|
||||
</div>
|
||||
@else
|
||||
@if(session()->has('error'))
|
||||
<div class="alert alert-danger">
|
||||
{{ session()->get('error') }}
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
<div class="row">
|
||||
<div class="col-6 form-group">
|
||||
<label class="form-label">Nama Lengkap<sup class="ml-1 text-danger">*</sup></label>
|
||||
<input type="text" name="name" class="form-control" value="{{ user()->name }}" placeholder="Nama Lengkap">
|
||||
</div>
|
||||
<div class="col-6 form-group">
|
||||
<label class="form-label">Alamat Email<sup class="ml-1 text-danger">*</sup></label>
|
||||
<input type="email" name="email" class="form-control" id="email" value="{{ user()->email }}" placeholder="Alamat Email">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group mb-3">
|
||||
<label class="form-label mb-3">Kata Sandi<span class="ml-2 small text-danger">opsional (kosongi jika tidak ingin merubah)</span></label>
|
||||
<input type="password" name="password" class="form-control" value="" placeholder="Kata Sandi">
|
||||
</div>
|
||||
<div class="form-group mb-n1">
|
||||
<button type="submit" class="btn btn-primary">Simpan</button>
|
||||
<a href="{{ site_url('user', '/') }}" class="btn btn-dark">Kembali</a>
|
||||
</div>
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@include('components.theme.pages.footer')
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| API Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register API routes for your application. These
|
||||
| routes are loaded by the RouteServiceProvider within a group which
|
||||
| is assigned the "api" middleware group. Enjoy building your API!
|
||||
|
|
||||
*/
|
||||
|
||||
Route::middleware('auth:api')->get('/user', function (Request $request) {
|
||||
return $request->user();
|
||||
});
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Web Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register web routes for your application. These
|
||||
| routes are loaded by the RouteServiceProvider within a group which
|
||||
| contains the "web" middleware group. Now create something great!
|
||||
|
|
||||
*/
|
||||
|
||||
Route::group(['prefix' => 'user', 'middleware' => ['auth', 'check.auth']], function () {
|
||||
Route::get('/', 'UserController@index');
|
||||
Route::prefix('account')->group(function () {
|
||||
Route::get('/', 'UserController@profile');
|
||||
Route::post('update', 'UserController@update');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"name": "nwidart/user",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Widart",
|
||||
"email": "n.widart@gmail.com"
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\User\\": ""
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"name": "User",
|
||||
"alias": "user",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
"Modules\\User\\Providers\\UserServiceProvider"
|
||||
],
|
||||
"aliases": {},
|
||||
"files": [],
|
||||
"requires": []
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "npm run development",
|
||||
"development": "mix",
|
||||
"watch": "mix watch",
|
||||
"watch-poll": "mix watch -- --watch-options-poll=1000",
|
||||
"hot": "mix watch --hot",
|
||||
"prod": "npm run production",
|
||||
"production": "mix --production"
|
||||
},
|
||||
"devDependencies": {
|
||||
"axios": "^0.21.4",
|
||||
"dotenv": "^10.0.0",
|
||||
"dotenv-expand": "^5.1.0",
|
||||
"laravel-mix": "^6.0.31",
|
||||
"laravel-mix-merge-manifest": "^2.0.0",
|
||||
"lodash": "^4.17.21",
|
||||
"postcss": "^8.3.7"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
const dotenvExpand = require('dotenv-expand');
|
||||
dotenvExpand(require('dotenv').config({ path: '../../.env'/*, debug: true*/}));
|
||||
|
||||
const mix = require('laravel-mix');
|
||||
require('laravel-mix-merge-manifest');
|
||||
|
||||
mix.setPublicPath('../../public').mergeManifest();
|
||||
|
||||
mix.js(__dirname + '/Resources/assets/js/app.js', 'js/user.js')
|
||||
.sass( __dirname + '/Resources/assets/sass/app.scss', 'css/user.css');
|
||||
|
||||
if (mix.inProduction()) {
|
||||
mix.version();
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Modules\Seller\Entities\PaymentModel as Payment;
|
||||
use App\Enums\GlobalEnum as Status;
|
||||
|
||||
class DepositCommand extends Command
|
||||
{
|
||||
protected $signature = 'deposit:update';
|
||||
protected $description = 'Update status in deposit every minutes';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$orders = Payment::where('is_status', Status::isDepositPending)->get(); // Sesuaikan dengan logika pengambilan data
|
||||
$currentTimestamp = time(); // Get the current timestamp
|
||||
|
||||
foreach ($orders as $order) {
|
||||
$createdAtTimestamp = strtotime($order->created_at);
|
||||
|
||||
// Add 3 days to the creation date timestamp
|
||||
$expiryTimestamp = $createdAtTimestamp + (3 * 24 * 60 * 60); // 3 days in seconds
|
||||
|
||||
// Compare the expiry timestamp with the current timestamp
|
||||
$isExpired = $expiryTimestamp < $currentTimestamp;
|
||||
$expired = $isExpired ? true : false;
|
||||
|
||||
if($expired == true) {
|
||||
$findOrder = Payment::find($order->id);
|
||||
$findOrder->is_status = Status::isDepositCancel;
|
||||
|
||||
// save
|
||||
$findOrder->save();
|
||||
}
|
||||
}
|
||||
|
||||
$this->info('Status updated successfully!');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Modules\User\Entities\OrderModel as Order;
|
||||
use App\Enums\GlobalEnum as Status;
|
||||
|
||||
class OrdersCommand extends Command
|
||||
{
|
||||
protected $signature = 'orders:update';
|
||||
protected $description = 'Update status in orders every minutes';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$orders = Order::where('is_status', Status::isOrderRequested)->get(); // Sesuaikan dengan logika pengambilan data
|
||||
$currentTimestamp = time(); // Get the current timestamp
|
||||
|
||||
foreach ($orders as $order) {
|
||||
$createdAtTimestamp = strtotime($order->created_at);
|
||||
|
||||
// Add 3 days to the creation date timestamp
|
||||
$expiryTimestamp = $createdAtTimestamp + (3 * 24 * 60 * 60); // 3 days in seconds
|
||||
|
||||
// Compare the expiry timestamp with the current timestamp
|
||||
$isExpired = $expiryTimestamp < $currentTimestamp;
|
||||
$expired = $isExpired ? true : false;
|
||||
|
||||
if($expired == true) {
|
||||
$findOrder = Order::find($order->id);
|
||||
$findOrder->is_status = Status::isOrderCancelled;
|
||||
$findOrder->last_buyer_message = 'Dibatalkan secara otomatis oleh sistem karena melebihi batas waktu 3 hari reseller tidak menanggapi permintaan pesanan';
|
||||
$findOrder->cancel_reason = 'Dibatalkan secara otomatis oleh sistem karena melebihi batas waktu 3 hari reseller tidak menanggapi permintaan pesanan';
|
||||
|
||||
// save
|
||||
$findOrder->save();
|
||||
}
|
||||
}
|
||||
|
||||
$this->info('Status updated successfully!');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Modules\Seller\Entities\PaymentModel as Payment;
|
||||
use Modules\Seller\Entities\AccountModel as User;
|
||||
use App\Enums\GlobalEnum as Status;
|
||||
|
||||
class RealtimeDepositCommand extends Command
|
||||
{
|
||||
protected $signature = 'realtime-deposit:update';
|
||||
protected $description = 'Update status in deposit every minutes';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$orders = Payment::where('is_status', Status::isDepositPending)->get(); // Sesuaikan dengan logika pengambilan data
|
||||
$currentTimestamp = time(); // Get the current timestamp
|
||||
|
||||
foreach ($orders as $order) {
|
||||
$merchantCode = app_info('duitku_merchant');
|
||||
$apiKey = app_info('duitku_client');
|
||||
$merchantOrderId = $order->deposit_number; // dari anda (merchant), bersifat unik
|
||||
$signature = md5($merchantCode . $merchantOrderId . $apiKey);
|
||||
|
||||
$params = array(
|
||||
'merchantCode' => $merchantCode,
|
||||
'merchantOrderId' => $merchantOrderId,
|
||||
'signature' => $signature
|
||||
);
|
||||
|
||||
$params_string = json_encode($params);
|
||||
if(app_info('duitku_sandbox') == 1) {
|
||||
$url = 'https://sandbox.duitku.com/webapi/api/merchant/transactionStatus'; // Sandbox
|
||||
} else {
|
||||
$url = 'https://passport.duitku.com/webapi/api/merchant/transactionStatus'; // Production
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $params_string);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
||||
'Content-Type: application/json',
|
||||
'Content-Length: ' . strlen($params_string))
|
||||
);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||
|
||||
//execute post
|
||||
$request = curl_exec($ch);
|
||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
|
||||
if($httpCode == 200)
|
||||
{
|
||||
$results = json_decode($request, true);
|
||||
if($results['statusCode'] == 02) {
|
||||
$findOrder = Payment::find($order->id);
|
||||
$findOrder->is_status = Status::isDepositCancel;
|
||||
$findOrder->urlRedirect = NULL;
|
||||
|
||||
// save
|
||||
$findOrder->save();
|
||||
} elseif($results['statusCode'] == 00) {
|
||||
$findOrder = Payment::find($order->id);
|
||||
$findOrder->is_status = Status::isDepositPaid;
|
||||
$findOrder->urlRedirect = NULL;
|
||||
|
||||
$findUser = User::where('id', $order->user_id)->first();
|
||||
$findUser->balance = ($findUser->balance + $order->amount);
|
||||
|
||||
// save
|
||||
$findOrder->save();
|
||||
$findUser->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->info('Status updated successfully!');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
$schedule->command('orders:update')->everyFiveMinutes();
|
||||
$schedule->command('deposit:update')->everyFiveMinutes();
|
||||
$schedule->command('realtime-deposit:update')->everyFiveMinutes();
|
||||
}
|
||||
|
||||
protected function commands()
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,167 @@
|
|||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
use MadWeb\Enum\Enum;
|
||||
|
||||
final class GlobalEnum extends Enum
|
||||
{
|
||||
// enum management menu
|
||||
const isAdmin = 1;
|
||||
const isEditor = 2;
|
||||
const isModerator = 3;
|
||||
const isMembers = 4;
|
||||
const isKepalaSekolah = 2;
|
||||
const isKonselor = 3;
|
||||
const isSiswa = 4;
|
||||
const isWaliMurid = 5;
|
||||
|
||||
// enum sites status
|
||||
const isWebsiteActive = 1;
|
||||
const isWebsiteInReview = 2;
|
||||
const isWebsiteNotActive = 3;
|
||||
const isWebsiteRejected = 4;
|
||||
const isWebsiteDeactivated = 5;
|
||||
|
||||
// enum domain status
|
||||
const isDomainActive = 1;
|
||||
const isDomainInReview = 2;
|
||||
const isDomainNotActive = 3;
|
||||
const isDomainRejected = 4;
|
||||
const isDomainDeactivated = 5;
|
||||
|
||||
// enum log type
|
||||
const LogOfLogin = 1;
|
||||
const LogOfGeneral = 2;
|
||||
|
||||
// enum buzzer services status
|
||||
const isServiceActive = 1;
|
||||
const isServiceNotActive = 2;
|
||||
|
||||
// enum withdrawal status
|
||||
const isWithdrawPending = 1;
|
||||
const isWithdrawOnProgress = 2;
|
||||
const isWithdrawPaid = 3;
|
||||
const isWithdrawCancel = 4;
|
||||
|
||||
// enum order status
|
||||
const isOrderRequested = 1;
|
||||
const isOrderOnWorking = 2;
|
||||
const isOrderSubmitted = 3;
|
||||
const isOrderRevision = 4;
|
||||
const isOrderCompleted = 5;
|
||||
const isOrderReqCancel = 6;
|
||||
const isOrderCancelled = 7;
|
||||
const isOrderRejected = 8;
|
||||
|
||||
// enum order history status
|
||||
const isHistoryDone = 1;
|
||||
const isHistoryRevision = 2;
|
||||
const isHistoryJobDone = 3;
|
||||
const isHistoryReqCancel = 4;
|
||||
const isHistoryCanceled = 5;
|
||||
|
||||
// enum product buzzer & services status
|
||||
const isProductActive = 1;
|
||||
const isProductNotActive = 2;
|
||||
|
||||
// enum product buzzer order status
|
||||
const isProductOrderPending = 1;
|
||||
const isProductOrderPaymentAlready = 2;
|
||||
const isProductOrderProcess = 3;
|
||||
const isProductOrderDone = 4;
|
||||
const isProductOrderCancel = 5;
|
||||
|
||||
const isProductOrderTypeMixed = 1;
|
||||
const isProductOrderTypeMen = 2;
|
||||
const isProductOrderTypeWomen = 3;
|
||||
|
||||
// enum product buzzer order detail comment status
|
||||
const isProductCommentPending = 1;
|
||||
const isProductCommentInReview = 2;
|
||||
const isProductCommentDeclined = 3;
|
||||
const isProductCommentApproved = 4;
|
||||
|
||||
// enum order type
|
||||
const isOrderSites = 1;
|
||||
const isOrderDomain = 2;
|
||||
|
||||
// enum user status
|
||||
const isActive = 1;
|
||||
const isInactive = 2;
|
||||
const isDeactive = 3;
|
||||
const isNotVerified = 4;
|
||||
|
||||
// enum seller status
|
||||
const isSellerActive = 1;
|
||||
const isSellerInActive = 2;
|
||||
|
||||
// enum order status
|
||||
const isOrderPending = 1;
|
||||
const isOrderProcessing = 2;
|
||||
const isOrderInReview = 3;
|
||||
const isOrderDeclined = 4;
|
||||
const isOrderSuccessed = 5;
|
||||
|
||||
// enum deposit status
|
||||
const isDepositPending = 1;
|
||||
const isDepositInquiry = 2;
|
||||
const isDepositFailed = 3;
|
||||
const isDepositPaid = 4;
|
||||
const isDepositCancel = 5;
|
||||
|
||||
// enum methodWithDeposit
|
||||
const isMethodPayLater = 0;
|
||||
const isMethodVirtual = 1;
|
||||
|
||||
// enum promotion status
|
||||
const isPromotionAvailable = 1;
|
||||
const isPromotionUsed = 2;
|
||||
|
||||
// enum content status
|
||||
const isPostPublished = 1;
|
||||
const isPostDraft = 2;
|
||||
|
||||
// enum ticket status
|
||||
const isTicketPending = 1;
|
||||
const isTicketClosed = 2;
|
||||
const isTicketReplied = 3;
|
||||
|
||||
/* enum website-config
|
||||
[1] SMTP Config
|
||||
[2] Maintenance Mode
|
||||
*/
|
||||
const isMailerEnabled = 1;
|
||||
const isMailerDisabled = 2;
|
||||
const isMaintenanceMode = 3;
|
||||
|
||||
/* enum for seller modules
|
||||
[1] Sites Listing
|
||||
[2] Rekening
|
||||
*/
|
||||
const isSiteActive = 1;
|
||||
const isSiteInReview = 2;
|
||||
const isSiteNotActive = 3;
|
||||
const isSiteRejected = 4;
|
||||
const isSiteDeactivated = 5;
|
||||
|
||||
const isSiteOwner = 1;
|
||||
const isSiteAuthor = 2;
|
||||
|
||||
const isSiteTypeDoFollow = 1;
|
||||
const isSiteTypeNoFollow = 2;
|
||||
|
||||
// rekening status
|
||||
const isRekeningActive = 1;
|
||||
const isRekeningInactive = 2;
|
||||
|
||||
// ticket status
|
||||
const isTicketSellerPending = 1;
|
||||
const isTicketUserReplied = 2;
|
||||
const isTicketAdminReplied = 3;
|
||||
const isTicketSellerClosed = 4;
|
||||
|
||||
const isTicketPriorityNormal = 1;
|
||||
const isTicketPriorityMedium = 2;
|
||||
const isTicketPriorityHigh = 3;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
use MadWeb\Enum\Enum;
|
||||
|
||||
/**
|
||||
* @method static ProjectStatusEnum FOO()
|
||||
* @method static ProjectStatusEnum BAR()
|
||||
* @method static ProjectStatusEnum BAZ()
|
||||
*/
|
||||
final class ProjectStatusEnum extends Enum
|
||||
{
|
||||
const default = 0;
|
||||
const PUBLISH = 1;
|
||||
const DRAFT = 0;
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Throwable;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* A list of the exception types that are not reported.
|
||||
*
|
||||
* @var array<int, class-string<Throwable>>
|
||||
*/
|
||||
protected $dontReport = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* A list of the inputs that are never flashed for validation exceptions.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $dontFlash = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register the exception handling callbacks for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->reportable(function (Throwable $e) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,656 @@
|
|||
<?php
|
||||
|
||||
|
||||
if (!function_exists('isAttachment')) {
|
||||
/**
|
||||
* Determines if the given image is an attachment.
|
||||
*
|
||||
* @param string $image The path of the image file.
|
||||
* @return void
|
||||
*/
|
||||
function isAttachment($image){
|
||||
$extension = pathinfo($image, PATHINFO_EXTENSION);
|
||||
$imgExtArr = ['jpg', 'jpeg', 'png'];
|
||||
if(in_array($extension, $imgExtArr)){
|
||||
echo 'images';
|
||||
} elseif(in_array($extension, ['xls','xlsx'])) {
|
||||
echo 'excel';
|
||||
} else {
|
||||
echo 'word';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getKriteriaId($no_urut)
|
||||
{
|
||||
$result = \App\Models\Kriteria::select('id_kriteria')->orderBy('id_kriteria')->get();
|
||||
foreach ($result as $value) {
|
||||
$listId[] = $value->id_kriteria;
|
||||
}
|
||||
return $listId[$no_urut];
|
||||
}
|
||||
|
||||
// Fungsi untuk mencari id alternatif berdasarkan urutan ke berapa
|
||||
function getAlternatifId($no_urut)
|
||||
{
|
||||
$result = \App\Models\Alternatif::select('id_alternatif')->orderBy('id_alternatif')->get();
|
||||
foreach ($result as $value) {
|
||||
$listId[] = $value->id_alternatif;
|
||||
}
|
||||
return $listId[$no_urut];
|
||||
}
|
||||
|
||||
// Fungsi untuk mengambil nilai perbandingan di database
|
||||
function getNilaiPerbandinganKriteria($kriteria1, $kriteria2)
|
||||
{
|
||||
$id_kriteria1 = getKriteriaId($kriteria1);
|
||||
$id_kriteria2 = getKriteriaId($kriteria2);
|
||||
|
||||
$query = \App\Models\AnalisaKriteria::where('kriteria_pertama', $id_kriteria1)->where('kriteria_kedua', $id_kriteria2);
|
||||
|
||||
if ($query->count() == 0) {
|
||||
$nilai = 1;
|
||||
} else {
|
||||
foreach ($query->get() as $value) {
|
||||
$nilai = $value->nilai_analisa_kriteria;
|
||||
}
|
||||
}
|
||||
|
||||
return $nilai;
|
||||
}
|
||||
|
||||
function insertRanking($id_alternatif, $nilai)
|
||||
{
|
||||
return \App\Models\Ranking::updateOrCreate(
|
||||
['alternatif' => $id_alternatif],
|
||||
['skor_bobot' => $nilai]
|
||||
);
|
||||
}
|
||||
|
||||
function getKriteriaPV($id_kriteria)
|
||||
{
|
||||
$result = \App\Models\BobotKriteria::where('id_kriteria', $id_kriteria)->first();
|
||||
$pv = $result ? $result->nilai : 0; // Atur nilai default jika $result null
|
||||
return $pv;
|
||||
}
|
||||
|
||||
// Mencari bobot alternatif dari database
|
||||
function getAlternatifPV($id_alternatif, $id_kriteria)
|
||||
{
|
||||
$result = \App\Models\BobotAlternatif::where('id_alternatif', $id_alternatif)->where('id_kriteria', $id_kriteria)->first();
|
||||
|
||||
$pv = $result ? $result->nilai : 0; // Atur nilai default jika $result null
|
||||
return $pv;
|
||||
}
|
||||
|
||||
function getNilaiPerbandinganAlternatif($alternatif1, $alternatif2, $id_kriteria)
|
||||
{
|
||||
$id_alternatif1 = getAlternatifId($alternatif1);
|
||||
$id_alternatif2 = getAlternatifId($alternatif2);
|
||||
|
||||
$query = \App\Models\AnalisaAlternatif::where('alternatif_pertama', $id_alternatif1)->where('alternatif_kedua', $id_alternatif2)->where('id_kriteria', $id_kriteria);
|
||||
|
||||
if ($query->count() == 0) {
|
||||
$nilai = 1;
|
||||
} else {
|
||||
foreach ($query->get() as $value) {
|
||||
$nilai = $value->nilai_analisa_alternatif;
|
||||
}
|
||||
}
|
||||
|
||||
return $nilai;
|
||||
}
|
||||
|
||||
function getEigenVector($matrik_a, $matrik_b, $n)
|
||||
{
|
||||
$eigenVektor = 0;
|
||||
for ($i = 0; $i <= ($n - 1); $i++) {
|
||||
$eigenVektor += ($matrik_a[$i] * ($matrik_b[$i] / $n));
|
||||
}
|
||||
return $eigenVektor;
|
||||
}
|
||||
|
||||
// Mencari Cons Index
|
||||
function getConsIndex($matrik_a, $matrik_b, $n)
|
||||
{
|
||||
$eigenVektor = getEigenVector($matrik_a, $matrik_b, $n);
|
||||
$consIndex = ($eigenVektor - $n) / ($n - 1);
|
||||
return $consIndex;
|
||||
}
|
||||
|
||||
// Mencari nilai Index Random
|
||||
function getNilaiIR($jumlah)
|
||||
{
|
||||
$result = \App\Models\NilaiRandom::where('jumlah', $jumlah)->first();
|
||||
return $result->nilai;
|
||||
}
|
||||
|
||||
function getConsRatio($matrik_a, $matrik_b, $n)
|
||||
{
|
||||
$consIndex = getConsIndex($matrik_a, $matrik_b, $n);
|
||||
$consRatio = $consIndex / getNilaiIR($n);
|
||||
return $consRatio;
|
||||
}
|
||||
|
||||
// Mendapatkan nama kriteria
|
||||
function getKriteriaNama($no_urut)
|
||||
{
|
||||
$result = \App\Models\Kriteria::select('nama_kriteria')->get();
|
||||
foreach ($result as $value) {
|
||||
$nama[] = $value->nama_kriteria;
|
||||
}
|
||||
|
||||
return $nama[$no_urut];
|
||||
}
|
||||
|
||||
// Mendapatkan nama alternatif
|
||||
function getAlternatifNama($no_urut)
|
||||
{
|
||||
$result = \App\Models\Alternatif::select('nama_alternatif')->get();
|
||||
foreach ($result as $value) {
|
||||
$nama[] = $value->nama_alternatif;
|
||||
}
|
||||
|
||||
return $nama[$no_urut];
|
||||
}
|
||||
|
||||
if(!function_exists('app_info'))
|
||||
{
|
||||
/**
|
||||
* Retrieves the website configuration for the specified name.
|
||||
*
|
||||
* @param string $name The name of the website.
|
||||
* @throws \Some_Exception_Class Description of the exception that can be thrown.
|
||||
* @return mixed The website configuration.
|
||||
*/
|
||||
function app_info($name)
|
||||
{
|
||||
$websiteConfiguration = \App\Models\Website::where('name', $name)->first()->value;
|
||||
return $websiteConfiguration;
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('app_smtp_info'))
|
||||
{
|
||||
/**
|
||||
* Retrieves the website configuration for the specified name.
|
||||
*
|
||||
* @param string $name The name of the website.
|
||||
* @throws \Some_Exception_Class Description of the exception that can be thrown.
|
||||
* @return mixed The website configuration.
|
||||
*/
|
||||
function app_smtp_info()
|
||||
{
|
||||
$mailConfiguration = \App\Models\Mail::find(1)->first();
|
||||
return $mailConfiguration;
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('hasExpired'))
|
||||
{
|
||||
/**
|
||||
* Determines if the given date has expired.
|
||||
*
|
||||
* @param string $date The date to check.
|
||||
* @return bool True if the date has expired, false otherwise.
|
||||
*/
|
||||
function hasExpired($accountCreatedAt)
|
||||
{
|
||||
// Konversi tanggal pembuatan akun menjadi objek DateTime
|
||||
$accountCreatedTime = new DateTime($accountCreatedAt);
|
||||
$currentTime = new DateTime();
|
||||
|
||||
// Hitung selisih waktu antara tanggal pembuatan akun dan waktu saat ini
|
||||
$interval = $accountCreatedTime->diff($currentTime);
|
||||
|
||||
// Periksa jika selisih waktu lebih dari atau sama dengan 60 menit (3600 detik)
|
||||
return $interval->format('%i') >= 60;
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('checkExpired'))
|
||||
{
|
||||
function checkExpired($createdAt, $isExpired)
|
||||
{
|
||||
$givenDate = new DateTime($createdAt);
|
||||
$currentDate = new DateTime();
|
||||
|
||||
// Add 3 days to the current date
|
||||
$currentDate->modify('+3 days');
|
||||
// Compare the given date timestamp with the current date + 3 days timestamp
|
||||
$isExpired = $givenDate > $currentDate;
|
||||
return $isExpired;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate an application URL.
|
||||
*
|
||||
* @param string $url The URL to append to the application URL.
|
||||
* @return string The generated application URL.
|
||||
*/
|
||||
if (!function_exists('app_url')) {
|
||||
function app_url($url)
|
||||
{
|
||||
return url('app/' . $url);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('site_url')) {
|
||||
function site_url($type, $url)
|
||||
{
|
||||
switch($type)
|
||||
{
|
||||
case 'user':
|
||||
return url('user/' . $url);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('removeUrlPrefix')) {
|
||||
function removeUrlPrefix($url)
|
||||
{
|
||||
$url = preg_replace('#^https?://#', '', $url);
|
||||
// Remove www. prefix
|
||||
$url = preg_replace('#^www\.#', '', $url);
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('invoiceGenerator')) {
|
||||
function invoiceGenerator()
|
||||
{
|
||||
$characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
||||
$randomString = '';
|
||||
for ($i = 0; $i < 8; $i++) {
|
||||
$randomString .= $characters[rand(0, strlen($characters) - 1)];
|
||||
}
|
||||
// Membuat invoice dengan format INV-{timestamp}-{karakter-acak}
|
||||
$invoice = 'INV-' . time() . '-' . $randomString;
|
||||
return $invoice;
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('virtual_gateway')) {
|
||||
function virtual_gateway($data)
|
||||
{
|
||||
$merchantCode = app_info('duitku_merchant');
|
||||
$apiKey = app_info('duitku_client');
|
||||
|
||||
$paymentAmount = $data['amount'];
|
||||
$merchantOrderId = $data['invoice'];
|
||||
$productDetails = 'Pembayaran Deposit Saldo mengggunakan Duitku';
|
||||
$email = user()->email;
|
||||
$phoneNumber = '';
|
||||
$additionalParam = '';
|
||||
$merchantUserInfo = '';
|
||||
$customerVaName = user()->name;
|
||||
$callbackUrl = site_url('user', 'payment/deposit/callback');
|
||||
$returnUrl = site_url('user', 'payment/deposit/return');
|
||||
$expiryPeriod = 1440;
|
||||
$signature = md5($merchantCode . $merchantOrderId . $paymentAmount . $apiKey);
|
||||
|
||||
// Customer Detail
|
||||
$firstName = 'DEPA';
|
||||
$lastName = 'Auto Deposit';
|
||||
$alamat = "Jl. Jakarta";
|
||||
$city = "Jakarta";
|
||||
$postalCode = "11530";
|
||||
$countryCode = "ID";
|
||||
|
||||
$address = array(
|
||||
'firstName' => $firstName,
|
||||
'lastName' => $lastName,
|
||||
'address' => $alamat,
|
||||
'city' => $city,
|
||||
'postalCode' => $postalCode,
|
||||
'phone' => $phoneNumber,
|
||||
'countryCode' => $countryCode
|
||||
);
|
||||
|
||||
$customerDetail = array(
|
||||
'firstName' => $firstName,
|
||||
'lastName' => $lastName,
|
||||
'email' => $email,
|
||||
'phoneNumber' => $phoneNumber,
|
||||
'billingAddress' => $address,
|
||||
'shippingAddress' => $address
|
||||
);
|
||||
|
||||
$item1 = array(
|
||||
'name' => 'Deposit Saldo POSTAMU',
|
||||
'price' => $data['amount'],
|
||||
'quantity' => 1
|
||||
);
|
||||
|
||||
$itemDetails = array($item1);
|
||||
$params = array(
|
||||
'merchantCode' => $merchantCode,
|
||||
'paymentAmount' => $paymentAmount,
|
||||
'paymentMethod' => $data['method'],
|
||||
'merchantOrderId' => $merchantOrderId,
|
||||
'productDetails' => $productDetails,
|
||||
'additionalParam' => $additionalParam,
|
||||
'merchantUserInfo' => $merchantUserInfo,
|
||||
'customerVaName' => $customerVaName,
|
||||
'email' => $email,
|
||||
'phoneNumber' => $phoneNumber,
|
||||
// 'accountLink' => $accountLink,
|
||||
'itemDetails' => $itemDetails,
|
||||
'customerDetail' => $customerDetail,
|
||||
'callbackUrl' => $callbackUrl,
|
||||
'returnUrl' => $returnUrl,
|
||||
'signature' => $signature,
|
||||
'expiryPeriod' => $expiryPeriod
|
||||
);
|
||||
|
||||
$params_string = json_encode($params);
|
||||
|
||||
if(app_info('duitku_sandbox') == 1) {
|
||||
$url = 'https://sandbox.duitku.com/webapi/api/merchant/v2/inquiry'; // Sandbox
|
||||
} else {
|
||||
$url = 'https://passport.duitku.com/webapi/api/merchant/v2/inquiry'; // Production
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $params_string);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
||||
'Content-Type: application/json',
|
||||
'Content-Length: ' . strlen($params_string))
|
||||
);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||
|
||||
//execute post
|
||||
$request = curl_exec($ch);
|
||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
|
||||
if($httpCode == 200) {
|
||||
$result = json_decode($request, true);
|
||||
return [
|
||||
'url' => $result['paymentUrl'],
|
||||
'status' => 'success'
|
||||
];
|
||||
} else {
|
||||
$result = json_decode($request, true);
|
||||
return [
|
||||
'msg' => 'Terjadi kesalahan tidak terduga.',
|
||||
'status' => 'error',
|
||||
'error' => $result
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('isUrlSecure')) {
|
||||
function isUrlSecure($url)
|
||||
{
|
||||
return strpos($url, 'https://') !== false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!function_exists('filterExists')) {
|
||||
function filterExists()
|
||||
{
|
||||
if(!empty(\Illuminate\Support\Facades\Request::input('filterType'))
|
||||
|| !empty(\Illuminate\Support\Facades\Request::input('categoryFilter'))
|
||||
|| !empty(\Illuminate\Support\Facades\Request::input('minimumPrice'))
|
||||
|| !empty(\Illuminate\Support\Facades\Request::input('maximumPrice'))
|
||||
|| !empty(\Illuminate\Support\Facades\Request::input('searchFilter'))) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('date_formatting')) {
|
||||
function date_formatting($date, $format)
|
||||
{
|
||||
switch($format)
|
||||
{
|
||||
case 'd-m-Y':
|
||||
return date('d-m-Y', strtotime($date));
|
||||
break;
|
||||
|
||||
case 'indonesia':
|
||||
$month = array (
|
||||
1 => 'Januari',
|
||||
'Februari',
|
||||
'Maret',
|
||||
'April',
|
||||
'Mei',
|
||||
'Juni',
|
||||
'Juli',
|
||||
'Agustus',
|
||||
'September',
|
||||
'Oktober',
|
||||
'November',
|
||||
'Desember'
|
||||
);
|
||||
$reformat = explode('-', $date);
|
||||
return $reformat[2] . ' ' . $month[ (int)$reformat[1] ] . ' ' . $reformat[0];
|
||||
break;
|
||||
|
||||
case 'timeago':
|
||||
$time_difference = time() - strtotime($date);
|
||||
if( $time_difference < 1 ) { return '1 detik yang lalu'; }
|
||||
$condition = array( 12 * 30 * 24 * 60 * 60 => 'year',
|
||||
30 * 24 * 60 * 60 => 'bulan',
|
||||
24 * 60 * 60 => 'hari',
|
||||
60 * 60 => 'jam',
|
||||
60 => 'menit',
|
||||
1 => 'detik'
|
||||
);
|
||||
|
||||
foreach( $condition as $secs => $str )
|
||||
{
|
||||
$d = $time_difference / $secs;
|
||||
if( $d >= 1 )
|
||||
{
|
||||
$t = round( $d );
|
||||
return $t . ' ' . $str . ( $t > 1 ? '' : '' ) . ' yang lalu';
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('findUser')) {
|
||||
function findUser($id)
|
||||
{
|
||||
return \App\Models\User::find($id)->first();
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('switch_page')) {
|
||||
function switch_page()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('isSeller')) {
|
||||
function isSeller()
|
||||
{
|
||||
$checkUserModel = \App\Models\Seller::where('user_id', \Illuminate\Support\Facades\Auth::user()->id)->count();
|
||||
if($checkUserModel > 0){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('active_page')) {
|
||||
function active_page($activePage)
|
||||
{
|
||||
$currentRoute = \Illuminate\Support\Facades\Route::currentRouteName();
|
||||
if ($currentRoute) {
|
||||
$routeUri = htmlspecialchars($currentRoute);
|
||||
if($routeUri === $activePage) { return 'active'; }
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('routesAll')) {
|
||||
function routesAll()
|
||||
{
|
||||
$routesInAppPrefix = [];
|
||||
foreach (\Illuminate\Support\Facades\Route::getRoutes() as $route) {
|
||||
$uri = $route->uri();
|
||||
|
||||
// Check if the route URI starts with the desired prefix
|
||||
if (strpos($uri, 'app/') === 0) {
|
||||
$routesInAppPrefix[] = $route->action['as'];
|
||||
}
|
||||
}
|
||||
|
||||
$convertIntoJson = json_encode($routesInAppPrefix, true);
|
||||
return json_decode($convertIntoJson, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the currently authenticated user.
|
||||
*
|
||||
* @return User The currently authenticated user.
|
||||
*/
|
||||
if (!function_exists('user')) {
|
||||
function user()
|
||||
{
|
||||
return \Illuminate\Support\Facades\Auth::user();
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('segment')) {
|
||||
/**
|
||||
* Retrieves a segment from the current request.
|
||||
*
|
||||
* @param int $key The key of the segment to retrieve.
|
||||
* @return mixed The value of the segment.
|
||||
*/
|
||||
function segment($key)
|
||||
{
|
||||
return request()->segment($key);
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('enum')) {
|
||||
/**
|
||||
* Retrieves the value of a constant from the GlobalEnum class.
|
||||
*
|
||||
* @param string $args The name of the constant to retrieve.
|
||||
* @return mixed The value of the constant.
|
||||
*/
|
||||
function enum($args)
|
||||
{
|
||||
return constant("\App\Enums\GlobalEnum::$args");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a Gravatar URL for a given email.
|
||||
*
|
||||
* @param string $email The email address to generate the Gravatar URL for.
|
||||
* @throws None
|
||||
* @return string The Gravatar URL.
|
||||
*/
|
||||
if (!function_exists('gravatar_team')) {
|
||||
function gravatar_team($email)
|
||||
{
|
||||
$username = md5($email);
|
||||
return "https://www.gravatar.com/avatar/$username?s=70&d=retro&r=y";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a number into Indonesian Rupiah format.
|
||||
*
|
||||
* @param int $nominal The number to be converted.
|
||||
* @return string The converted number in Indonesian Rupiah format.
|
||||
*/
|
||||
if (!function_exists('rupiah')) {
|
||||
function rupiah($nominal)
|
||||
{
|
||||
return 'Rp. ' . number_format($nominal,0,',','.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A function that changes the given nominal value into a different format.
|
||||
*
|
||||
* @param string $nominal The nominal value to be changed.
|
||||
* @return string The changed nominal value.
|
||||
*/
|
||||
if (!function_exists('rupiah_changer')) {
|
||||
function rupiah_changer($nominal)
|
||||
{
|
||||
if(strlen($nominal) == 4) {
|
||||
return substr($nominal, 0, 1) . 'RB';
|
||||
} elseif(strlen($nominal) == 5) {
|
||||
return substr($nominal, 0, 2) . 'RB';
|
||||
} elseif(strlen($nominal) == 6) {
|
||||
return substr($nominal, 0, 3) . 'RB';
|
||||
} elseif(strlen($nominal) == 7) {
|
||||
return substr($nominal, 0, 1) . 'JT';
|
||||
} elseif(strlen($nominal) == 8) {
|
||||
return substr($nominal, 0, 2) . 'JT';
|
||||
} elseif(strlen($nominal) == 9) {
|
||||
return substr($nominal, 0, 3) . 'JT';
|
||||
} elseif(strlen($nominal) == 10) {
|
||||
return substr($nominal, 0, 1) . 'M';
|
||||
} elseif(strlen($nominal) == 11) {
|
||||
return substr($nominal, 0, 2) . 'M';
|
||||
} elseif(strlen($nominal) == 12) {
|
||||
return substr($nominal, 0, 3) . 'M';
|
||||
} elseif(strlen($nominal) == 13) {
|
||||
return substr($nominal, 0, 1) . 'T';
|
||||
} elseif(strlen($nominal) == 14) {
|
||||
return substr($nominal, 0, 2) . 'T';
|
||||
} elseif(strlen($nominal) == 15) {
|
||||
return substr($nominal, 0, 3) . 'T';
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Formats a phone number.
|
||||
*
|
||||
* @param string $value The phone number to be formatted.
|
||||
* @return string The formatted phone number.
|
||||
*/
|
||||
if (!function_exists('phone_formatter')) {
|
||||
function phone_formatter($value) {
|
||||
// kadang ada penulisan no hp 0811 239 345
|
||||
$nohp = str_replace(" ","",$value);
|
||||
// kadang ada penulisan no hp (0274) 778787
|
||||
$nohp = str_replace("(","",$value);
|
||||
// kadang ada penulisan no hp (0274) 778787
|
||||
$nohp = str_replace(")","",$value);
|
||||
// kadang ada penulisan no hp 0811.239.345
|
||||
$nohp = str_replace(".","",$value);
|
||||
|
||||
// cek apakah no hp mengandung karakter + dan 0-9
|
||||
if(!preg_match('/[^+0-9]/',trim($nohp))){
|
||||
// cek apakah no hp karakter 1-3 adalah +62
|
||||
if(substr(trim($nohp), 0, 3)=='+62'){
|
||||
$hp = trim($nohp);
|
||||
}
|
||||
// cek apakah no hp karakter 1 adalah 0
|
||||
elseif(substr(trim($nohp), 0, 1)=='0'){
|
||||
$hp = '+62'.substr(trim($nohp), 1);
|
||||
}
|
||||
}
|
||||
return $hp;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Retrieves the value of the specified website name from the database.
|
||||
*
|
||||
* @param string $name The name of the website.
|
||||
* @throws Exception If the website does not exist.
|
||||
* @return mixed The value of the website.
|
||||
*/
|
||||
if (!function_exists('frontend_db')) {
|
||||
function frontend_db($name)
|
||||
{
|
||||
return \App\Models\Website::where('name', $name)->first()->value;
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('app_url')) {
|
||||
function app_url($name)
|
||||
{
|
||||
return url('app' . $name);
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('assets_url')) {
|
||||
function assets_url($name)
|
||||
{
|
||||
$image = str_replace('public/', '', $name);
|
||||
return asset('storage/' . $image);
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('frontend')) {
|
||||
function frontend($var)
|
||||
{
|
||||
return asset('frontend/' . $var);
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('pages')) {
|
||||
function pages($var)
|
||||
{
|
||||
return asset('landing/' . $var);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a SweetAlert popup based on the given type and message.
|
||||
*
|
||||
* @param string $type The type of the alert (e.g., 'danger', 'success').
|
||||
* @param string $msg The message to be displayed in the alert.
|
||||
* @return string The generated JavaScript code for the SweetAlert popup.
|
||||
*/
|
||||
if (!function_exists('swal_alert')) {
|
||||
function swal_alert($type, $msg)
|
||||
{
|
||||
switch($type)
|
||||
{
|
||||
case 'error':
|
||||
return "
|
||||
<script>
|
||||
Swal.fire(
|
||||
'Woops..',
|
||||
'$msg',
|
||||
'error'
|
||||
)
|
||||
</script>
|
||||
";
|
||||
break;
|
||||
|
||||
case 'success':
|
||||
return "
|
||||
<script>
|
||||
Swal.fire(
|
||||
'Success',
|
||||
'$msg',
|
||||
'success'
|
||||
)
|
||||
</script>
|
||||
";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the "swal" session value.
|
||||
*
|
||||
* @return mixed The value of the "swal" session.
|
||||
*/
|
||||
if (!function_exists('swal_response')) {
|
||||
function swal_response()
|
||||
{
|
||||
if(session()->has('swal')) {
|
||||
return session('swal');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
namespace App\Helpers;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class MailerHelper
|
||||
{
|
||||
/**
|
||||
* Sends an email to the specified email address.
|
||||
*
|
||||
* @param string $email The email address to send the email to.
|
||||
* @param bool $plain Whether to send the email as plain text or not.
|
||||
* @param string|null $view The view to use for the email content.
|
||||
* @param array $data Additional data to pass to the email view.
|
||||
* @throws \Exception If an error occurs while sending the email.
|
||||
* @return bool Whether the email was sent successfully or not.
|
||||
*/
|
||||
public static function to($recipientEmail, $plain = false, $view = null, $data = [])
|
||||
{
|
||||
$message = $data['message'];
|
||||
$subject = $data['subject'];
|
||||
switch($plain)
|
||||
{
|
||||
case true:
|
||||
try {
|
||||
Mail::raw($message, function ($message) use ($recipientEmail, $subject) {
|
||||
$message->to($recipientEmail)->subject($subject);
|
||||
});
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case false;
|
||||
try {
|
||||
Mail::send($view, ['data' => $data], function ($message) use ($recipientEmail, $subject) {
|
||||
$message->to($recipientEmail)
|
||||
->subject($subject);
|
||||
});
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Enums\GlobalEnum;
|
||||
use DataTables;
|
||||
|
||||
class AdminController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function activity()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,191 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use DataTables;
|
||||
use GuzzleHttp\Client;
|
||||
use Carbon\Carbon;
|
||||
|
||||
use App\Models\Alternatif;
|
||||
|
||||
class AlternatifController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
$data = Alternatif::select('*');
|
||||
// Convert the Eloquent Collection to a regular PHP array
|
||||
$data->each(function ($item, $key) {
|
||||
$item->rowIndex = $key + 1;
|
||||
});
|
||||
|
||||
return Datatables::of($data)
|
||||
->addIndexColumn()
|
||||
->addColumn('title-post', function($row){
|
||||
$text = '
|
||||
<p class="mb-0">' . $row->nama_alternatif . '</p>
|
||||
';
|
||||
return $text;
|
||||
})
|
||||
->addColumn('kode', function($row){
|
||||
return $row->id_alternatif;
|
||||
})
|
||||
->rawColumns(['title-post', 'kode'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'subtitle' => 'Alternatif',
|
||||
'button' => true,
|
||||
'module' => [
|
||||
'url' => route('alternatif.create'),
|
||||
'name' => 'Tambah Baru'
|
||||
]
|
||||
];
|
||||
|
||||
return view('admin.app.content.alternatif.index', compact('data'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Tambah baru',
|
||||
];
|
||||
|
||||
return view('admin.app.content.alternatif.add', compact('data'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'id_alternatif' => 'required',
|
||||
'nama_alternatif' => 'required',
|
||||
'usia_ayam'=> 'required',
|
||||
'berat'=> 'required',
|
||||
'konsumsi_pakan'=> 'required',
|
||||
'vitamin'=> 'required',
|
||||
'kandang' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->withInput()->with('error', 'Unexpected error, please try again. code: ' . $validator->errors()->first());
|
||||
}
|
||||
|
||||
$input = $request->all();
|
||||
|
||||
$post = new Alternatif([
|
||||
'id_alternatif' => $input['id_alternatif'], // Membersihkan input
|
||||
'nama_alternatif' => $input['nama_alternatif'], // Membersihkan input
|
||||
'usia_ayam'=> $input['usia_ayam'],
|
||||
'berat'=> $input['berat'],
|
||||
'konsumsi_pakan'=> $input['konsumsi_pakan'],
|
||||
'vitamin'=> $input['vitamin'],
|
||||
'kandang' => $input['kandang'],
|
||||
]);
|
||||
|
||||
$check = Alternatif::where('id_alternatif', $input['id_alternatif'])->count();
|
||||
if ($check == 0) {
|
||||
if ($post->save()) {
|
||||
return redirect()->route('alternatif')->with('success', 'You have successfully added data');
|
||||
} else {
|
||||
return redirect()->route('alternatif')->with('error', 'An error occurred in the query');
|
||||
}
|
||||
} else {
|
||||
return redirect()->route('alternatif')->with('error', 'Title already exists');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Edit: ' . Alternatif::where('id_alternatif', $id)->first()->title,
|
||||
];
|
||||
$alternatif = Alternatif::FindOrFail($id);
|
||||
|
||||
return view('admin.app.content.alternatif.edit', compact('data', 'alternatif', 'id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
// Validasi input sebelum memperbarui data
|
||||
$validator = Validator::make($request->all(), [
|
||||
'id_alternatif' => 'required',
|
||||
'nama_alternatif' => 'required',
|
||||
'usia_ayam'=> 'required',
|
||||
'berat'=> 'required',
|
||||
'konsumsi_pakan'=> 'required',
|
||||
'vitamin'=> 'required',
|
||||
'kandang' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->withInput()->with('error', 'Unexpected error, please try again. code: ' . $validator->errors()->first());
|
||||
}
|
||||
|
||||
// Cari data berdasarkan ID
|
||||
$alternatif = Alternatif::find($id);
|
||||
|
||||
// Jika data ditemukan
|
||||
if ($alternatif) {
|
||||
|
||||
// Update data dengan data baru dari form yang telah dibersihkan
|
||||
$alternatif->id_alternatif = $request->input('id_alternatif');
|
||||
$alternatif->nama_alternatif = $request->input('nama_alternatif');
|
||||
$alternatif->usia_ayam = $request->input('usia_ayam');
|
||||
$alternatif->berat = $request->input('berat');
|
||||
$alternatif->konsumsi_pakan = $request->input('konsumsi_pakan');
|
||||
$alternatif->vitamin = $request->input('vitamin');
|
||||
$alternatif->kandang = $request->input('kandang');
|
||||
// Simpan perubahan pada database
|
||||
$alternatif->save();
|
||||
return redirect()->route('alternatif')->with('success', 'You are successfully added new records');
|
||||
} else {
|
||||
return redirect()->route('alternatif')->with('error', 'Unexpected error');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
// Cari data berdasarkan ID
|
||||
$alternatif = Alternatif::find($id);
|
||||
// Jika data ditemukan
|
||||
if ($alternatif) {
|
||||
// Hapus data dari database
|
||||
$alternatif->delete();
|
||||
return redirect()->route('alternatif')->with('success', 'You are successfully deleted records');
|
||||
} else {
|
||||
return redirect()->route('alternatif')->with('error', 'Data not found');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,320 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use DataTables;
|
||||
use GuzzleHttp\Client;
|
||||
use Carbon\Carbon;
|
||||
|
||||
use App\Models\Kriteria;
|
||||
use App\Models\Alternatif;
|
||||
use App\Models\AnalisaAlternatif;
|
||||
use App\Models\AnalisaKriteria;
|
||||
use App\Models\Nilai;
|
||||
use App\Models\{BobotKriteria,BobotAlternatif,NilaiRandom};
|
||||
|
||||
class AnalisaController extends Controller
|
||||
{
|
||||
public function alternatif(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'kriteria' => 'required'
|
||||
]);
|
||||
|
||||
if($validator->fails())
|
||||
{
|
||||
return redirect()->back()->with('error', 'Kriteria tidak boleh kosong');
|
||||
}
|
||||
|
||||
$data = [
|
||||
'subtitle' => 'Analisa Alternatif',
|
||||
];
|
||||
|
||||
$id_kriteria = $request->input('kriteria');
|
||||
|
||||
if($request->input('delete'))
|
||||
{
|
||||
return $this->deleteAnalisaAlternatif($id_kriteria);
|
||||
} else {
|
||||
return view('admin.app.content.analisa.alternatif', compact('data', 'id_kriteria'));
|
||||
}
|
||||
}
|
||||
|
||||
public function kriteria()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Analisa Kriteria',
|
||||
];
|
||||
|
||||
return view('admin.app.content.analisa.kriteria', compact('data'));
|
||||
}
|
||||
|
||||
public function kriteriaTabel(Request $request)
|
||||
{
|
||||
if($request->isMethod('post')) {
|
||||
// Jumlah Kriteria
|
||||
$n = Kriteria::count();
|
||||
|
||||
$matrik = array();
|
||||
$urut = 0;
|
||||
|
||||
// Memetakan nilai dalam bentuk matrik
|
||||
// x = baris
|
||||
// y = kolom
|
||||
for ($x = 0; $x <= ($n - 2); $x++) {
|
||||
for ($y = ($x + 1); $y <= ($n - 1); $y++) {
|
||||
$urut++;
|
||||
$pilih = "pilih" . $urut;
|
||||
$bobot = "bobot" . $urut;
|
||||
|
||||
// memilih input radio button yang dipilih apakah yang kiri atau kanan
|
||||
// jika kiri maka otomatis nilai matrix 1 dibagi bobot nilai tersebut dengan format x dan y
|
||||
if ($request->input($pilih) == 1) {
|
||||
$matrik[$x][$y] = $request->input($bobot);
|
||||
$matrik[$y][$x] = 1 / $request->input($bobot);
|
||||
} else {
|
||||
$matrik[$x][$y] = 1 / $request->input($bobot);
|
||||
$matrik[$y][$x] = $request->input($bobot);
|
||||
}
|
||||
|
||||
$id_kriteria1 = getKriteriaId($x);
|
||||
$id_kriteria2 = getKriteriaId($y);
|
||||
|
||||
$jumlahPerbandingan = AnalisaKriteria::where('kriteria_pertama', $id_kriteria1)->where('kriteria_kedua', $id_kriteria2)->count();
|
||||
if ($jumlahPerbandingan == 0) {
|
||||
$insert = new AnalisaKriteria([
|
||||
'kriteria_pertama' => $id_kriteria1,
|
||||
'kriteria_kedua' => $id_kriteria2,
|
||||
'nilai_analisa_kriteria' => $matrik[$x][$y]
|
||||
]);
|
||||
$insert->save();
|
||||
} else {
|
||||
$nilaiMatrixKriteria = $matrik[$x][$y];
|
||||
$update = DB::statement("UPDATE tbl_analisa_kriteria SET nilai_analisa_kriteria = '$nilaiMatrixKriteria' WHERE kriteria_pertama = '$id_kriteria1' AND kriteria_kedua = '$id_kriteria2'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Diagonal -> bernilai 1
|
||||
for ($i = 0; $i <= ($n - 1); $i++) {
|
||||
$matrik[$i][$i] = 1;
|
||||
}
|
||||
|
||||
// Inisialisasi jumlah tiap kolom dan baris kriteria
|
||||
$jmlmpb = array();
|
||||
$jmlmnk = array();
|
||||
for ($i = 0; $i <= ($n - 1); $i++) {
|
||||
$jmlmpb[$i] = 0;
|
||||
$jmlmnk[$i] = 0;
|
||||
}
|
||||
|
||||
// Menghitung jumlah pada kolom kriteria tabel perbandingan berpasangan
|
||||
for ($x = 0; $x <= ($n - 1); $x++) {
|
||||
for ($y = 0; $y <= ($n - 1); $y++) {
|
||||
$value = $matrik[$x][$y];
|
||||
$jmlmpb[$y] += $value;
|
||||
}
|
||||
}
|
||||
|
||||
// Menghitung jumlah pada baris kriteria tabel nilai kriteria
|
||||
// Matrikb merupakan matrik yang telah dinormalisasi
|
||||
for ($x = 0; $x <= ($n - 1); $x++) {
|
||||
for ($y = 0; $y <= ($n - 1); $y++) {
|
||||
$matrikb[$x][$y] = $matrik[$x][$y] / $jmlmpb[$y];
|
||||
$value = $matrikb[$x][$y];
|
||||
$jmlmnk[$x] += $value;
|
||||
}
|
||||
|
||||
// Nilai Priority Vektor
|
||||
$pv[$x] = $jmlmnk[$x] / $n;
|
||||
|
||||
// Memasukan nilai priority vektor ke dalam tabel tb_pv_kriteria
|
||||
$id_kriteria = getKriteriaId($x);
|
||||
$jumlahPV = BobotKriteria::where('id_kriteria', $id_kriteria)->count();
|
||||
if ($jumlahPV == 0) {
|
||||
$insert = new BobotKriteria([
|
||||
'id_kriteria' => $id_kriteria,
|
||||
'nilai' => $pv[$x]
|
||||
]);
|
||||
$insert->save();
|
||||
} else {
|
||||
$nilaiPV = $pv[$x];
|
||||
$update = DB::statement("UPDATE tb_bobot_alternatif SET nilai = '$nilaiPV' WHERE id_kriteria = '$id_kriteria'");
|
||||
}
|
||||
}
|
||||
|
||||
$eigenVektor = getEigenVector($jmlmpb, $jmlmnk, $n);
|
||||
$consIndex = getConsIndex($jmlmpb, $jmlmnk, $n);
|
||||
$consRatio = getConsRatio($jmlmpb, $jmlmnk, $n);
|
||||
|
||||
$data['n'] = $n;
|
||||
$data['matrik'] = $matrik;
|
||||
$data['jmlmpb'] = $jmlmpb;
|
||||
$data['jmlmnk'] = $jmlmnk;
|
||||
$data['matrikb'] = $matrikb;
|
||||
$data['pv'] = $pv;
|
||||
$data['eigenVektor'] = $eigenVektor;
|
||||
$data['consIndex'] = $consIndex;
|
||||
$data['consRatio'] = $consRatio;
|
||||
}
|
||||
|
||||
$data['subtitle'] = 'Analisa Kriteria Tabel';
|
||||
|
||||
return view('admin.app.content.analisa.kriteria-tabel', compact('data'));
|
||||
}
|
||||
|
||||
public function deleteKriteria($id_kriteria)
|
||||
{
|
||||
if(AnalisaKriteria::delete() && BobotKriteria::delete()) {
|
||||
return redirect()->to(app_url('analisa-kriteria'))->with('success', 'Data kriteria berhasil di hapus');
|
||||
} else {
|
||||
return redirect()->back()->with('error', 'Data alternatif tidak ditemukan');
|
||||
}
|
||||
}
|
||||
|
||||
public function alternatifForm()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Alternatif Form'
|
||||
];
|
||||
|
||||
return view('admin.app.content.analisa.alternatif-form', compact('data'));
|
||||
}
|
||||
|
||||
public function alternatifTabel(Request $request, $id_kriteria)
|
||||
{
|
||||
if($request->isMethod('post')) {
|
||||
// Jumlah Alternatif
|
||||
$n = Alternatif::count();
|
||||
|
||||
$matrik = array();
|
||||
$urut = 0;
|
||||
|
||||
// Memetakan nilai dalam bentuk matrik
|
||||
// x = baris
|
||||
// y = kolom
|
||||
for ($x = 0; $x <= ($n - 2); $x++) {
|
||||
for ($y = ($x + 1); $y <= ($n - 1); $y++) {
|
||||
$urut++;
|
||||
$pilih = "pilih" . $urut;
|
||||
$bobot = "bobot" . $urut;
|
||||
|
||||
// Ambil nilai bobot dari request, jika tidak ada, set nilai default 0
|
||||
$nilaiBobot = $request->input($bobot) ?? 0;
|
||||
|
||||
// memilih input radio button yang dipilih apakah yang kiri atau kanan
|
||||
// jika kiri maka otomatis nilai matrix 1 dibagi bobot nilai tersebut dengan format x dan y
|
||||
if ($request->input($pilih) == 1) {
|
||||
$matrik[$x][$y] = $nilaiBobot;
|
||||
$matrik[$y][$x] = $nilaiBobot != 0 ? 1 / $nilaiBobot : 0;
|
||||
} else {
|
||||
$matrik[$x][$y] = $nilaiBobot != 0 ? 1 / $nilaiBobot : 0;
|
||||
$matrik[$y][$x] = $nilaiBobot;
|
||||
}
|
||||
$id_alternatif1 = getAlternatifId($x);
|
||||
$id_alternatif2 = getAlternatifId($y);
|
||||
|
||||
$jumlahPerbandingan = AnalisaAlternatif::where('alternatif_pertama', $id_alternatif1)->where('alternatif_kedua', $id_alternatif2)->where('id_kriteria', $id_kriteria)->count();
|
||||
if ($jumlahPerbandingan == 0) {
|
||||
$insert = new AnalisaAlternatif([
|
||||
'alternatif_pertama' => $id_alternatif1,
|
||||
'alternatif_kedua' => $id_alternatif2,
|
||||
'id_kriteria' => $id_kriteria,
|
||||
'nilai_analisa_alternatif' => $matrik[$x][$y]
|
||||
]);
|
||||
$insert->save();
|
||||
} else {
|
||||
$nilaiMatrixAlternatif = $matrik[$x][$y];
|
||||
$update = DB::statement("UPDATE tbl_analisa_alternatif SET nilai_analisa_alternatif = '$nilaiMatrixAlternatif' WHERE id_kriteria = '$id_kriteria' AND alternatif_pertama = '$id_alternatif1' AND alternatif_kedua = '$id_alternatif2'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Diagonal -> bernilai 1
|
||||
for ($i = 0; $i <= ($n - 1); $i++) {
|
||||
$matrik[$i][$i] = 1;
|
||||
}
|
||||
|
||||
// Inisialisasi jumlah tiap kolom dan baris kriteria
|
||||
$jmlmpb = array();
|
||||
$jmlmnk = array();
|
||||
for ($i = 0; $i <= ($n - 1); $i++) {
|
||||
$jmlmpb[$i] = 0;
|
||||
$jmlmnk[$i] = 0;
|
||||
}
|
||||
|
||||
// Menghitung jumlah pada kolom kriteria tabel perbandingan berpasangan
|
||||
for ($x = 0; $x <= ($n - 1); $x++) {
|
||||
for ($y = 0; $y <= ($n - 1); $y++) {
|
||||
$value = $matrik[$x][$y];
|
||||
$jmlmpb[$y] += $value;
|
||||
}
|
||||
}
|
||||
|
||||
// Menghitung jumlah pada baris kriteria tabel nilai kriteria
|
||||
// Matrikb merupakan matrik yang telah dinormalisasi
|
||||
for ($x = 0; $x <= ($n - 1); $x++) {
|
||||
for ($y = 0; $y <= ($n - 1); $y++) {
|
||||
$matrikb[$x][$y] = $matrik[$x][$y] / $jmlmpb[$y];
|
||||
$value = $matrikb[$x][$y];
|
||||
$jmlmnk[$x] += $value;
|
||||
}
|
||||
|
||||
// Nilai Priority Vektor
|
||||
$pv[$x] = $jmlmnk[$x] / $n;
|
||||
|
||||
// Memasukan nilai priority vektor ke dalam tabel tb_pv_kriteria
|
||||
$id_alternatif = getAlternatifId($x);
|
||||
$jumlahPV = BobotAlternatif::where('id_kriteria', $id_kriteria)->where('id_alternatif', $id_alternatif)->count();
|
||||
|
||||
if ($jumlahPV == 0) {
|
||||
$insert = new BobotAlternatif([
|
||||
'id_alternatif' => $id_alternatif,
|
||||
'id_kriteria' => $id_kriteria,
|
||||
'nilai' => $pv[$x]
|
||||
]);
|
||||
$insert->save();
|
||||
} else {
|
||||
$nilaiPV = $pv[$x];
|
||||
$update = DB::statement("UPDATE tb_bobot_alternatif SET nilai = '$nilaiPV' WHERE id_kriteria = '$id_kriteria' AND id_alternatif = '$id_alternatif'");
|
||||
}
|
||||
}
|
||||
|
||||
$eigenVektor = getEigenVector($jmlmpb, $jmlmnk, $n);
|
||||
$consIndex = getConsIndex($jmlmpb, $jmlmnk, $n);
|
||||
$consRatio = getConsRatio($jmlmpb, $jmlmnk, $n);
|
||||
|
||||
$data['n'] = $n;
|
||||
$data['matrik'] = $matrik;
|
||||
$data['jmlmpb'] = $jmlmpb;
|
||||
$data['jmlmnk'] = $jmlmnk;
|
||||
$data['matrikb'] = $matrikb;
|
||||
$data['pv'] = $pv;
|
||||
$data['eigenVektor'] = $eigenVektor;
|
||||
$data['consIndex'] = $consIndex;
|
||||
$data['consRatio'] = $consRatio;
|
||||
}
|
||||
|
||||
$data['subtitle'] = 'Analisa Alternatif Tabel';
|
||||
|
||||
return view('admin.app.content.analisa.alternatif-tabel', compact('data'));
|
||||
}
|
||||
|
||||
public function deleteAnalisaAlternatif($id_kriteria)
|
||||
{
|
||||
$data_alternatif = AnalisaAlternatif::where('id_kriteria', $id_kriteria);
|
||||
$bobot_alternatif = BobotAlternatif::where('id_kriteria', $id_kriteria);
|
||||
if($data_alternatif->delete() && $bobot_alternatif->delete()) {
|
||||
return redirect()->to(app_url('analisa-alternatif-form'))->with('success', 'Data alternatif berhasil di hapus');
|
||||
} else {
|
||||
return redirect()->back()->with('error', 'Data alternatif tidak ditemukan');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use DataTables;
|
||||
|
||||
use App\Enums\GlobalEnum as Status;
|
||||
use App\Models\User;
|
||||
use App\Models\LogActivites;
|
||||
|
||||
use App\Models\Alternatif;
|
||||
use App\Models\Kriteria;
|
||||
use App\Models\{AnalisaKriteria, AnalisaAlternatif, BobotKriteria, BobotAlternatif, Ranking};
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Halaman Utama',
|
||||
];
|
||||
|
||||
$alternatif = Alternatif::count();
|
||||
$kriteria = Kriteria::count();
|
||||
|
||||
return view('admin.app.dashboard.index', compact('data', 'alternatif', 'kriteria'));
|
||||
}
|
||||
|
||||
public function profile()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Akun anda',
|
||||
];
|
||||
|
||||
return view('admin.app.users.setting', compact('data'));
|
||||
}
|
||||
|
||||
public function reset_datasets()
|
||||
{
|
||||
$analisaAlternatif = AnalisaAlternatif::truncate();
|
||||
$analisaKriteria = AnalisaKriteria::truncate();
|
||||
$bobotAlternatif = BobotAlternatif::truncate();
|
||||
$ranking = Ranking::truncate();
|
||||
|
||||
if($analisaAlternatif && $analisaKriteria && $bobotAlternatif && $ranking)
|
||||
{
|
||||
return redirect()->back()->with('success', 'Data berhasil direset ulang');
|
||||
} else {
|
||||
return redirect()->back()->with('error', 'Data gagal direset ulang');
|
||||
}
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
$id = user()->id;
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required',
|
||||
'email' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->with('error', 'terdapat data yang belum diisi')->withInput();
|
||||
}
|
||||
|
||||
$input = $request->all();
|
||||
$findUser = User::find($id);
|
||||
|
||||
if($findUser) {
|
||||
// update data
|
||||
$findUser->name = $input['name'];
|
||||
$findUser->email = $input['email'];
|
||||
if(!empty($input['password'])) {
|
||||
$findUser->password = bcrypt($input['password']);
|
||||
}
|
||||
|
||||
// save data
|
||||
$findUser->save();
|
||||
return redirect()->back()->with('success', 'Data berhasil disimpan');
|
||||
} else {
|
||||
return redirect()->back()->with('error', 'Tidak ditemukan data!');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,131 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use DataTables;
|
||||
use GuzzleHttp\Client;
|
||||
use Carbon\Carbon;
|
||||
|
||||
use App\Models\Kriteria;
|
||||
use App\Models\Alternatif;
|
||||
use App\Models\AnalisaAlternatif;
|
||||
use App\Models\AnalisaKriteria;
|
||||
use App\Models\Nilai;
|
||||
|
||||
class AnalisaController extends Controller
|
||||
{
|
||||
public function alternatif()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Analisa Alternatif',
|
||||
];
|
||||
|
||||
return view('admin.app.content.analisa.alternatif', compact('data'));
|
||||
}
|
||||
|
||||
public function kriteria()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Analisa Kriteria',
|
||||
];
|
||||
|
||||
return view('admin.app.content.analisa.kriteria', compact('data'));
|
||||
}
|
||||
|
||||
public function kriteriaTabel(Request $request)
|
||||
{
|
||||
if($request->isMethod('post')) {
|
||||
insertBobot($_POST['C11'],$_POST['nl1'],$_POST['C21'])?'':updateBobot($_POST['C11'],$_POST['nl1'],$_POST['C21']);
|
||||
insertBobot($_POST['C12'],$_POST['nl2'],$_POST['C32'])?'':updateBobot($_POST['C12'],$_POST['nl2'],$_POST['C32']);
|
||||
insertBobot($_POST['C13'],$_POST['nl3'],$_POST['C43'])?'':updateBobot($_POST['C13'],$_POST['nl3'],$_POST['C43']);
|
||||
insertBobot($_POST['C14'],$_POST['nl4'],$_POST['C54'])?'':updateBobot($_POST['C14'],$_POST['nl4'],$_POST['C54']);
|
||||
insertBobot($_POST['C25'],$_POST['nl5'],$_POST['C35'])?'':updateBobot($_POST['C25'],$_POST['nl5'],$_POST['C35']);
|
||||
insertBobot($_POST['C26'],$_POST['nl6'],$_POST['C46'])?'':updateBobot($_POST['C26'],$_POST['nl6'],$_POST['C46']);
|
||||
insertBobot($_POST['C27'],$_POST['nl7'],$_POST['C57'])?'':updateBobot($_POST['C27'],$_POST['nl7'],$_POST['C57']);
|
||||
insertBobot($_POST['C38'],$_POST['nl8'],$_POST['C48'])?'':updateBobot($_POST['C38'],$_POST['nl8'],$_POST['C48']);
|
||||
insertBobot($_POST['C39'],$_POST['nl9'],$_POST['C59'])?'':updateBobot($_POST['C39'],$_POST['nl9'],$_POST['C59']);
|
||||
insertBobot($_POST['C410'],$_POST['nl10'],$_POST['C510'])?'':updateBobot($_POST['C410'],$_POST['nl10'],$_POST['C510']);
|
||||
|
||||
insertBobot($_POST['C21'],1/$_POST['nl1'],$_POST['C11'])?'':updateBobot($_POST['C21'],1/$_POST['nl1'],$_POST['C11']);
|
||||
insertBobot($_POST['C32'],1/$_POST['nl2'],$_POST['C12'])?'':updateBobot($_POST['C32'],1/$_POST['nl2'],$_POST['C12']);
|
||||
insertBobot($_POST['C43'],1/$_POST['nl3'],$_POST['C13'])?'':updateBobot($_POST['C43'],1/$_POST['nl3'],$_POST['C13']);
|
||||
insertBobot($_POST['C54'],1/$_POST['nl4'],$_POST['C14'])?'':updateBobot($_POST['C54'],1/$_POST['nl4'],$_POST['C14']);
|
||||
insertBobot($_POST['C35'],1/$_POST['nl5'],$_POST['C25'])?'':updateBobot($_POST['C35'],1/$_POST['nl5'],$_POST['C25']);
|
||||
insertBobot($_POST['C46'],1/$_POST['nl6'],$_POST['C26'])?'':updateBobot($_POST['C46'],1/$_POST['nl6'],$_POST['C26']);
|
||||
insertBobot($_POST['C57'],1/$_POST['nl7'],$_POST['C27'])?'':updateBobot($_POST['C57'],1/$_POST['nl7'],$_POST['C27']);
|
||||
insertBobot($_POST['C48'],1/$_POST['nl8'],$_POST['C38'])?'':updateBobot($_POST['C48'],1/$_POST['nl8'],$_POST['C38']);
|
||||
insertBobot($_POST['C59'],1/$_POST['nl9'],$_POST['C39'])?'':updateBobot($_POST['C59'],1/$_POST['nl9'],$_POST['C39']);
|
||||
insertBobot($_POST['C510'],1/$_POST['nl10'],$_POST['C410'])?'':updateBobot($_POST['C510'],1/$_POST['nl10'],$_POST['C410']);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'subtitle' => 'Analisa Kriteria Tabel',
|
||||
];
|
||||
|
||||
return view('admin.app.content.analisa.kriteria-tabel', compact('data'));
|
||||
}
|
||||
|
||||
public function deleteKriteria()
|
||||
{
|
||||
$exec = AnalisaKriteria::delete();
|
||||
if($exec) {
|
||||
return redirect()->route('analisa.kriteria')->with('success', 'Data kriteria berhasil di hapus');
|
||||
} else {
|
||||
return redirect()->back()->with('error', 'Data kriteria gagal di hapus');
|
||||
}
|
||||
}
|
||||
|
||||
public function alternatifTabel(Request $request)
|
||||
{
|
||||
$altKriteria = !empty($request->kriteria) ? $request->kriteria : $request->query('kriteria');
|
||||
if(!empty($altKriteria)) {
|
||||
$namaKriteria = Kriteria::where('id_kriteria', $altKriteria)->first()->nama_kriteria;
|
||||
}
|
||||
|
||||
if($request->isMethod('post')) {
|
||||
insert($_POST['A11'],$_POST['nl1'],$_POST['A21'],$altKriteria)?'':update($_POST['A11'],$_POST['nl1'],$_POST['A21'],$altKriteria);
|
||||
insert($_POST['A12'],$_POST['nl2'],$_POST['A32'],$altKriteria)?'':update($_POST['A12'],$_POST['nl2'],$_POST['A32'],$altKriteria);
|
||||
insert($_POST['A13'],$_POST['nl3'],$_POST['A43'],$altKriteria)?'':update($_POST['A13'],$_POST['nl3'],$_POST['A43'],$altKriteria);
|
||||
insert($_POST['A14'],$_POST['nl4'],$_POST['A54'],$altKriteria)?'':update($_POST['A14'],$_POST['nl4'],$_POST['A54'],$altKriteria);
|
||||
insert($_POST['A25'],$_POST['nl5'],$_POST['A35'],$altKriteria)?'':update($_POST['A25'],$_POST['nl5'],$_POST['A35'],$altKriteria);
|
||||
insert($_POST['A26'],$_POST['nl6'],$_POST['A46'],$altKriteria)?'':update($_POST['A26'],$_POST['nl6'],$_POST['A46'],$altKriteria);
|
||||
insert($_POST['A27'],$_POST['nl7'],$_POST['A57'],$altKriteria)?'':update($_POST['A27'],$_POST['nl7'],$_POST['A57'],$altKriteria);
|
||||
insert($_POST['A38'],$_POST['nl8'],$_POST['A48'],$altKriteria)?'':update($_POST['A38'],$_POST['nl8'],$_POST['A48'],$altKriteria);
|
||||
insert($_POST['A39'],$_POST['nl9'],$_POST['A59'],$altKriteria)?'':update($_POST['A39'],$_POST['nl9'],$_POST['A59'],$altKriteria);
|
||||
insert($_POST['A410'],$_POST['nl10'],$_POST['A510'],$altKriteria)?'':update($_POST['A410'],$_POST['nl10'],$_POST['A510'],$altKriteria);
|
||||
|
||||
insert($_POST['A21'],1/$_POST['nl1'],$_POST['A11'],$altKriteria)?'':update($_POST['A21'],1/$_POST['nl1'],$_POST['A11'],$altKriteria);
|
||||
insert($_POST['A32'],1/$_POST['nl2'],$_POST['A12'],$altKriteria)?'':update($_POST['A32'],1/$_POST['nl2'],$_POST['A12'],$altKriteria);
|
||||
insert($_POST['A43'],1/$_POST['nl3'],$_POST['A13'],$altKriteria)?'':update($_POST['A43'],1/$_POST['nl3'],$_POST['A13'],$altKriteria);
|
||||
insert($_POST['A54'],1/$_POST['nl4'],$_POST['A14'],$altKriteria)?'':update($_POST['A54'],1/$_POST['nl4'],$_POST['A14'],$altKriteria);
|
||||
insert($_POST['A35'],1/$_POST['nl5'],$_POST['A25'],$altKriteria)?'':update($_POST['A35'],1/$_POST['nl5'],$_POST['A25'],$altKriteria);
|
||||
insert($_POST['A46'],1/$_POST['nl6'],$_POST['A26'],$altKriteria)?'':update($_POST['A46'],1/$_POST['nl6'],$_POST['A26'],$altKriteria);
|
||||
insert($_POST['A57'],1/$_POST['nl7'],$_POST['A27'],$altKriteria)?'':update($_POST['A57'],1/$_POST['nl7'],$_POST['A27'],$altKriteria);
|
||||
insert($_POST['A48'],1/$_POST['nl8'],$_POST['A38'],$altKriteria)?'':update($_POST['A48'],1/$_POST['nl8'],$_POST['A38'],$altKriteria);
|
||||
insert($_POST['A59'],1/$_POST['nl9'],$_POST['A39'],$altKriteria)?'':update($_POST['A59'],1/$_POST['nl9'],$_POST['A39'],$altKriteria);
|
||||
insert($_POST['A510'],1/$_POST['nl10'],$_POST['A410'],$altKriteria)?'':update($_POST['A510'],1/$_POST['nl10'],$_POST['A410'],$altKriteria);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'subtitle' => 'Analisa Alternatif Tabel',
|
||||
];
|
||||
|
||||
return view('admin.app.content.analisa.alternatif-tabel', compact('data', 'altKriteria', 'namaKriteria'));
|
||||
}
|
||||
|
||||
public function deleteAlternatif()
|
||||
{
|
||||
$exec = AnalisaAlternatif::delete();
|
||||
if($exec) {
|
||||
return redirect()->route('analisa.alternatif')->with('success', 'Data alternatif berhasil di hapus');
|
||||
} else {
|
||||
return redirect()->back()->with('error', 'Data alternatif gagal di hapus');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,146 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
// other module binding
|
||||
use App\Enums\GlobalEnum as Status;
|
||||
|
||||
// model binding
|
||||
use Modules\User\Entities\OrderModel as Order;
|
||||
use Modules\User\Entities\ReviewModel as Reviews;
|
||||
use Modules\Seller\Entities\SitesModel as Sites;
|
||||
use Modules\Seller\Entities\AccountModel as Account;
|
||||
use App\Models\Content;
|
||||
use App\Models\Pages;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Platform Jual-Beli Backlink dan Content Writer'
|
||||
];
|
||||
|
||||
// additional binding items
|
||||
$getAllReview = Order::where('is_status', Status::isOrderCompleted)->select('id', 'buy_id', 'sell_id', 'last_buyer_message')->get();
|
||||
$getAllPost = Content::where('is_status', Status::isPostPublished)->select('*')->get();
|
||||
|
||||
return view('landing.index', compact('data', 'getAllReview', 'getAllPost'));
|
||||
}
|
||||
|
||||
public function closeGuide()
|
||||
{
|
||||
if(user()->is_close_guide != null)
|
||||
{
|
||||
$account = new Account();
|
||||
$account->is_close_guide = 1;
|
||||
$account->save();
|
||||
echo 'sudah update';
|
||||
}
|
||||
}
|
||||
|
||||
public function howToSell()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Jual Backlink dan Layanan Konten'
|
||||
];
|
||||
|
||||
return view('landing.market.sell', compact('data'));
|
||||
}
|
||||
|
||||
public function market()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Beli Backlink maupun Situs'
|
||||
];
|
||||
|
||||
return view('landing.market.listing', compact('data'));
|
||||
}
|
||||
|
||||
public function productDetail($uuid)
|
||||
{
|
||||
$sites = Sites::find($uuid);
|
||||
|
||||
if($sites) {
|
||||
$data = [
|
||||
'subtitle' => 'Tentang Situs ' . removeUrlPrefix($sites->url)
|
||||
];
|
||||
|
||||
$getAllReviews = Reviews::where('website_id', $sites->id)->where('review', '!=', 'Auto rated by system')->orderBy('created_at', 'desc')->limit(5)->get();
|
||||
|
||||
return view('landing.market.detail', compact('data', 'sites', 'getAllReviews'));
|
||||
} else {
|
||||
return redirect()->route('marketplace')->with('swal', swal_alert('error', 'Tidak ditemukan data produk...'));
|
||||
}
|
||||
}
|
||||
|
||||
public function userDetail($uuid)
|
||||
{
|
||||
$users = Sites::find($uuid);
|
||||
|
||||
if($users) {
|
||||
$data = [
|
||||
'subtitle' => 'Tentang ' . $users->name
|
||||
];
|
||||
|
||||
return view('landing.market.detailUser', compact('data', 'users'));
|
||||
} else {
|
||||
return redirect()->route('marketplace')->with('swal', swal_alert('error', 'Tidak ditemukan data produk...'));
|
||||
}
|
||||
}
|
||||
|
||||
public function pages($slug)
|
||||
{
|
||||
$pages = Pages::where('slug', $slug)->first();
|
||||
|
||||
if($pages) {
|
||||
$data = [
|
||||
'subtitle' => $pages->title
|
||||
];
|
||||
|
||||
return view('landing.pages.detail', compact('data', 'pages'));
|
||||
} else {
|
||||
return redirect()->route('landing')->with('swal', swal_alert('error', 'Tidak ditemukan laman...'));
|
||||
}
|
||||
}
|
||||
|
||||
public function about()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Tentang Kami'
|
||||
];
|
||||
|
||||
return view('landing.about', compact('data'));
|
||||
}
|
||||
|
||||
public function blog()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Informasi'
|
||||
];
|
||||
|
||||
return view('landing.blog.index', compact('data'));
|
||||
}
|
||||
|
||||
public function blogDetail($slug)
|
||||
{
|
||||
$blog = Content::where('slug', $slug)->first();
|
||||
|
||||
if($blog) {
|
||||
$data = [
|
||||
'subtitle' => 'Detil Informasi'
|
||||
];
|
||||
|
||||
return view('landing.blog.detail', compact('data', 'blog'));
|
||||
} else {
|
||||
return redirect()->route('landing')->with('swal', swal_alert('error', 'Tidak ditemukan laman...'));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,172 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use DataTables;
|
||||
use GuzzleHttp\Client;
|
||||
use Carbon\Carbon;
|
||||
|
||||
use App\Models\Kriteria;
|
||||
use App\Models\Nilai;
|
||||
|
||||
class KriteriaController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
$data = Kriteria::select('*');
|
||||
// Convert the Eloquent Collection to a regular PHP array
|
||||
$data->each(function ($item, $key) {
|
||||
$item->rowIndex = $key + 1;
|
||||
});
|
||||
|
||||
return Datatables::of($data)
|
||||
->addIndexColumn()
|
||||
->addColumn('title-post', function($row){
|
||||
$text = '
|
||||
<p class="mb-0">' . $row->kriteria . '</p>
|
||||
';
|
||||
return $text;
|
||||
})
|
||||
->rawColumns(['title-post'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'subtitle' => 'Kriteria',
|
||||
'button' => true,
|
||||
'module' => [
|
||||
'url' => route('kriteria.create'),
|
||||
'name' => 'Tambah Baru'
|
||||
]
|
||||
];
|
||||
|
||||
return view('admin.app.content.kriteria.index', compact('data'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Tambah baru',
|
||||
];
|
||||
|
||||
$bobot = Nilai::all();
|
||||
return view('admin.app.content.kriteria.add', compact('data', 'bobot'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'id_kriteria' => 'required',
|
||||
'nama_kriteria' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->withInput()->with('error', 'Terjadi kesalahan, silakan coba lagi. Code: ' . $validator->errors()->first());
|
||||
}
|
||||
|
||||
$input = $request->all();
|
||||
|
||||
$post = new Kriteria([
|
||||
'id_kriteria' => $input['id_kriteria'], // Membersihkan input judul menggunakan Purifier
|
||||
'nama_kriteria' => $input['nama_kriteria'], // Membersihkan input deskripsi menggunakan Purifier
|
||||
]);
|
||||
|
||||
$check = Kriteria::where('nama_kriteria', $input['nama_kriteria'])->count();
|
||||
if ($check == 0) {
|
||||
if ($post->save()) {
|
||||
return redirect()->route('kriteria')->with('success', 'Berhasil tambah data kriteria');
|
||||
} else {
|
||||
return redirect()->route('kriteria')->with('error', 'Terjadi kesalahan dalam query.');
|
||||
}
|
||||
} else {
|
||||
return redirect()->route('kriteria')->with('error', 'Data sudah ada');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Edit: ' . Kriteria::where('id_kriteria', $id)->first()->title,
|
||||
];
|
||||
|
||||
$kriteria = Kriteria::FindOrFail($id);
|
||||
$bobot = Nilai::all();
|
||||
|
||||
return view('admin.app.content.kriteria.edit', compact('data','kriteria', 'id', 'bobot'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
// Validasi input sebelum memperbarui data
|
||||
$validator = Validator::make($request->all(), [
|
||||
'id_kriteria' => 'required',
|
||||
'nama_kriteria' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->withInput()->with('error', 'Unexpected error, please try again. code: ' . $validator->errors()->first());
|
||||
}
|
||||
|
||||
// Cari data berdasarkan ID
|
||||
$kriteria = Kriteria::find($id);
|
||||
|
||||
// Jika data ditemukan
|
||||
if ($kriteria) {
|
||||
|
||||
// Update data dengan data baru dari form yang telah dibersihkan
|
||||
$kriteria->id_kriteria = $request->input('id_kriteria');
|
||||
$kriteria->nama_kriteria = $request->input('nama_kriteria');
|
||||
// Simpan perubahan pada database
|
||||
$kriteria->save();
|
||||
return redirect()->route('kriteria')->with('success', 'You are successfully added new records');
|
||||
} else {
|
||||
return redirect()->route('kriteria')->with('error', 'Unexpected error');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
// Cari data berdasarkan ID
|
||||
$kriteria = Kriteria::find($id);
|
||||
// Jika data ditemukan
|
||||
if ($kriteria) {
|
||||
// Hapus data dari database
|
||||
$kriteria->delete();
|
||||
return redirect()->route('kriteria')->with('success', 'Data kriteria berhasil dihapus');
|
||||
} else {
|
||||
return redirect()->route('kriteria')->with('error', 'Data kriteria gagal dihapus');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,258 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
// additional modules
|
||||
use App\Helpers\MailerHelper as Mailers;
|
||||
use App\Enums\GlobalEnum;
|
||||
use App\Models\User;
|
||||
use App\Models\UserManager;
|
||||
use App\Models\LogActivites;
|
||||
|
||||
use Ramsey\Uuid\Uuid;
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$data = [
|
||||
'title' => 'CMSQ',
|
||||
'subtitle' => 'Login',
|
||||
];
|
||||
|
||||
return view('auth/login', compact('data'));
|
||||
}
|
||||
|
||||
public function proses_login(Request $request)
|
||||
{
|
||||
$credentials = $request->validate([
|
||||
'email' => ['required','email'],
|
||||
'password' => ['required'],
|
||||
]);
|
||||
|
||||
if (Auth::attempt($credentials)) {
|
||||
$user = Auth::user();
|
||||
switch($user->level) {
|
||||
case 1:
|
||||
LogActivites::default([
|
||||
'causedBy' => $user->id,
|
||||
'logType' => GlobalEnum::LogOfLogin,
|
||||
'withContent' => [
|
||||
'status' => 'add',
|
||||
'text' => 'Login as ' . $user->name,
|
||||
'ip_address' => $request->ip(),
|
||||
'user_agent' => $request->userAgent(),
|
||||
'time' => date('Y-m-d H:i:s')
|
||||
]
|
||||
]);
|
||||
return redirect()->intended('app/dashboard');
|
||||
break;
|
||||
case 2:
|
||||
LogActivites::default([
|
||||
'causedBy' => $user->id,
|
||||
'logType' => GlobalEnum::LogOfLogin,
|
||||
'withContent' => [
|
||||
'status' => 'add',
|
||||
'text' => 'Login as ' . $user->name,
|
||||
'ip_address' => $request->ip(),
|
||||
'user_agent' => $request->userAgent(),
|
||||
'time' => date('Y-m-d H:i:s')
|
||||
]
|
||||
]);
|
||||
return redirect()->intended('user');
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
return redirect()->back()->withInput()->with('error', 'Email atau Password salah!');
|
||||
}
|
||||
}
|
||||
|
||||
public function logout(Request $request)
|
||||
{
|
||||
$request->session()->flush();
|
||||
Auth::logout();
|
||||
return redirect('/')->with('success', 'Anda berhasil keluar');
|
||||
}
|
||||
|
||||
public function register()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Register',
|
||||
];
|
||||
|
||||
return view('auth/register', compact('data'));
|
||||
}
|
||||
|
||||
public function storeRegister(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required',
|
||||
'email' => 'required|string|email|max:255',
|
||||
'password' => 'required|min:6',
|
||||
'level' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return back()->with('error', 'Terdapat data yang belum diisi')->withInput();
|
||||
}
|
||||
|
||||
$input = $request->all();
|
||||
$userEmailToken = md5(Str::random(25));
|
||||
$user = new User([
|
||||
'name' => $input['name'],
|
||||
'username' => Str::before($input['email'], '@') . rand(100, 999),
|
||||
'email' => $input['email'],
|
||||
'level' => $input['level'],
|
||||
'email_verified_token' => NULL,
|
||||
'password' => bcrypt($input['password']),
|
||||
'status' => 1
|
||||
]);
|
||||
|
||||
$check = User::where('email', $input['email'])->count();
|
||||
if($check == 0) {
|
||||
if($user->save()) {
|
||||
return redirect()->route('login')->with('success', 'Anda berhasil mendaftarkan diri, silahkan masuk');
|
||||
} else {
|
||||
return back()->with('error', 'Terdapat data yang salah')->withInput();
|
||||
}
|
||||
} else {
|
||||
return back()->with('error', 'Data telah ada, Silahkan gunakan email yang lain.')->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
public function verify($token)
|
||||
{
|
||||
$userAccount = User::where('email_verified_token', $token)->first();
|
||||
if($token == null) {
|
||||
return redirect()->route('login')->with('swal', swal_alert('error', 'Token tidak ditemukan!'));
|
||||
} elseif(empty($userAccount) || is_null($userAccount)) {
|
||||
return redirect()->route('login')->with('swal', swal_alert('error', 'Token sudah digunakan!'));
|
||||
} elseif($userAccount->status == 1 || $userAccount->email_verified_at != null) {
|
||||
return redirect()->route('login')->with('swal', swal_alert('error', 'Akun sudah terverifikasi!'));
|
||||
} else {
|
||||
|
||||
// check before update
|
||||
$user = User::find($userAccount->id);
|
||||
$user->email_verified_token = null;
|
||||
$user->email_verified_at = now();
|
||||
$user->status = 1;
|
||||
|
||||
// update
|
||||
$user->save();
|
||||
return redirect()->route('login')->with('swal', swal_alert('success', 'Email telah berhasil diverifikasi, anda dapat menggunakan layanan'));
|
||||
}
|
||||
}
|
||||
|
||||
public function forgot()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Lupa Kata Sandi',
|
||||
];
|
||||
|
||||
return view('auth/forgot_password', compact('data'));
|
||||
}
|
||||
|
||||
public function forgotPassword(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'email' => 'required|string|email|max:255',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->withErrors($validator)->withInput();
|
||||
}
|
||||
|
||||
$input = $request->all();
|
||||
$userEmailToken = md5(Str::random(25));
|
||||
$user = new UserManager([
|
||||
'uuid' => Uuid::uuid4(),
|
||||
'email' => $input['email'],
|
||||
'token' => $userEmailToken,
|
||||
'isUsed' => 0,
|
||||
]);
|
||||
|
||||
$check = User::where('email', $input['email'])->count();
|
||||
$userName = User::where('email', $input['email'])->first()->name;
|
||||
if($check == 1) {
|
||||
$sendEmail = Mailers::to($input['email'], false, 'email.auth.forgot_password', [
|
||||
'message' => 'You have been successfully requested! Please check your email to reset your password',
|
||||
'subject' => 'Forgot Password',
|
||||
'name' => $userName,
|
||||
'token' => $userEmailToken
|
||||
]);
|
||||
if($sendEmail) {
|
||||
$user->save();
|
||||
return redirect()->route('login')->with('swal', swal_alert('success', 'Kamu berhasil mengirim permintaan reset password! Silahkan cek email untuk verifikasi akun anda'));
|
||||
} else {
|
||||
return back()->withErrors([
|
||||
'email' => 'Something went wrong!',
|
||||
])->withInput();
|
||||
}
|
||||
} else {
|
||||
return back()->withErrors([
|
||||
'email' => 'Found valid email exists!',
|
||||
])->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
public function reset($token)
|
||||
{
|
||||
|
||||
$findTokenByUsed = UserManager::where('token', $token)->first();
|
||||
if($findTokenByUsed->isUsed == 1) {
|
||||
return redirect()->route('login')->with('swal', swal_alert('error', 'Token sudah digunakan!'));
|
||||
} elseif(hasExpired($findTokenByUsed->created_at)) {
|
||||
return redirect()->route('login')->with('swal', swal_alert('error', 'Token expired!'));
|
||||
}
|
||||
|
||||
$data = [
|
||||
'subtitle' => 'Reset Password',
|
||||
];
|
||||
|
||||
return view('auth/reset_password', compact('data','token'));
|
||||
}
|
||||
|
||||
public function resetPassword(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'password' => 'required|string|min:8',
|
||||
'retype_password' => 'required|string|min:8',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->withErrors($validator)->withInput();
|
||||
}
|
||||
|
||||
if($request->password != $request->retype_password) {
|
||||
return redirect()->back()->with('swal', swal_alert('error', 'Password tidak sama!'))->withInput();
|
||||
}
|
||||
|
||||
$input = $request->all();
|
||||
$userEmailbyToken = UserManager::where('token', $input['token'])->first();
|
||||
$findUserByEmail = User::where('email', $userEmailbyToken->email)->first();
|
||||
|
||||
// check expired token 60 minutes
|
||||
if(hasExpired($findUserByEmail->created_at)) {
|
||||
return redirect()->route('login')->with('swal', swal_alert('error', 'Token sudah kadaluarsa!'));
|
||||
} else {
|
||||
|
||||
// update password
|
||||
$findUserByEmail->password = bcrypt($input['password']);
|
||||
$findUserByEmail->save();
|
||||
|
||||
// update token
|
||||
$userEmailbyToken->isUsed = 1;
|
||||
$userEmailbyToken->save();
|
||||
|
||||
return redirect()->route('login')->with('swal', swal_alert('success', 'Password telah berhasil diubah'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,169 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use DataTables;
|
||||
use GuzzleHttp\Client;
|
||||
use Carbon\Carbon;
|
||||
|
||||
use App\Models\Nilai;
|
||||
|
||||
class NilaiController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
$data = Nilai::select('*');
|
||||
// Convert the Eloquent Collection to a regular PHP array
|
||||
$data->each(function ($item, $key) {
|
||||
$item->rowIndex = $key + 1;
|
||||
});
|
||||
|
||||
return Datatables::of($data)
|
||||
->addIndexColumn()
|
||||
->addColumn('title-post', function($row){
|
||||
$text = '
|
||||
<p class="mb-0">' . $row->gejala . '</p>
|
||||
';
|
||||
return $text;
|
||||
})
|
||||
->rawColumns(['title-post'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'subtitle' => 'Nilai',
|
||||
'button' => true,
|
||||
'module' => [
|
||||
'url' => route('nilai.create'),
|
||||
'name' => 'Tambah Baru'
|
||||
]
|
||||
];
|
||||
|
||||
return view('admin.app.content.nilai.index', compact('data'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Tambah baru',
|
||||
];
|
||||
|
||||
$bobot = Nilai::all();
|
||||
return view('admin.app.content.nilai.add', compact('data', 'bobot'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'jum_nilai' => 'required',
|
||||
'ket_nilai' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->withInput()->with('error', 'Unexpected error, please try again. code: ' . $validator->errors()->first());
|
||||
}
|
||||
|
||||
$input = $request->all();
|
||||
|
||||
$post = new Nilai([
|
||||
'jum_nilai' => $input['jum_nilai'], // Membersihkan input deskripsi menggunakan Purifier
|
||||
'ket_nilai' => $input['ket_nilai'], // Membersihkan input deskripsi menggunakan Purifier
|
||||
]);
|
||||
|
||||
$check = Nilai::where('ket_nilai', $input['ket_nilai'])->count();
|
||||
if ($check == 0) {
|
||||
if ($post->save()) {
|
||||
return redirect()->route('nilai')->with('success', 'You have successfully added data');
|
||||
} else {
|
||||
return redirect()->route('nilai')->with('error', 'An error occurred in the query');
|
||||
}
|
||||
} else {
|
||||
return redirect()->route('nilai')->with('error', 'Title already exists');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Edit: ' . Nilai::where('id_nilai', $id)->first()->title,
|
||||
];
|
||||
|
||||
$nilai = Nilai::FindOrFail($id);
|
||||
return view('admin.app.content.nilai.edit', compact('data', 'id', 'nilai'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
// Validasi input sebelum memperbarui data
|
||||
$validator = Validator::make($request->all(), [
|
||||
'jum_nilai' => 'required',
|
||||
'ket_nilai' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->withInput()->with('error', 'Unexpected error, please try again. code: ' . $validator->errors()->first());
|
||||
}
|
||||
|
||||
// Cari data berdasarkan ID
|
||||
$nilai = Nilai::find($id);
|
||||
|
||||
// Jika data ditemukan
|
||||
if ($nilai) {
|
||||
|
||||
// Update data dengan data baru dari form yang telah dibersihkan
|
||||
$nilai->jum_nilai = $request->input('jum_nilai');
|
||||
$nilai->ket_nilai = $request->input('ket_nilai');
|
||||
// Simpan perubahan pada database
|
||||
$nilai->save();
|
||||
return redirect()->route('nilai')->with('success', 'You are successfully added new records');
|
||||
} else {
|
||||
return redirect()->route('nilai')->with('error', 'Unexpected error');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
// Cari data berdasarkan ID
|
||||
$post = Nilai::find($id);
|
||||
// Jika data ditemukan
|
||||
if ($post) {
|
||||
// Hapus data dari database
|
||||
$post->delete();
|
||||
return redirect()->route('nilai')->with('success', 'You are successfully deleted records');
|
||||
} else {
|
||||
return redirect()->route('nilai')->with('error', 'Data not found');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
use DataTables;
|
||||
use GuzzleHttp\Client;
|
||||
use Carbon\Carbon;
|
||||
|
||||
use App\Models\Kriteria;
|
||||
use App\Models\Alternatif;
|
||||
use App\Models\AnalisaAlternatif;
|
||||
use App\Models\AnalisaKriteria;
|
||||
use App\Models\Nilai;
|
||||
|
||||
class RankingController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Ranking',
|
||||
];
|
||||
|
||||
return view('admin.app.content.ranking.index', compact('data'));
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$exec = AnalisaAlternatif::delete();
|
||||
if($exec) {
|
||||
return redirect()->route('analisa.alternatif')->with('success', 'Data alternatif berhasil di hapus');
|
||||
} else {
|
||||
return redirect()->back()->with('error', 'Data alternatif gagal di hapus');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use DataTables;
|
||||
use GuzzleHttp\Client;
|
||||
use Carbon\Carbon;
|
||||
|
||||
use App\Models\Riwayat;
|
||||
|
||||
class RiwayatController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
$data = Riwayat::select('*');
|
||||
// Convert the Eloquent Collection to a regular PHP array
|
||||
$data->each(function ($item, $key) {
|
||||
$item->rowIndex = $key + 1;
|
||||
});
|
||||
|
||||
return Datatables::of($data)
|
||||
->addIndexColumn()
|
||||
->addColumn('title-post', function($row){
|
||||
$text = '
|
||||
<p class="mb-0">' . $row->gejala . '</p>
|
||||
';
|
||||
return $text;
|
||||
})
|
||||
->addColumn('jenis_gejala', function($row){
|
||||
return $row->gejala;
|
||||
})
|
||||
->rawColumns(['title-post', 'jenis_gejala'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'subtitle' => 'Riwayat'
|
||||
];
|
||||
|
||||
return view('admin.app.content.riwayat.index', compact('data'));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,176 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use DataTables;
|
||||
use GuzzleHttp\Client;
|
||||
use Carbon\Carbon;
|
||||
|
||||
use App\Models\Penyakit;
|
||||
use App\Models\Gejala;
|
||||
use App\Models\Rule;
|
||||
|
||||
class RuleController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
$data = Rule::select('*');
|
||||
// Convert the Eloquent Collection to a regular PHP array
|
||||
$data->each(function ($item, $key) {
|
||||
$item->rowIndex = $key + 1;
|
||||
});
|
||||
|
||||
return Datatables::of($data)
|
||||
->addIndexColumn()
|
||||
->addColumn('title-post', function($row){
|
||||
$text = '
|
||||
<p class="mb-0">' . $row->kode_rule . '</p>
|
||||
';
|
||||
return $text;
|
||||
})
|
||||
->rawColumns(['title-post'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'subtitle' => 'Rule',
|
||||
'button' => true,
|
||||
'module' => [
|
||||
'url' => route('rule.create'),
|
||||
'name' => 'Tambah Baru'
|
||||
]
|
||||
];
|
||||
|
||||
return view('admin.app.content.rule.index', compact('data'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Tambah baru',
|
||||
];
|
||||
|
||||
$penyakit = Penyakit::all();
|
||||
return view('admin.app.content.rule.add', compact('data', 'penyakit'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'kode_gejala' => 'required',
|
||||
'kode_rule' => 'required',
|
||||
'kode_penyakit' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->withInput()->with('error', 'Unexpected error, please try again. code: ' . $validator->errors()->first());
|
||||
}
|
||||
|
||||
$input = $request->all();
|
||||
|
||||
$post = new Rule([
|
||||
'kode_gejala' => $input['kode_gejala'], // Membersihkan input judul menggunakan Purifier
|
||||
'kode_rule' => $input['kode_rule'], // Membersihkan input deskripsi menggunakan Purifier
|
||||
'kode_penyakit' => $input['kode_penyakit'], // Membersihkan input deskripsi menggunakan Purifier
|
||||
]);
|
||||
|
||||
$check = Rule::where('kode_rule', $input['gejala'])->count();
|
||||
if ($check == 0) {
|
||||
if ($post->save()) {
|
||||
return redirect()->route('rule')->with('success', 'You have successfully added data');
|
||||
} else {
|
||||
return redirect()->route('rule')->with('error', 'An error occurred in the query');
|
||||
}
|
||||
} else {
|
||||
return redirect()->route('rule')->with('error', 'Title already exists');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Edit: ' . Rule::where('id_rule', $id)->first()->title,
|
||||
];
|
||||
$penyakit = Penyakit::all();
|
||||
$rule = Rule::find($id);
|
||||
|
||||
return view('admin.app.content.rule.edit', compact('data', 'id', 'penyakit', 'rule'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
// Validasi input sebelum memperbarui data
|
||||
$validator = Validator::make($request->all(), [
|
||||
'kode_gejala' => 'required',
|
||||
'kode_rule' => 'required',
|
||||
'kode_penyakit' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->withInput()->with('error', 'Unexpected error, please try again. code: ' . $validator->errors()->first());
|
||||
}
|
||||
|
||||
// Cari data berdasarkan ID
|
||||
$gejala = Penyakit::find($id);
|
||||
|
||||
// Jika data ditemukan
|
||||
if ($gejala) {
|
||||
|
||||
// Update data dengan data baru dari form yang telah dibersihkan
|
||||
$gejala->kode_gejala = $request->input('kode_gejala');
|
||||
$gejala->kode_rule = $request->input('kode_rule');
|
||||
$gejala->kode_penyakit = $request->input('kode_penyakit');
|
||||
// Simpan perubahan pada database
|
||||
$gejala->save();
|
||||
return redirect()->route('rule')->with('success', 'You are successfully added new records');
|
||||
} else {
|
||||
return redirect()->route('rule')->with('error', 'Unexpected error');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
// Cari data berdasarkan ID
|
||||
$post = Rule::find($id);
|
||||
// Jika data ditemukan
|
||||
if ($post) {
|
||||
// Hapus data dari database
|
||||
$post->delete();
|
||||
return redirect()->route('rule')->with('success', 'You are successfully deleted records');
|
||||
} else {
|
||||
return redirect()->route('rule')->with('error', 'Data not found');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,202 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\Roles;
|
||||
|
||||
use Modules\Seller\Entities\AccountModel;
|
||||
use App\Enums\GlobalEnum;
|
||||
use App\Models\LogActivites;
|
||||
use App\Models\Seller;
|
||||
|
||||
use DataTables;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class UsersController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
$data = User::select('*')->whereIn('level', [1,2])->orderBy('created_at', 'desc');
|
||||
// Convert the Eloquent Collection to a regular PHP array
|
||||
$data->each(function ($item, $key) {
|
||||
$item->rowIndex = $key + 1;
|
||||
});
|
||||
|
||||
return Datatables::eloquent($data)
|
||||
->addIndexColumn()
|
||||
->addColumn('title-post', function($row) {
|
||||
return '
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="symbol symbol-25px symbol-circle">
|
||||
<div class="symbol-label" style="background-image:url(' . gravatar_team($row->email) . ')"></div>
|
||||
</div>
|
||||
<div class="ms-3"><span>' . $row->name . '</span></div>
|
||||
</div>
|
||||
';
|
||||
})
|
||||
->addColumn('action', function($row){
|
||||
$view = route('users.show', ['id' => $row->id]);
|
||||
$edit = route('users.edit', ['id' => $row->id]);
|
||||
$delete = route('users.delete', ['id' => $row->id]);
|
||||
$btn = '
|
||||
<a href="' . $view . '" class="btn btn-light btn-sm px-4"><i class="ki-outline ki-eye"></i></a>
|
||||
<a href="' . $edit . '" class="btn btn-light btn-sm px-4"><i class="ki-outline ki-pencil"></i></a>
|
||||
<a data-url="' . $delete . '" href="#" class="btn btn-light btn-sm deleteContent px-4"><i class="ki-outline ki-trash"></i></a>
|
||||
';
|
||||
return $btn;
|
||||
})
|
||||
->rawColumns(['title-post','action'])
|
||||
->filter(function ($query) use ($request) {
|
||||
if ($request->has('search')) {
|
||||
$search = $request->get('search')['value'];
|
||||
$query->where('name', 'LIKE', "%$search%")
|
||||
->orWhere('email', 'LIKE', "%$search%");
|
||||
}
|
||||
|
||||
})
|
||||
->make(true);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'subtitle' => 'Users',
|
||||
'button' => true,
|
||||
'module' => [
|
||||
'url' => route('users.create'),
|
||||
'name' => 'Tambah Baru'
|
||||
]
|
||||
];
|
||||
|
||||
return view('admin.app.users.index', compact('data'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => 'Create New'
|
||||
];
|
||||
|
||||
$roles = Roles::whereIn('id', [1,2])->get();
|
||||
return view('admin.app.users.add', compact('data', 'roles'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required',
|
||||
'email' => 'required|email',
|
||||
'level' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->with('error', 'Terdapat input yang belum diisi')->withInput();
|
||||
}
|
||||
|
||||
$input = $request->all();
|
||||
$foto_namaBaru = null;
|
||||
|
||||
if ($request->hasFile('image') && $request->file('image')->isValid()) {
|
||||
$foto_namaBaru = $request->file('image')->store('public/images');
|
||||
}
|
||||
|
||||
$post = new User([
|
||||
'name' => $input['name'],
|
||||
'username' => Str::before($input['email'], '@') . rand(100, 999),
|
||||
'email' => $input['email'],
|
||||
'password' => !empty(bcrypt($input['password'])) ? bcrypt($input['password']) : bcrypt('default123'),
|
||||
'level' => $input['level'],
|
||||
]);
|
||||
|
||||
$check = User::where('email', $input['email'])->count();
|
||||
if ($check == 0) {
|
||||
if ($post->save()) {
|
||||
return redirect()->route('users')->with('success', 'Berhasil menambah akun!');
|
||||
} else {
|
||||
return redirect()->route('users')->with('error', 'Terjadi kesalahan');
|
||||
}
|
||||
} else {
|
||||
return redirect()->route('users')->with('error', 'Data telah ada!');
|
||||
}
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => User::where('id', $id)->first()->email,
|
||||
'records' => User::where('id', $id)->first(),
|
||||
'logs' => User::where('id', $id)->first()
|
||||
];
|
||||
return view('admin.app.users.detail', compact('data'));
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = [
|
||||
'subtitle' => User::where('id', $id)->first()->email,
|
||||
'records' => User::where('id', $id)->first()
|
||||
];
|
||||
|
||||
$roles = Roles::whereIn('id', [1,2])->get();
|
||||
return view('admin.app.users.edit', compact('data', 'id', 'roles'));
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required',
|
||||
'email' => 'required|email',
|
||||
'level' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->back()->with('error', 'Terdapat input yang belum diisi')->withInput();
|
||||
}
|
||||
|
||||
// Cari data berdasarkan ID
|
||||
$user = User::find($id);
|
||||
|
||||
// Jika data ditemukan
|
||||
if ($user) {
|
||||
// Jika ada file baru yang diunggah, hapus file thumbnail yang lama
|
||||
if ($request->hasFile('image') && $request->file('image')->isValid()) {
|
||||
if ($user->thumbnail) {
|
||||
Storage::delete($user->thumbnail);
|
||||
}
|
||||
}
|
||||
|
||||
// Update data dengan data baru dari form yang telah dibersihkan
|
||||
$user->name = $request->input('name');
|
||||
$user->email = $request->input('email');
|
||||
!empty($request->input('password')) ? $user->password = bcrypt($request->input('password')) : $user->password;
|
||||
$user->level = $request->input('level');
|
||||
$user->username = Str::before($user->email, '@') . rand(100, 999);
|
||||
|
||||
// Simpan perubahan pada database
|
||||
$user->save();
|
||||
return redirect()->route('users')->with('success', 'Berhasil diubah!!');
|
||||
} else {
|
||||
return redirect()->route('users')->with('error', 'Terjadi kesalahan');
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$user = User::find($id);
|
||||
// Jika data ditemukan
|
||||
if ($user) {
|
||||
// Hapus data dari database
|
||||
$user->delete();
|
||||
return redirect()->route('users')->with('success', 'Berhasil dihapus akun!');
|
||||
} else {
|
||||
return redirect()->route('users')->with('error', 'Terjadi kesalahan');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http;
|
||||
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
/**
|
||||
* The application's global HTTP middleware stack.
|
||||
*
|
||||
* These middleware are run during every request to your application.
|
||||
*
|
||||
* @var array<int, class-string|string>
|
||||
*/
|
||||
protected $middleware = [
|
||||
// \App\Http\Middleware\TrustHosts::class,
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
\Fruitcake\Cors\HandleCors::class,
|
||||
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||
\App\Http\Middleware\TrimStrings::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware groups.
|
||||
*
|
||||
* @var array<string, array<int, class-string|string>>
|
||||
*/
|
||||
protected $middlewareGroups = [
|
||||
'web' => [
|
||||
\App\Http\Middleware\EncryptCookies::class,
|
||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
// \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||
'throttle:api',
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware.
|
||||
*
|
||||
* These middleware may be assigned to groups or used individually.
|
||||
*
|
||||
* @var array<string, class-string|string>
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||
'check.status' => \App\Http\Middleware\CheckUserStatus::class,
|
||||
'check.admin' => \App\Http\Middleware\CheckAuthenticatedisAdmin::class,
|
||||
'check.seller' => \App\Http\Middleware\CheckSeller::class,
|
||||
'XssSanitization' => \App\Http\Middleware\XssSanitization::class,
|
||||
'check.auth' => \App\Http\Middleware\isAuth::class
|
||||
];
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Modules\User;
|
||||
|
||||
use Livewire\Component;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use App\Models\Content;
|
||||
use App\Models\ContentCategories as Category;
|
||||
use App\Enums\GlobalEnum;
|
||||
use WithPagination;
|
||||
|
||||
class Blog extends Component
|
||||
{
|
||||
public $filterType;
|
||||
public $categoryFilter;
|
||||
public $searchFilter = '';
|
||||
|
||||
public $currentPage = 1;
|
||||
public $perPage = 10;
|
||||
|
||||
public function render(Request $request)
|
||||
{
|
||||
$valueCategory = '';
|
||||
|
||||
if(!empty($request->input('categoryFilter')))
|
||||
{
|
||||
$this->categoryFilter = $request->categoryFilter;
|
||||
|
||||
$valueCategory = $request->categoryFilter;
|
||||
}
|
||||
|
||||
$query = Content::where('is_status', 1);
|
||||
|
||||
if (!empty($this->categoryFilter)) {
|
||||
$query->where('is_category', 'like', '%' . $this->categoryFilter . '%');
|
||||
}
|
||||
|
||||
if (!empty($this->searchFilter)) {
|
||||
$query->where('title', 'like', '%' . $this->searchFilter . '%');
|
||||
}
|
||||
|
||||
$sites = $query->paginate($this->perPage)->appends([
|
||||
'categoryFilter' => $this->categoryFilter,
|
||||
]);
|
||||
|
||||
$elements = $sites->links()->elements;
|
||||
$searchCount = $sites->total();
|
||||
$getListCategory = Category::select('*');
|
||||
|
||||
return view('livewire.modules.user.blog',
|
||||
compact('sites', 'elements', 'searchCount', 'getListCategory', 'valueCategory')
|
||||
);
|
||||
}
|
||||
|
||||
public function previousPage()
|
||||
{
|
||||
if ($this->currentPage > 1) {
|
||||
$this->currentPage--;
|
||||
}
|
||||
}
|
||||
|
||||
public function nextPage()
|
||||
{
|
||||
$this->currentPage++;
|
||||
}
|
||||
|
||||
public function goToPage($page)
|
||||
{
|
||||
$url = route('user.sites.view', ['id' => $page]);
|
||||
return redirect()->to($url);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Modules\User;
|
||||
|
||||
use Livewire\Component;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use Modules\Seller\Entities\DomainModel as Domains;
|
||||
use Modules\User\Entities\CartModel as Carts;
|
||||
|
||||
use App\Enums\GlobalEnum;
|
||||
use WithPagination;
|
||||
|
||||
class Domain extends Component
|
||||
{
|
||||
public $searchFilter = '';
|
||||
public $minimumPrice;
|
||||
public $maximumPrice;
|
||||
|
||||
public $currentPage = 1;
|
||||
public $perPage = 10;
|
||||
|
||||
public function render(Request $request)
|
||||
{
|
||||
|
||||
$valueMinimumPrice = '';
|
||||
$valueMaximumPrice = '';
|
||||
|
||||
if(!empty($request->input('minimumPrice')) || !empty($request->input('maximumPrice')))
|
||||
{
|
||||
$this->minimumPrice = $request->minimumPrice;
|
||||
$this->maximumPrice = $request->maximumPrice;
|
||||
|
||||
$valueMinimumPrice = $request->minimumPrice;
|
||||
$valueMaximumPrice = $request->maximumPrice;
|
||||
}
|
||||
|
||||
$query = Domains::where('is_status', GlobalEnum::isSiteActive);
|
||||
|
||||
if (!empty($this->minimumPrice) || !empty($this->maximumPrice)) {
|
||||
$query->whereBetween('is_post_price', [$this->minimumPrice, $this->maximumPrice]);
|
||||
}
|
||||
|
||||
if (!empty($this->searchFilter)) {
|
||||
$check_query = $query->where('url', 'like', '%' . $this->searchFilter . '%')->count();
|
||||
if($check_query == 0) {
|
||||
$query->where('is_url_from_website', 'like', '%' . $this->searchFilter . '%');
|
||||
} else {
|
||||
$query->where('url', 'like', '%' . $this->searchFilter . '%');
|
||||
}
|
||||
}
|
||||
|
||||
$sites = $query->paginate($this->perPage)->appends([
|
||||
'minimumPrice' => $this->minimumPrice,
|
||||
'maximumPrice' => $this->maximumPrice,
|
||||
]);
|
||||
|
||||
$elements = $sites->links()->elements;
|
||||
$searchCount = $sites->total();
|
||||
|
||||
return view('livewire.modules.user.domain',
|
||||
compact('sites', 'elements', 'searchCount', 'valueMinimumPrice', 'valueMaximumPrice')
|
||||
);
|
||||
}
|
||||
|
||||
public function previousPage()
|
||||
{
|
||||
if ($this->currentPage > 1) {
|
||||
$this->currentPage--;
|
||||
}
|
||||
}
|
||||
|
||||
public function nextPage()
|
||||
{
|
||||
$this->currentPage++;
|
||||
}
|
||||
|
||||
public function goToPage($page)
|
||||
{
|
||||
$url = route('user.domain.view', ['id' => $page]);
|
||||
return redirect()->to($url);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Modules\User;
|
||||
|
||||
use Livewire\Component;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use Modules\Seller\Entities\DomainModel as Domains;
|
||||
use Modules\User\Entities\CartModel as Carts;
|
||||
|
||||
use App\Enums\GlobalEnum;
|
||||
use WithPagination;
|
||||
|
||||
class DomainPremium extends Component
|
||||
{
|
||||
public $searchFilter = '';
|
||||
public $minimumPrice;
|
||||
public $maximumPrice;
|
||||
|
||||
public $currentPage = 1;
|
||||
public $perPage = 10;
|
||||
|
||||
public function render(Request $request)
|
||||
{
|
||||
|
||||
$valueMinimumPrice = '';
|
||||
$valueMaximumPrice = '';
|
||||
|
||||
if(!empty($request->input('minimumPrice')) || !empty($request->input('maximumPrice')))
|
||||
{
|
||||
$this->minimumPrice = $request->minimumPrice;
|
||||
$this->maximumPrice = $request->maximumPrice;
|
||||
|
||||
$valueMinimumPrice = $request->minimumPrice;
|
||||
$valueMaximumPrice = $request->maximumPrice;
|
||||
}
|
||||
|
||||
$query = Domains::where('is_status', GlobalEnum::isSiteActive)->where('is_premium', 1);
|
||||
|
||||
if (!empty($this->minimumPrice) || !empty($this->maximumPrice)) {
|
||||
$query->whereBetween('is_post_price', [$this->minimumPrice, $this->maximumPrice]);
|
||||
}
|
||||
|
||||
if (!empty($this->searchFilter)) {
|
||||
$check_query = $query->where('url', 'like', '%' . $this->searchFilter . '%')->count();
|
||||
if($check_query == 0) {
|
||||
$query->where('is_url_from_website', 'like', '%' . $this->searchFilter . '%');
|
||||
} else {
|
||||
$query->where('url', 'like', '%' . $this->searchFilter . '%');
|
||||
}
|
||||
}
|
||||
|
||||
$sites = $query->paginate($this->perPage)->appends([
|
||||
'minimumPrice' => $this->minimumPrice,
|
||||
'maximumPrice' => $this->maximumPrice,
|
||||
]);
|
||||
|
||||
$elements = $sites->links()->elements;
|
||||
$searchCount = $sites->total();
|
||||
|
||||
return view('livewire.modules.user.domain-premium',
|
||||
compact('sites', 'elements', 'searchCount', 'valueMinimumPrice', 'valueMaximumPrice')
|
||||
);
|
||||
}
|
||||
|
||||
public function previousPage()
|
||||
{
|
||||
if ($this->currentPage > 1) {
|
||||
$this->currentPage--;
|
||||
}
|
||||
}
|
||||
|
||||
public function nextPage()
|
||||
{
|
||||
$this->currentPage++;
|
||||
}
|
||||
|
||||
public function goToPage($page)
|
||||
{
|
||||
$url = route('user.domain.view', ['id' => $page]);
|
||||
return redirect()->to($url);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Modules\User;
|
||||
|
||||
use Livewire\Component;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use Modules\Seller\Entities\SitesModel as Sites;
|
||||
use Modules\Seller\Entities\SitesCategoryModel as SitesCategory;
|
||||
use Modules\User\Entities\CartModel as Carts;
|
||||
use App\Enums\GlobalEnum;
|
||||
use WithPagination;
|
||||
|
||||
class Listing extends Component
|
||||
{
|
||||
public $filterType;
|
||||
public $categoryFilter;
|
||||
public $searchFilter = '';
|
||||
public $minimumPrice;
|
||||
public $maximumPrice;
|
||||
|
||||
public $currentPage = 1;
|
||||
public $perPage = 12;
|
||||
|
||||
public function render(Request $request)
|
||||
{
|
||||
$valueType = '';
|
||||
$valueCategory = '';
|
||||
$valueMinimumPrice = '';
|
||||
$valueMaximumPrice = '';
|
||||
|
||||
if(!empty($request->input('filterType')) || !empty($request->input('categoryFilter')) || !empty($request->input('minimumPrice')) || !empty($request->input('maximumPrice')))
|
||||
{
|
||||
$this->filterType = $request->filterType;
|
||||
$this->categoryFilter = $request->categoryFilter;
|
||||
$this->minimumPrice = $request->minimumPrice;
|
||||
$this->maximumPrice = $request->maximumPrice;
|
||||
|
||||
$valueType = $request->filterType;
|
||||
$valueCategory = $request->categoryFilter;
|
||||
$valueMinimumPrice = $request->minimumPrice;
|
||||
$valueMaximumPrice = $request->maximumPrice;
|
||||
}
|
||||
|
||||
$query = Sites::where('is_status', GlobalEnum::isSiteActive);
|
||||
|
||||
if (!empty($this->filterType)) {
|
||||
$query->where('is_type', $this->filterType);
|
||||
}
|
||||
|
||||
if (!empty($this->categoryFilter)) {
|
||||
$query->where('is_url_category', 'like', '%' . $this->categoryFilter . '%');
|
||||
}
|
||||
|
||||
if (!empty($this->minimumPrice) || !empty($this->maximumPrice)) {
|
||||
$query->whereBetween('is_post_price', [$this->minimumPrice, $this->maximumPrice]);
|
||||
}
|
||||
|
||||
if (!empty($this->searchFilter)) {
|
||||
$query->where('url', 'like', '%' . $this->searchFilter . '%');
|
||||
}
|
||||
|
||||
$sites = $query->paginate($this->perPage)->appends([
|
||||
'filterType' => $this->filterType,
|
||||
'categoryFilter' => $this->categoryFilter,
|
||||
'minimumPrice' => $this->minimumPrice,
|
||||
'maximumPrice' => $this->maximumPrice,
|
||||
]);
|
||||
|
||||
$elements = $sites->links()->elements;
|
||||
$searchCount = $sites->total();
|
||||
$getListCategory = SitesCategory::where('is_status', GlobalEnum::isActive)->get();
|
||||
|
||||
return view('livewire.modules.user.product',
|
||||
compact('sites', 'elements', 'searchCount', 'getListCategory', 'valueType', 'valueCategory', 'valueMinimumPrice', 'valueMaximumPrice')
|
||||
);
|
||||
}
|
||||
|
||||
public function previousPage()
|
||||
{
|
||||
if ($this->currentPage > 1) {
|
||||
$this->currentPage--;
|
||||
}
|
||||
}
|
||||
|
||||
public function nextPage()
|
||||
{
|
||||
$this->currentPage++;
|
||||
}
|
||||
|
||||
public function goToPage($page)
|
||||
{
|
||||
$url = route('user.sites.view', ['id' => $page]);
|
||||
return redirect()->to($url);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Modules\User;
|
||||
|
||||
use Livewire\Component;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use Modules\Seller\Entities\SitesModel as Sites;
|
||||
use Modules\Seller\Entities\SitesCategoryModel as SitesCategory;
|
||||
use Modules\User\Entities\CartModel as Carts;
|
||||
use App\Enums\GlobalEnum;
|
||||
use WithPagination;
|
||||
|
||||
class Site extends Component
|
||||
{
|
||||
public $filterType;
|
||||
public $categoryFilter;
|
||||
public $searchFilter = '';
|
||||
public $minimumPrice;
|
||||
public $maximumPrice;
|
||||
|
||||
public $currentPage = 1;
|
||||
public $perPage = 10;
|
||||
|
||||
public function render(Request $request)
|
||||
{
|
||||
|
||||
$valueType = '';
|
||||
$valueCategory = '';
|
||||
$valueMinimumPrice = '';
|
||||
$valueMaximumPrice = '';
|
||||
|
||||
if(!empty($request->input('filterType')) || !empty($request->input('categoryFilter')) || !empty($request->input('minimumPrice')) || !empty($request->input('maximumPrice')))
|
||||
{
|
||||
$this->filterType = $request->filterType;
|
||||
$this->categoryFilter = $request->categoryFilter;
|
||||
$this->minimumPrice = $request->minimumPrice;
|
||||
$this->maximumPrice = $request->maximumPrice;
|
||||
|
||||
$valueType = $request->filterType;
|
||||
$valueCategory = $request->categoryFilter;
|
||||
$valueMinimumPrice = $request->minimumPrice;
|
||||
$valueMaximumPrice = $request->maximumPrice;
|
||||
}
|
||||
|
||||
$query = Sites::where('is_status', GlobalEnum::isSiteActive);
|
||||
|
||||
if (!empty($this->filterType)) {
|
||||
$query->where('is_type', $this->filterType);
|
||||
}
|
||||
|
||||
if (!empty($this->categoryFilter)) {
|
||||
$query->where('is_url_category', 'like', '%' . $this->categoryFilter . '%');
|
||||
}
|
||||
|
||||
if (!empty($this->minimumPrice) || !empty($this->maximumPrice)) {
|
||||
$query->whereBetween('is_post_price', [$this->minimumPrice, $this->maximumPrice]);
|
||||
}
|
||||
|
||||
if (!empty($this->searchFilter)) {
|
||||
$query->where('url', 'like', '%' . $this->searchFilter . '%');
|
||||
}
|
||||
|
||||
$sites = $query->paginate($this->perPage)->appends([
|
||||
'filterType' => $this->filterType,
|
||||
'categoryFilter' => $this->categoryFilter,
|
||||
'minimumPrice' => $this->minimumPrice,
|
||||
'maximumPrice' => $this->maximumPrice,
|
||||
]);
|
||||
|
||||
$elements = $sites->links()->elements;
|
||||
$searchCount = $sites->total();
|
||||
$getListCategory = SitesCategory::where('is_status', GlobalEnum::isActive)->get();
|
||||
|
||||
return view('livewire.modules.user.site',
|
||||
compact('sites', 'elements', 'searchCount', 'getListCategory', 'valueType', 'valueCategory', 'valueMinimumPrice', 'valueMaximumPrice')
|
||||
);
|
||||
}
|
||||
|
||||
public function previousPage()
|
||||
{
|
||||
if ($this->currentPage > 1) {
|
||||
$this->currentPage--;
|
||||
}
|
||||
}
|
||||
|
||||
public function nextPage()
|
||||
{
|
||||
$this->currentPage++;
|
||||
}
|
||||
|
||||
public function goToPage($page)
|
||||
{
|
||||
$url = route('user.sites.view', ['id' => $page]);
|
||||
return redirect()->to($url);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Modules\User;
|
||||
|
||||
use Livewire\Component;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use Modules\Seller\Entities\SitesModel as Sites;
|
||||
use Modules\Seller\Entities\SitesCategoryModel as SitesCategory;
|
||||
use Modules\User\Entities\CartModel as Carts;
|
||||
|
||||
use App\Enums\GlobalEnum;
|
||||
use WithPagination;
|
||||
|
||||
class SitePremium extends Component
|
||||
{
|
||||
public $filterType;
|
||||
public $categoryFilter;
|
||||
public $searchFilter = '';
|
||||
public $minimumPrice;
|
||||
public $maximumPrice;
|
||||
|
||||
public $currentPage = 1;
|
||||
public $perPage = 10;
|
||||
|
||||
public function render(Request $request)
|
||||
{
|
||||
|
||||
$valueType = '';
|
||||
$valueCategory = '';
|
||||
$valueMinimumPrice = '';
|
||||
$valueMaximumPrice = '';
|
||||
|
||||
if(!empty($request->input('filterType')) || !empty($request->input('categoryFilter')) || !empty($request->input('minimumPrice')) || !empty($request->input('maximumPrice')))
|
||||
{
|
||||
$this->filterType = $request->filterType;
|
||||
$this->categoryFilter = $request->categoryFilter;
|
||||
$this->minimumPrice = $request->minimumPrice;
|
||||
$this->maximumPrice = $request->maximumPrice;
|
||||
|
||||
$valueType = $request->filterType;
|
||||
$valueCategory = $request->categoryFilter;
|
||||
$valueMinimumPrice = $request->minimumPrice;
|
||||
$valueMaximumPrice = $request->maximumPrice;
|
||||
}
|
||||
|
||||
$query = Sites::where('is_status', GlobalEnum::isSiteActive)->where('is_premium', 1);
|
||||
|
||||
if (!empty($this->filterType)) {
|
||||
$query->where('is_type', $this->filterType);
|
||||
}
|
||||
|
||||
if (!empty($this->categoryFilter)) {
|
||||
$query->where('is_url_category', 'like', '%' . $this->categoryFilter . '%');
|
||||
}
|
||||
|
||||
if (!empty($this->minimumPrice) || !empty($this->maximumPrice)) {
|
||||
$query->whereBetween('is_post_price', [$this->minimumPrice, $this->maximumPrice]);
|
||||
}
|
||||
|
||||
if (!empty($this->searchFilter)) {
|
||||
$query->where('url', 'like', '%' . $this->searchFilter . '%');
|
||||
}
|
||||
|
||||
$sites = $query->paginate($this->perPage)->appends([
|
||||
'filterType' => $this->filterType,
|
||||
'categoryFilter' => $this->categoryFilter,
|
||||
'minimumPrice' => $this->minimumPrice,
|
||||
'maximumPrice' => $this->maximumPrice,
|
||||
]);
|
||||
|
||||
$elements = $sites->links()->elements;
|
||||
$searchCount = $sites->total();
|
||||
$getListCategory = SitesCategory::where('is_status', GlobalEnum::isActive)->get();
|
||||
|
||||
return view('livewire.modules.user.site-premium',
|
||||
compact('sites', 'elements', 'searchCount', 'getListCategory', 'valueType', 'valueCategory', 'valueMinimumPrice', 'valueMaximumPrice')
|
||||
);
|
||||
}
|
||||
|
||||
public function previousPage()
|
||||
{
|
||||
if ($this->currentPage > 1) {
|
||||
$this->currentPage--;
|
||||
}
|
||||
}
|
||||
|
||||
public function nextPage()
|
||||
{
|
||||
$this->currentPage++;
|
||||
}
|
||||
|
||||
public function goToPage($page)
|
||||
{
|
||||
$url = route('user.sites.view', ['id' => $page]);
|
||||
return redirect()->to($url);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||
|
||||
class Authenticate extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the path the user should be redirected to when they are not authenticated.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return string|null
|
||||
*/
|
||||
protected function redirectTo($request)
|
||||
{
|
||||
if (! $request->expectsJson()) {
|
||||
return route('login');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class CheckAuthenticatedisAdmin
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
if (Auth::check()) {
|
||||
$user = Auth::user();
|
||||
|
||||
// Check the user's status
|
||||
if ($user->level != 1) {
|
||||
return redirect()->intended('user');
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class checkUserStatus
|
||||
{
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
// Check if the user is authenticated
|
||||
if (Auth::check()) {
|
||||
$user = Auth::user();
|
||||
|
||||
// Check the user's status
|
||||
if ($user->status !== 3) {
|
||||
return back()
|
||||
->with('swal', swal_alert('error', 'Akun anda dinonaktifkan, Mohon Kontak administrator'));
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
|
||||
|
||||
class EncryptCookies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the cookies that should not be encrypted.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
|
||||
|
||||
class PreventRequestsDuringMaintenance extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be reachable while maintenance mode is enabled.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class RedirectIfAuthenticated
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @param string|null ...$guards
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next, ...$guards)
|
||||
{
|
||||
$guards = empty($guards) ? [null] : $guards;
|
||||
|
||||
foreach ($guards as $guard) {
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
|
||||
|
||||
class TrimStrings extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the attributes that should not be trimmed.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustHosts as Middleware;
|
||||
|
||||
class TrustHosts extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the host patterns that should be trusted.
|
||||
*
|
||||
* @return array<int, string|null>
|
||||
*/
|
||||
public function hosts()
|
||||
{
|
||||
return [
|
||||
$this->allSubdomainsOfApplicationUrl(),
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustProxies as Middleware;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TrustProxies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The trusted proxies for this application.
|
||||
*
|
||||
* @var array<int, string>|string|null
|
||||
*/
|
||||
protected $proxies;
|
||||
|
||||
/**
|
||||
* The headers that should be used to detect proxies.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $headers =
|
||||
Request::HEADER_X_FORWARDED_FOR |
|
||||
Request::HEADER_X_FORWARDED_HOST |
|
||||
Request::HEADER_X_FORWARDED_PORT |
|
||||
Request::HEADER_X_FORWARDED_PROTO |
|
||||
Request::HEADER_X_FORWARDED_AWS_ELB;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
||||
|
||||
class VerifyCsrfToken extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be excluded from CSRF verification.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class XssSanitization
|
||||
{
|
||||
/**
|
||||
* Handles the request by modifying the input data and passing it to the next middleware or route handler.
|
||||
*
|
||||
* @param Request $request The request object containing the input data.
|
||||
* @param Closure $next The next middleware or route handler.
|
||||
* @throws Some_Exception_Class [Optional] Description of any exception that may be thrown.
|
||||
* @return mixed The result of the next middleware or route handler.
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
$input = $request->all();
|
||||
array_walk_recursive($input, function(&$input) {
|
||||
$input = strip_tags($input);
|
||||
});
|
||||
|
||||
$request->merge($input);
|
||||
return $next($request);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class isAuth
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
$auth = Auth::check();
|
||||
if($auth) {
|
||||
$user = Auth::user();
|
||||
switch($user->level == 1) {
|
||||
case 1:
|
||||
return redirect()->intended('app/dashboard');
|
||||
break;
|
||||
case 2:
|
||||
return redirect()->intended('user');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
|
||||
class Alternatif extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tbl_data_alternatif';
|
||||
protected $primaryKey = 'id_alternatif';
|
||||
protected $fillable = [
|
||||
'id_alternatif',
|
||||
'nama_alternatif',
|
||||
'usia_ayam',
|
||||
'berat',
|
||||
'konsumsi_pakan',
|
||||
'vitamin',
|
||||
'kandang',
|
||||
];
|
||||
|
||||
public $timestamps = false;
|
||||
public $keyType = 'string';
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::deleting(function ($alternatif) {
|
||||
// Contoh lain: Hapus data terkait dari tabel lain lagi
|
||||
DB::table('tbl_analisa_alternatif')->where('alternatif_pertama', $alternatif->id_alternatif)->delete();
|
||||
// Gantilah 'another_table_name' dengan nama tabel lain yang sesuai
|
||||
|
||||
// Contoh lain: Hapus data terkait dari tabel lain lagi
|
||||
DB::table('tbl_analisa_alternatif')->where('alternatif_kedua', $alternatif->id_alternatif)->delete();
|
||||
// Gantilah 'another_table_name' dengan nama tabel lain yang sesuai
|
||||
|
||||
// Contoh lain: Hapus data terkait dari tabel lain lagi
|
||||
DB::table('tb_bobot_alternatif')->where('id_alternatif', $alternatif->id_alternatif)->delete();
|
||||
// Gantilah 'another_table_name' dengan nama tabel lain yang sesuai
|
||||
|
||||
//Contoh lain: Hapus data terkait dari tabel lain lagi
|
||||
DB::table('tbl_rangking')->where('alternatif', $alternatif->id_alternatif)->delete();
|
||||
// Gantilah 'another_table_name' dengan nama tabel lain yang sesuai
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AnalisaAlternatif extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tbl_analisa_alternatif';
|
||||
protected $fillable = [
|
||||
'alternatif_pertama',
|
||||
'id_kriteria',
|
||||
'nilai_analisa_alternatif',
|
||||
'alternatif_kedua',
|
||||
];
|
||||
|
||||
public $timestamps = false;
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AnalisaKriteria extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tbl_analisa_kriteria';
|
||||
protected $fillable = [
|
||||
'kriteria_pertama',
|
||||
'nilai_analisa_kriteria',
|
||||
'kriteria_kedua',
|
||||
];
|
||||
|
||||
public $timestamps = false;
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class BobotAlternatif extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tb_bobot_alternatif';
|
||||
protected $primaryKey = 'id_alternatif';
|
||||
protected $fillable = [
|
||||
'id_alternatif',
|
||||
'id_kriteria',
|
||||
'nilai',
|
||||
];
|
||||
|
||||
public $timestamps = false;
|
||||
public $keyType = 'string';
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class BobotKriteria extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tb_bobot_kriteria';
|
||||
protected $primaryKey = 'id_kriteria';
|
||||
protected $fillable = [
|
||||
'id_kriteria',
|
||||
'nilai',
|
||||
];
|
||||
|
||||
public $timestamps = false;
|
||||
public $keyType = 'string';
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
|
||||
class Kriteria extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tbl_data_kriteria';
|
||||
protected $primaryKey = 'id_kriteria';
|
||||
protected $fillable = [
|
||||
'id_kriteria',
|
||||
'nama_kriteria',
|
||||
];
|
||||
|
||||
public $timestamps = false;
|
||||
public $keyType = 'string';
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::deleting(function ($kriteria) {
|
||||
// Hapus data terkait dari tabel lain
|
||||
DB::table('tbl_analisa_kriteria')->where('kriteria_pertama', $kriteria->id_kriteria)->delete();
|
||||
// Gantilah 'table_name' dengan nama tabel yang sesuai
|
||||
|
||||
// Hapus data terkait dari tabel lain
|
||||
DB::table('tbl_analisa_kriteria')->where('kriteria_kedua', $kriteria->id_kriteria)->delete();
|
||||
// Gantilah 'table_name' dengan nama tabel yang sesuai
|
||||
|
||||
// Hapus data terkait dari tabel lain
|
||||
DB::table('tbl_analisa_alternatif')->where('id_kriteria', $kriteria->id_kriteria)->delete();
|
||||
// Gantilah 'table_name' dengan nama tabel yang sesuai
|
||||
|
||||
// Contoh lain: Hapus data terkait dari tabel lain lagi
|
||||
DB::table('tb_bobot_alternatif')->where('id_kriteria', $kriteria->id_kriteria)->delete();
|
||||
// Gantilah 'another_table_name' dengan nama tabel lain yang sesuai
|
||||
|
||||
// Contoh lain: Hapus data terkait dari tabel lain lagi
|
||||
DB::table('tb_bobot_kriteria')->where('id_kriteria', $kriteria->id_kriteria)->delete();
|
||||
// Gantilah 'another_table_name' dengan nama tabel lain yang sesuai
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class LogActivites extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tbl_log_activity';
|
||||
protected $fillable = ['uid','logType','causedBy','performedOn','withContent','created_at'];
|
||||
public $timestamps = false;
|
||||
|
||||
public static function default($args = [])
|
||||
{
|
||||
self::create([
|
||||
'uid' => Uuid::uuid4()->toString(),
|
||||
'logType' => $args['logType'],
|
||||
'causedBy' => $args['causedBy'],
|
||||
'performedOn' => Carbon::now(),
|
||||
'withContent' => json_encode($args['withContent'], true),
|
||||
]);
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasMany(User::class, 'id', 'causedBy');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Nilai extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tbl_nilai';
|
||||
protected $primaryKey = 'id_nilai';
|
||||
protected $fillable = [
|
||||
'id_nilai',
|
||||
'jum_nilai',
|
||||
'ket_nilai'
|
||||
];
|
||||
|
||||
public $timestamps = false;
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class NilaiRandom extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tbl_ir';
|
||||
protected $primaryKey = 'jumlah';
|
||||
protected $fillable = [
|
||||
'jumlah',
|
||||
'nilai',
|
||||
];
|
||||
|
||||
public $timestamps = false;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Ranking extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tbl_rangking';
|
||||
protected $primaryKey = 'id';
|
||||
protected $fillable = [
|
||||
'skor_bobot',
|
||||
'alternatif'
|
||||
];
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
public function account()
|
||||
{
|
||||
return $this->hasOne(Alternatif::class, 'id_alternatif', 'alternatif');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\User;
|
||||
|
||||
class Roles extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tbl_role';
|
||||
protected $fillable = ['id','name'];
|
||||
public $timestamps = false;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
use App\Models\Permission;
|
||||
use App\Models\Roles;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens, HasFactory, Notifiable;
|
||||
|
||||
protected $table = 'tbl_users';
|
||||
protected $fillable = ['password','username','name','email','email_verified_token','email_verified_at','remember_token','level'];
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
public $timestamps = false;
|
||||
|
||||
public function permission()
|
||||
{
|
||||
return $this->hasMany(Permission::class);
|
||||
}
|
||||
|
||||
public function roles()
|
||||
{
|
||||
return $this->hasMany(Roles::class);
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue