Updates to 03-2025

This commit is contained in:
Kevin Adametz 2025-04-01 10:36:47 +02:00
parent bfa3bb1df4
commit 9ae662f63e
243 changed files with 12580 additions and 12018 deletions

4
.env
View file

@ -22,12 +22,14 @@ APP_CHECKOUT_TEST_MAIL=kevin.adametz@me.com
APP_INFO_TEST_MAIL=kevin.adametz@me.com
EXCEPTION_MAIL=exception@adametz.media
APP_MODE=test
APP_IPINFO=true
APP_MAIN_TAX=1.19
APP_MAIN_TAX_RATE=19
APP_PHP_VERSION=7.4
APP_PHP_VERSION=8.2
LOG_CHANNEL=stack

3
.idea/.gitignore generated vendored
View file

@ -1,3 +0,0 @@
# Datasource local storage ignored files
/dataSources.local.xml
/dataSources/

View file

@ -1,5 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

File diff suppressed because it is too large Load diff

View file

@ -1,47 +0,0 @@
<?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>

10
.idea/composerJson.xml generated
View file

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ComposerJsonPluginSettings">
<unboundedVersionInspectionSettings>
<excludedPackages />
</unboundedVersionInspectionSettings>
<customRepositories />
<composerUpdateOptions />
</component>
</project>

11
.idea/dataSources.xml generated
View file

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="MySQL - @localhost" uuid="f58b2045-72b3-4199-b31f-5c9c653c31de">
<driver-ref>mysql.8</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mysql://localhost:3306/mivita</jdbc-url>
</data-source>
</component>
</project>

4
.idea/deployment.xml generated
View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PublishConfigData" serverName="my.mivita.test" />
</project>

6
.idea/encodings.xml generated
View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

View file

@ -1,85 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JSHintConfiguration" version="2.9.5" use-config-file="true" use-custom-config-file="true" custom-config-file-path="$PROJECT_DIR$/assets/plugins/footable/js/.jshintrc">
<option asi="false" />
<option bitwise="true" />
<option boss="false" />
<option browser="true" />
<option browserify="false" />
<option camelcase="false" />
<option couch="false" />
<option curly="true" />
<option debug="false" />
<option devel="false" />
<option dojo="false" />
<option elision="false" />
<option enforceall="false" />
<option eqeqeq="true" />
<option eqnull="false" />
<option es3="false" />
<option es5="false" />
<option esnext="false" />
<option evil="false" />
<option expr="false" />
<option forin="true" />
<option freeze="false" />
<option funcscope="false" />
<option futurehostile="false" />
<option gcl="false" />
<option globalstrict="false" />
<option immed="false" />
<option iterator="false" />
<option jasmine="false" />
<option jquery="false" />
<option lastsemic="false" />
<option latedef="false" />
<option laxbreak="false" />
<option laxcomma="false" />
<option loopfunc="false" />
<option maxerr="50" />
<option mocha="false" />
<option module="false" />
<option mootools="false" />
<option moz="false" />
<option multistr="false" />
<option newcap="false" />
<option noarg="true" />
<option nocomma="false" />
<option node="false" />
<option noempty="true" />
<option nomen="false" />
<option nonbsp="false" />
<option nonew="true" />
<option nonstandard="false" />
<option notypeof="false" />
<option noyield="false" />
<option onevar="false" />
<option passfail="false" />
<option phantom="false" />
<option plusplus="false" />
<option proto="false" />
<option prototypejs="false" />
<option qunit="false" />
<option quotmark="false" />
<option rhino="false" />
<option scripturl="false" />
<option shadow="false" />
<option shelljs="false" />
<option singleGroups="false" />
<option smarttabs="false" />
<option strict="true" />
<option sub="false" />
<option supernew="false" />
<option trailing="false" />
<option typed="false" />
<option undef="true" />
<option unused="false" />
<option validthis="false" />
<option varstmt="false" />
<option white="false" />
<option withstmt="false" />
<option worker="false" />
<option wsh="false" />
<option yui="false" />
</component>
</project>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="LaravelPluginSettings">
<option name="pluginEnabled" value="true" />
</component>
</project>

6
.idea/misc.xml generated
View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>

147
.idea/mivita.care.iml generated
View file

@ -1,147 +0,0 @@
<?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$/spec" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/app" isTestSource="false" packagePrefix="App\" />
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" packagePrefix="Tests\" />
<excludeFolder url="file://$MODULE_DIR$/vendor/askedio/laravel5-profanity-filter" />
<excludeFolder url="file://$MODULE_DIR$/vendor/barryvdh/laravel-debugbar" />
<excludeFolder url="file://$MODULE_DIR$/vendor/barryvdh/laravel-dompdf" />
<excludeFolder url="file://$MODULE_DIR$/vendor/barryvdh/laravel-ide-helper" />
<excludeFolder url="file://$MODULE_DIR$/vendor/barryvdh/reflection-docblock" />
<excludeFolder url="file://$MODULE_DIR$/vendor/cocur/slugify" />
<excludeFolder url="file://$MODULE_DIR$/vendor/composer" />
<excludeFolder url="file://$MODULE_DIR$/vendor/cviebrock/eloquent-sluggable" />
<excludeFolder url="file://$MODULE_DIR$/vendor/defuse/php-encryption" />
<excludeFolder url="file://$MODULE_DIR$/vendor/dnoegel/php-xdg-base-dir" />
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/cache" />
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/dbal" />
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/event-manager" />
<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/dompdf/dompdf" />
<excludeFolder url="file://$MODULE_DIR$/vendor/dragonmantank/cron-expression" />
<excludeFolder url="file://$MODULE_DIR$/vendor/egulias/email-validator" />
<excludeFolder url="file://$MODULE_DIR$/vendor/fideloper/proxy" />
<excludeFolder url="file://$MODULE_DIR$/vendor/filp/whoops" />
<excludeFolder url="file://$MODULE_DIR$/vendor/firebase/php-jwt" />
<excludeFolder url="file://$MODULE_DIR$/vendor/fzaninotto/faker" />
<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/intervention/image" />
<excludeFolder url="file://$MODULE_DIR$/vendor/jakub-onderka/php-console-color" />
<excludeFolder url="file://$MODULE_DIR$/vendor/jakub-onderka/php-console-highlighter" />
<excludeFolder url="file://$MODULE_DIR$/vendor/jenssegers/date" />
<excludeFolder url="file://$MODULE_DIR$/vendor/justinrainbow/json-schema" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laminas/laminas-diactoros" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laminas/laminas-zendframework-bridge" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laracasts/flash" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/framework" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/helpers" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/passport" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/tinker" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laravelcollective/html" />
<excludeFolder url="file://$MODULE_DIR$/vendor/lcobucci/jwt" />
<excludeFolder url="file://$MODULE_DIR$/vendor/league/commonmark" />
<excludeFolder url="file://$MODULE_DIR$/vendor/league/event" />
<excludeFolder url="file://$MODULE_DIR$/vendor/league/flysystem" />
<excludeFolder url="file://$MODULE_DIR$/vendor/league/oauth2-server" />
<excludeFolder url="file://$MODULE_DIR$/vendor/maatwebsite/excel" />
<excludeFolder url="file://$MODULE_DIR$/vendor/markbaker/complex" />
<excludeFolder url="file://$MODULE_DIR$/vendor/markbaker/matrix" />
<excludeFolder url="file://$MODULE_DIR$/vendor/maximebf/debugbar" />
<excludeFolder url="file://$MODULE_DIR$/vendor/mockery/mockery" />
<excludeFolder url="file://$MODULE_DIR$/vendor/monolog/monolog" />
<excludeFolder url="file://$MODULE_DIR$/vendor/myclabs/deep-copy" />
<excludeFolder url="file://$MODULE_DIR$/vendor/nesbot/carbon" />
<excludeFolder url="file://$MODULE_DIR$/vendor/nikic/php-parser" />
<excludeFolder url="file://$MODULE_DIR$/vendor/nunomaduro/collision" />
<excludeFolder url="file://$MODULE_DIR$/vendor/nyholm/psr7" />
<excludeFolder url="file://$MODULE_DIR$/vendor/olimortimer/laravelshoppingcart" />
<excludeFolder url="file://$MODULE_DIR$/vendor/opis/closure" />
<excludeFolder url="file://$MODULE_DIR$/vendor/paragonie/random_compat" />
<excludeFolder url="file://$MODULE_DIR$/vendor/phar-io/manifest" />
<excludeFolder url="file://$MODULE_DIR$/vendor/phar-io/version" />
<excludeFolder url="file://$MODULE_DIR$/vendor/phenx/php-font-lib" />
<excludeFolder url="file://$MODULE_DIR$/vendor/phenx/php-svg-lib" />
<excludeFolder url="file://$MODULE_DIR$/vendor/php-http/message-factory" />
<excludeFolder url="file://$MODULE_DIR$/vendor/phpdocumentor/reflection-common" />
<excludeFolder url="file://$MODULE_DIR$/vendor/phpdocumentor/reflection-docblock" />
<excludeFolder url="file://$MODULE_DIR$/vendor/phpdocumentor/type-resolver" />
<excludeFolder url="file://$MODULE_DIR$/vendor/phpoffice/phpspreadsheet" />
<excludeFolder url="file://$MODULE_DIR$/vendor/phpoption/phpoption" />
<excludeFolder url="file://$MODULE_DIR$/vendor/phpseclib/phpseclib" />
<excludeFolder url="file://$MODULE_DIR$/vendor/phpspec/prophecy" />
<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/php-token-stream" />
<excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/phpunit" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/container" />
<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/uuid" />
<excludeFolder url="file://$MODULE_DIR$/vendor/reliese/laravel" />
<excludeFolder url="file://$MODULE_DIR$/vendor/sabberworm/php-css-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/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/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/seld/jsonlint" />
<excludeFolder url="file://$MODULE_DIR$/vendor/seld/phar-utils" />
<excludeFolder url="file://$MODULE_DIR$/vendor/setasign/fpdf" />
<excludeFolder url="file://$MODULE_DIR$/vendor/setasign/fpdi" />
<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/debug" />
<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/filesystem" />
<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-idn" />
<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/process" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/psr-http-message-bridge" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/routing" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/service-contracts" />
<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/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/webmozart/assert" />
<excludeFolder url="file://$MODULE_DIR$/vendor/yajra/laravel-datatables-oracle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

8
.idea/modules.xml generated
View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/mivita.care.iml" filepath="$PROJECT_DIR$/.idea/mivita.care.iml" />
</modules>
</component>
</project>

View file

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PhpTestFrameworkVersionCache">
<tools_cache>
<tool tool_name="PHPUnit">
<cache>
<versions>
<info id="Local" version="9.1.4" />
</versions>
</cache>
</tool>
</tools_cache>
</component>
</project>

148
.idea/php.xml generated
View file

@ -1,148 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PhpIncludePathManager">
<include_path>
<path value="$PROJECT_DIR$/vendor/mockery/mockery" />
<path value="$PROJECT_DIR$/vendor/phpunit/php-file-iterator" />
<path value="$PROJECT_DIR$/vendor/phpunit/php-text-template" />
<path value="$PROJECT_DIR$/vendor/phpunit/php-timer" />
<path value="$PROJECT_DIR$/vendor/seld/phar-utils" />
<path value="$PROJECT_DIR$/vendor/phpunit/php-token-stream" />
<path value="$PROJECT_DIR$/vendor/composer" />
<path value="$PROJECT_DIR$/vendor/phpunit/php-code-coverage" />
<path value="$PROJECT_DIR$/vendor/barryvdh/reflection-docblock" />
<path value="$PROJECT_DIR$/vendor/barryvdh/laravel-ide-helper" />
<path value="$PROJECT_DIR$/vendor/phpspec/prophecy" />
<path value="$PROJECT_DIR$/vendor/jakub-onderka/php-console-highlighter" />
<path value="$PROJECT_DIR$/vendor/jenssegers/date" />
<path value="$PROJECT_DIR$/vendor/jakub-onderka/php-console-color" />
<path value="$PROJECT_DIR$/vendor/league/flysystem" />
<path value="$PROJECT_DIR$/vendor/fideloper/proxy" />
<path value="$PROJECT_DIR$/vendor/vlucas/phpdotenv" />
<path value="$PROJECT_DIR$/vendor/psy/psysh" />
<path value="$PROJECT_DIR$/vendor/myclabs/deep-copy" />
<path value="$PROJECT_DIR$/vendor/symfony/debug" />
<path value="$PROJECT_DIR$/vendor/guzzlehttp/psr7" />
<path value="$PROJECT_DIR$/vendor/guzzlehttp/promises" />
<path value="$PROJECT_DIR$/vendor/phpunit/phpunit" />
<path value="$PROJECT_DIR$/vendor/symfony/console" />
<path value="$PROJECT_DIR$/vendor/symfony/process" />
<path value="$PROJECT_DIR$/vendor/guzzlehttp/guzzle" />
<path value="$PROJECT_DIR$/vendor/symfony/http-kernel" />
<path value="$PROJECT_DIR$/vendor/symfony/filesystem" />
<path value="$PROJECT_DIR$/vendor/seld/jsonlint" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php72" />
<path value="$PROJECT_DIR$/vendor/symfony/event-dispatcher" />
<path value="$PROJECT_DIR$/vendor/symfony/css-selector" />
<path value="$PROJECT_DIR$/vendor/doctrine/dbal" />
<path value="$PROJECT_DIR$/vendor/swiftmailer/swiftmailer" />
<path value="$PROJECT_DIR$/vendor/nikic/php-parser" />
<path value="$PROJECT_DIR$/vendor/symfony/finder" />
<path value="$PROJECT_DIR$/vendor/symfony/routing" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-mbstring" />
<path value="$PROJECT_DIR$/vendor/justinrainbow/json-schema" />
<path value="$PROJECT_DIR$/vendor/symfony/http-foundation" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-ctype" />
<path value="$PROJECT_DIR$/vendor/symfony/translation" />
<path value="$PROJECT_DIR$/vendor/paragonie/random_compat" />
<path value="$PROJECT_DIR$/vendor/symfony/var-dumper" />
<path value="$PROJECT_DIR$/vendor/psr/http-message" />
<path value="$PROJECT_DIR$/vendor/psr/log" />
<path value="$PROJECT_DIR$/vendor/dnoegel/php-xdg-base-dir" />
<path value="$PROJECT_DIR$/vendor/psr/container" />
<path value="$PROJECT_DIR$/vendor/psr/simple-cache" />
<path value="$PROJECT_DIR$/vendor/theseer/tokenizer" />
<path value="$PROJECT_DIR$/vendor/sebastian/comparator" />
<path value="$PROJECT_DIR$/vendor/sebastian/environment" />
<path value="$PROJECT_DIR$/vendor/sebastian/global-state" />
<path value="$PROJECT_DIR$/vendor/sebastian/object-enumerator" />
<path value="$PROJECT_DIR$/vendor/sebastian/object-reflector" />
<path value="$PROJECT_DIR$/vendor/laravel/tinker" />
<path value="$PROJECT_DIR$/vendor/sebastian/exporter" />
<path value="$PROJECT_DIR$/vendor/laravel/framework" />
<path value="$PROJECT_DIR$/vendor/sebastian/recursion-context" />
<path value="$PROJECT_DIR$/vendor/laravelcollective/html" />
<path value="$PROJECT_DIR$/vendor/egulias/email-validator" />
<path value="$PROJECT_DIR$/vendor/sebastian/diff" />
<path value="$PROJECT_DIR$/vendor/sebastian/version" />
<path value="$PROJECT_DIR$/vendor/filp/whoops" />
<path value="$PROJECT_DIR$/vendor/sebastian/resource-operations" />
<path value="$PROJECT_DIR$/vendor/sebastian/code-unit-reverse-lookup" />
<path value="$PROJECT_DIR$/vendor/intervention/image" />
<path value="$PROJECT_DIR$/vendor/webmozart/assert" />
<path value="$PROJECT_DIR$/vendor/yajra/laravel-datatables-oracle" />
<path value="$PROJECT_DIR$/vendor/fzaninotto/faker" />
<path value="$PROJECT_DIR$/vendor/tijsverkoyen/css-to-inline-styles" />
<path value="$PROJECT_DIR$/vendor/monolog/monolog" />
<path value="$PROJECT_DIR$/vendor/doctrine/event-manager" />
<path value="$PROJECT_DIR$/vendor/doctrine/inflector" />
<path value="$PROJECT_DIR$/vendor/doctrine/cache" />
<path value="$PROJECT_DIR$/vendor/doctrine/instantiator" />
<path value="$PROJECT_DIR$/vendor/ramsey/uuid" />
<path value="$PROJECT_DIR$/vendor/phar-io/manifest" />
<path value="$PROJECT_DIR$/vendor/doctrine/lexer" />
<path value="$PROJECT_DIR$/vendor/phar-io/version" />
<path value="$PROJECT_DIR$/vendor/nunomaduro/collision" />
<path value="$PROJECT_DIR$/vendor/nesbot/carbon" />
<path value="$PROJECT_DIR$/vendor/phpdocumentor/type-resolver" />
<path value="$PROJECT_DIR$/vendor/phpdocumentor/reflection-common" />
<path value="$PROJECT_DIR$/vendor/hamcrest/hamcrest-php" />
<path value="$PROJECT_DIR$/vendor/dragonmantank/cron-expression" />
<path value="$PROJECT_DIR$/vendor/phpdocumentor/reflection-docblock" />
<path value="$PROJECT_DIR$/vendor/cviebrock/eloquent-sluggable" />
<path value="$PROJECT_DIR$/vendor/ralouphie/getallheaders" />
<path value="$PROJECT_DIR$/vendor/askedio/laravel5-profanity-filter" />
<path value="$PROJECT_DIR$/vendor/symfony/mime" />
<path value="$PROJECT_DIR$/vendor/symfony/service-contracts" />
<path value="$PROJECT_DIR$/vendor/symfony/error-handler" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php73" />
<path value="$PROJECT_DIR$/vendor/symfony/translation-contracts" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-intl-idn" />
<path value="$PROJECT_DIR$/vendor/symfony/event-dispatcher-contracts" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-iconv" />
<path value="$PROJECT_DIR$/vendor/reliese/laravel" />
<path value="$PROJECT_DIR$/vendor/setasign/fpdf" />
<path value="$PROJECT_DIR$/vendor/setasign/fpdi" />
<path value="$PROJECT_DIR$/vendor/olimortimer/laravelshoppingcart" />
<path value="$PROJECT_DIR$/vendor/league/commonmark" />
<path value="$PROJECT_DIR$/vendor/opis/closure" />
<path value="$PROJECT_DIR$/vendor/phpoption/phpoption" />
<path value="$PROJECT_DIR$/vendor/maximebf/debugbar" />
<path value="$PROJECT_DIR$/vendor/laracasts/flash" />
<path value="$PROJECT_DIR$/vendor/cocur/slugify" />
<path value="$PROJECT_DIR$/vendor/sebastian/type" />
<path value="$PROJECT_DIR$/vendor/sebastian/code-unit" />
<path value="$PROJECT_DIR$/vendor/barryvdh/laravel-debugbar" />
<path value="$PROJECT_DIR$/vendor/phpunit/php-invoker" />
<path value="$PROJECT_DIR$/vendor/symfony/psr-http-message-bridge" />
<path value="$PROJECT_DIR$/vendor/laminas/laminas-diactoros" />
<path value="$PROJECT_DIR$/vendor/laminas/laminas-zendframework-bridge" />
<path value="$PROJECT_DIR$/vendor/dompdf/dompdf" />
<path value="$PROJECT_DIR$/vendor/php-http/message-factory" />
<path value="$PROJECT_DIR$/vendor/lcobucci/jwt" />
<path value="$PROJECT_DIR$/vendor/laravel/passport" />
<path value="$PROJECT_DIR$/vendor/laravel/helpers" />
<path value="$PROJECT_DIR$/vendor/nyholm/psr7" />
<path value="$PROJECT_DIR$/vendor/phenx/php-font-lib" />
<path value="$PROJECT_DIR$/vendor/phenx/php-svg-lib" />
<path value="$PROJECT_DIR$/vendor/defuse/php-encryption" />
<path value="$PROJECT_DIR$/vendor/firebase/php-jwt" />
<path value="$PROJECT_DIR$/vendor/sabberworm/php-css-parser" />
<path value="$PROJECT_DIR$/vendor/phpseclib/phpseclib" />
<path value="$PROJECT_DIR$/vendor/league/event" />
<path value="$PROJECT_DIR$/vendor/league/oauth2-server" />
<path value="$PROJECT_DIR$/vendor/psr/http-factory" />
<path value="$PROJECT_DIR$/vendor/barryvdh/laravel-dompdf" />
<path value="$PROJECT_DIR$/vendor/phpoffice/phpspreadsheet" />
<path value="$PROJECT_DIR$/vendor/maatwebsite/excel" />
<path value="$PROJECT_DIR$/vendor/markbaker/matrix" />
<path value="$PROJECT_DIR$/vendor/markbaker/complex" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="7.2" />
<component name="PhpUnit">
<phpunit_settings>
<PhpUnitSettings custom_loader_path="$PROJECT_DIR$/vendor/autoload.php" />
</phpunit_settings>
</component>
</project>

8
.idea/symfony2.xml generated
View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Symfony2PluginSettings">
<option name="directoryToWeb" value="public" />
<option name="pluginEnabled" value="true" />
<option name="lastServiceGeneratorLanguage" value="yaml" />
</component>
</project>

6
.idea/vcs.xml generated
View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

627
.idea/workspace.xml generated
View file

@ -1,627 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="2fbaac5f-25ba-4502-a970-cc14728d7d55" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/resources/views/user/shop/sales/order_detail.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/Api/ShoppingUserController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/Api/ShoppingUserController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/ProductController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/ProductController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/SalesController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/SalesController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/Web/ContactController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/Web/ContactController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Mail/MailCheckout.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Mail/MailCheckout.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Models/ShippingPrice.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Models/ShippingPrice.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Models/ShoppingOrder.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Models/ShoppingOrder.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Models/ShoppingUser.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Models/ShoppingUser.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Repositories/ProductRepository.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Repositories/ProductRepository.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/config/cart.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/cart.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/config/mail.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/mail.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/database/migrations/2019_02_23_163527_create_shopping_orders_table.php" beforeDir="false" afterPath="$PROJECT_DIR$/database/migrations/2019_02_23_163527_create_shopping_orders_table.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/lang/de Kopie.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/resources/lang/de/email.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/lang/de/email.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/lang/de/register.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/lang/de/register.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/admin/product/index.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/admin/product/index.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/admin/sales/_detail.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/admin/sales/_detail.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/emails/checkout.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/emails/checkout.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/layouts/application.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/layouts/application.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/user/customer/detail.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/user/customer/detail.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/web/templates/registrierung.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/web/templates/registrierung.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/routes/api.php" beforeDir="false" afterPath="$PROJECT_DIR$/routes/api.php" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ComposerSettings" doNotAsk="true" synchronizationState="SYNCHRONIZE">
<pharConfigPath>$PROJECT_DIR$/composer.json</pharConfigPath>
<execution>
<phar pharPath="/usr/local/bin/composer" interpreterId="1b9e99f0-0fb5-45bb-9686-0d9b61bf499b" />
</execution>
</component>
<component name="DatabaseView">
<option name="SHOW_INTERMEDIATE" value="true" />
<option name="GROUP_DATA_SOURCES" value="true" />
<option name="GROUP_SCHEMA" value="true" />
<option name="GROUP_CONTENTS" value="false" />
<option name="SORT_POSITIONED" value="false" />
<option name="SHOW_EMPTY_GROUPS" value="false" />
<option name="AUTO_SCROLL_FROM_SOURCE" value="false" />
<option name="HIDDEN_KINDS">
<set />
</option>
<expand>
<path>
<item name="Database" type="3277223f:DatabaseStructure$DbRootGroup" />
<item name="MySQL - @localhost" type="feb32156:DbDataSourceImpl" />
</path>
<path>
<item name="Database" type="3277223f:DatabaseStructure$DbRootGroup" />
<item name="MySQL - @localhost" type="feb32156:DbDataSourceImpl" />
<item name="schemas" type="d4e8921:DatabaseStructure$FamilyGroup" />
</path>
<path>
<item name="Database" type="3277223f:DatabaseStructure$DbRootGroup" />
<item name="MySQL - @localhost" type="feb32156:DbDataSourceImpl" />
<item name="schemas" type="d4e8921:DatabaseStructure$FamilyGroup" />
<item name="mivita: schema" type="76f4a085:MysqlImplModel$Schema" />
</path>
<path>
<item name="Database" type="3277223f:DatabaseStructure$DbRootGroup" />
<item name="MySQL - @localhost" type="feb32156:DbDataSourceImpl" />
<item name="schemas" type="d4e8921:DatabaseStructure$FamilyGroup" />
<item name="mivita: schema" type="76f4a085:MysqlImplModel$Schema" />
<item name="user_histories: table" type="285a2a93:MysqlImplModel$Table" />
</path>
</expand>
<select />
</component>
<component name="FrameworkCommandLineHistory">
<commandsHistory>
<command text="php artisan ide-helper:meta" />
<command text="php artisan ide-helper:models" />
<command text="php artisan ide-helper:generate" />
<command text="php artisan ide-helper:models" />
<command text="php artisan ide-helper:meta" />
<command text="php artisan ide-helper:models" />
<command text="php artisan ide-helper:generate" />
<command text="php artisan ide-helper:models" />
<command text="php artisan ide-helper:generate" />
<command text="composer dump-autoload" />
<command text="composer run-script post-update-cmd" />
<command text="php artisan ide-helper:models" />
<command text="php artisan ide-helper:meta" />
<command text="php artisan ide-helper:generate" />
<command text="php artisan ide-helper:meta" />
<command text="php artisan ide-helper:models" />
<command text="php artisan ide-helper:generate" />
<command text="composer dump-autoload" />
<command text="composer run-script post-update-cmd" />
<command text="php artisan ide-helper:generate" />
<command text="composer run-script post-update-cmd" />
<command text="php artisan ide-helper:models" />
<command text="php artisan ide-helper:meta" />
<command text="php artisan ide-helper:generate" />
<command text="composer run-script post-update-cmd" />
</commandsHistory>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="GitSEFilterConfiguration">
<file-type-list>
<filtered-out-file-type name="LOCAL_BRANCH" />
<filtered-out-file-type name="REMOTE_BRANCH" />
<filtered-out-file-type name="TAG" />
<filtered-out-file-type name="COMMIT_BY_MESSAGE" />
</file-type-list>
</component>
<component name="PhpServers">
<servers />
</component>
<component name="PhpWorkspaceProjectConfiguration" interpreter_name="PHP 7.1">
<include_path>
<path value="$PROJECT_DIR$/vendor/mockery/mockery" />
<path value="$PROJECT_DIR$/vendor/phpunit/php-file-iterator" />
<path value="$PROJECT_DIR$/vendor/phpunit/php-text-template" />
<path value="$PROJECT_DIR$/vendor/phpunit/php-timer" />
<path value="$PROJECT_DIR$/vendor/seld/phar-utils" />
<path value="$PROJECT_DIR$/vendor/phpunit/php-token-stream" />
<path value="$PROJECT_DIR$/vendor/composer" />
<path value="$PROJECT_DIR$/vendor/phpunit/php-code-coverage" />
<path value="$PROJECT_DIR$/vendor/barryvdh/reflection-docblock" />
<path value="$PROJECT_DIR$/vendor/barryvdh/laravel-ide-helper" />
<path value="$PROJECT_DIR$/vendor/phpspec/prophecy" />
<path value="$PROJECT_DIR$/vendor/jakub-onderka/php-console-highlighter" />
<path value="$PROJECT_DIR$/vendor/jenssegers/date" />
<path value="$PROJECT_DIR$/vendor/jakub-onderka/php-console-color" />
<path value="$PROJECT_DIR$/vendor/league/flysystem" />
<path value="$PROJECT_DIR$/vendor/fideloper/proxy" />
<path value="$PROJECT_DIR$/vendor/vlucas/phpdotenv" />
<path value="$PROJECT_DIR$/vendor/psy/psysh" />
<path value="$PROJECT_DIR$/vendor/myclabs/deep-copy" />
<path value="$PROJECT_DIR$/vendor/symfony/debug" />
<path value="$PROJECT_DIR$/vendor/guzzlehttp/psr7" />
<path value="$PROJECT_DIR$/vendor/guzzlehttp/promises" />
<path value="$PROJECT_DIR$/vendor/phpunit/phpunit" />
<path value="$PROJECT_DIR$/vendor/symfony/console" />
<path value="$PROJECT_DIR$/vendor/symfony/process" />
<path value="$PROJECT_DIR$/vendor/guzzlehttp/guzzle" />
<path value="$PROJECT_DIR$/vendor/symfony/http-kernel" />
<path value="$PROJECT_DIR$/vendor/symfony/filesystem" />
<path value="$PROJECT_DIR$/vendor/seld/jsonlint" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php72" />
<path value="$PROJECT_DIR$/vendor/symfony/event-dispatcher" />
<path value="$PROJECT_DIR$/vendor/symfony/css-selector" />
<path value="$PROJECT_DIR$/vendor/doctrine/dbal" />
<path value="$PROJECT_DIR$/vendor/swiftmailer/swiftmailer" />
<path value="$PROJECT_DIR$/vendor/nikic/php-parser" />
<path value="$PROJECT_DIR$/vendor/symfony/finder" />
<path value="$PROJECT_DIR$/vendor/symfony/routing" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-mbstring" />
<path value="$PROJECT_DIR$/vendor/justinrainbow/json-schema" />
<path value="$PROJECT_DIR$/vendor/symfony/http-foundation" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-ctype" />
<path value="$PROJECT_DIR$/vendor/symfony/translation" />
<path value="$PROJECT_DIR$/vendor/paragonie/random_compat" />
<path value="$PROJECT_DIR$/vendor/symfony/var-dumper" />
<path value="$PROJECT_DIR$/vendor/psr/http-message" />
<path value="$PROJECT_DIR$/vendor/psr/log" />
<path value="$PROJECT_DIR$/vendor/dnoegel/php-xdg-base-dir" />
<path value="$PROJECT_DIR$/vendor/psr/container" />
<path value="$PROJECT_DIR$/vendor/psr/simple-cache" />
<path value="$PROJECT_DIR$/vendor/theseer/tokenizer" />
<path value="$PROJECT_DIR$/vendor/sebastian/comparator" />
<path value="$PROJECT_DIR$/vendor/sebastian/environment" />
<path value="$PROJECT_DIR$/vendor/sebastian/global-state" />
<path value="$PROJECT_DIR$/vendor/sebastian/object-enumerator" />
<path value="$PROJECT_DIR$/vendor/sebastian/object-reflector" />
<path value="$PROJECT_DIR$/vendor/laravel/tinker" />
<path value="$PROJECT_DIR$/vendor/sebastian/exporter" />
<path value="$PROJECT_DIR$/vendor/laravel/framework" />
<path value="$PROJECT_DIR$/vendor/sebastian/recursion-context" />
<path value="$PROJECT_DIR$/vendor/laravelcollective/html" />
<path value="$PROJECT_DIR$/vendor/egulias/email-validator" />
<path value="$PROJECT_DIR$/vendor/sebastian/diff" />
<path value="$PROJECT_DIR$/vendor/sebastian/version" />
<path value="$PROJECT_DIR$/vendor/filp/whoops" />
<path value="$PROJECT_DIR$/vendor/sebastian/resource-operations" />
<path value="$PROJECT_DIR$/vendor/sebastian/code-unit-reverse-lookup" />
<path value="$PROJECT_DIR$/vendor/intervention/image" />
<path value="$PROJECT_DIR$/vendor/webmozart/assert" />
<path value="$PROJECT_DIR$/vendor/yajra/laravel-datatables-oracle" />
<path value="$PROJECT_DIR$/vendor/fzaninotto/faker" />
<path value="$PROJECT_DIR$/vendor/tijsverkoyen/css-to-inline-styles" />
<path value="$PROJECT_DIR$/vendor/monolog/monolog" />
<path value="$PROJECT_DIR$/vendor/doctrine/event-manager" />
<path value="$PROJECT_DIR$/vendor/doctrine/inflector" />
<path value="$PROJECT_DIR$/vendor/doctrine/cache" />
<path value="$PROJECT_DIR$/vendor/doctrine/instantiator" />
<path value="$PROJECT_DIR$/vendor/ramsey/uuid" />
<path value="$PROJECT_DIR$/vendor/phar-io/manifest" />
<path value="$PROJECT_DIR$/vendor/doctrine/lexer" />
<path value="$PROJECT_DIR$/vendor/phar-io/version" />
<path value="$PROJECT_DIR$/vendor/nunomaduro/collision" />
<path value="$PROJECT_DIR$/vendor/nesbot/carbon" />
<path value="$PROJECT_DIR$/vendor/phpdocumentor/type-resolver" />
<path value="$PROJECT_DIR$/vendor/phpdocumentor/reflection-common" />
<path value="$PROJECT_DIR$/vendor/hamcrest/hamcrest-php" />
<path value="$PROJECT_DIR$/vendor/dragonmantank/cron-expression" />
<path value="$PROJECT_DIR$/vendor/phpdocumentor/reflection-docblock" />
<path value="$PROJECT_DIR$/vendor/cviebrock/eloquent-sluggable" />
<path value="$PROJECT_DIR$/vendor/ralouphie/getallheaders" />
<path value="$PROJECT_DIR$/vendor/askedio/laravel5-profanity-filter" />
<path value="$PROJECT_DIR$/vendor/symfony/mime" />
<path value="$PROJECT_DIR$/vendor/symfony/service-contracts" />
<path value="$PROJECT_DIR$/vendor/symfony/error-handler" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php73" />
<path value="$PROJECT_DIR$/vendor/symfony/translation-contracts" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-intl-idn" />
<path value="$PROJECT_DIR$/vendor/symfony/event-dispatcher-contracts" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-iconv" />
<path value="$PROJECT_DIR$/vendor/reliese/laravel" />
<path value="$PROJECT_DIR$/vendor/setasign/fpdf" />
<path value="$PROJECT_DIR$/vendor/setasign/fpdi" />
<path value="$PROJECT_DIR$/vendor/olimortimer/laravelshoppingcart" />
<path value="$PROJECT_DIR$/vendor/league/commonmark" />
<path value="$PROJECT_DIR$/vendor/opis/closure" />
<path value="$PROJECT_DIR$/vendor/phpoption/phpoption" />
<path value="$PROJECT_DIR$/vendor/maximebf/debugbar" />
<path value="$PROJECT_DIR$/vendor/laracasts/flash" />
<path value="$PROJECT_DIR$/vendor/cocur/slugify" />
<path value="$PROJECT_DIR$/vendor/sebastian/type" />
<path value="$PROJECT_DIR$/vendor/sebastian/code-unit" />
<path value="$PROJECT_DIR$/vendor/barryvdh/laravel-debugbar" />
<path value="$PROJECT_DIR$/vendor/phpunit/php-invoker" />
<path value="$PROJECT_DIR$/vendor/symfony/psr-http-message-bridge" />
<path value="$PROJECT_DIR$/vendor/laminas/laminas-diactoros" />
<path value="$PROJECT_DIR$/vendor/laminas/laminas-zendframework-bridge" />
<path value="$PROJECT_DIR$/vendor/dompdf/dompdf" />
<path value="$PROJECT_DIR$/vendor/php-http/message-factory" />
<path value="$PROJECT_DIR$/vendor/lcobucci/jwt" />
<path value="$PROJECT_DIR$/vendor/laravel/passport" />
<path value="$PROJECT_DIR$/vendor/laravel/helpers" />
<path value="$PROJECT_DIR$/vendor/nyholm/psr7" />
<path value="$PROJECT_DIR$/vendor/phenx/php-font-lib" />
<path value="$PROJECT_DIR$/vendor/phenx/php-svg-lib" />
<path value="$PROJECT_DIR$/vendor/defuse/php-encryption" />
<path value="$PROJECT_DIR$/vendor/firebase/php-jwt" />
<path value="$PROJECT_DIR$/vendor/sabberworm/php-css-parser" />
<path value="$PROJECT_DIR$/vendor/phpseclib/phpseclib" />
<path value="$PROJECT_DIR$/vendor/league/event" />
<path value="$PROJECT_DIR$/vendor/league/oauth2-server" />
<path value="$PROJECT_DIR$/vendor/psr/http-factory" />
<path value="$PROJECT_DIR$/vendor/barryvdh/laravel-dompdf" />
<path value="$PROJECT_DIR$/vendor/phpoffice/phpspreadsheet" />
<path value="$PROJECT_DIR$/vendor/maatwebsite/excel" />
<path value="$PROJECT_DIR$/vendor/markbaker/matrix" />
<path value="$PROJECT_DIR$/vendor/markbaker/complex" />
</include_path>
</component>
<component name="ProjectId" id="1Ply2ASLtUbE38LpjzejPOnh0np" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
<ConfirmationsSetting value="2" id="Add" />
</component>
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="ASKED_ADD_EXTERNAL_FILES" value="true" />
<property name="DatabaseDriversLRU" value="mysql" />
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/resources/views/user/shop/sales" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
<property name="nodejs_package_manager_path" value="npm" />
<property name="settings.editor.selected.configurable" value="preferences.pluginManager" />
<property name="vue.rearranger.settings.migration" value="true" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/resources/views/user/shop/sales" />
<recent name="$PROJECT_DIR$/resources/views/emails" />
<recent name="$PROJECT_DIR$/resources/views/admin/sales" />
<recent name="$PROJECT_DIR$/resources/views/user/homeparty" />
<recent name="$PROJECT_DIR$/app/Services" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/resources/views/user/order" />
<recent name="$PROJECT_DIR$/resources/views/user/customer" />
<recent name="$PROJECT_DIR$/public/vendor/libs/dropzone" />
<recent name="$PROJECT_DIR$/public/vendor/libs" />
<recent name="$PROJECT_DIR$/resources/views/admin/user" />
</key>
</component>
<component name="RunManager" selected="Shell Script.composer-post-update.sh">
<configuration name="de" type="PHPUnitRunConfigurationType" factoryName="PHPUnit">
<TestRunner directory="$PROJECT_DIR$/resources/lang/de" />
<method v="2" />
</configuration>
<configuration default="true" type="ShConfigurationType">
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="$USER_HOME$/Documents/scripts/composer-post-update.sh" />
<option name="SCRIPT_OPTIONS" value="" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="/bin/bash" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="EXECUTE_IN_TERMINAL" value="true" />
<envs />
<method v="2" />
</configuration>
<configuration name="composer-post-update.sh" type="ShConfigurationType">
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="$USER_HOME$/Documents/scripts/composer-post-update.sh" />
<option name="SCRIPT_OPTIONS" value="" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="/bin/bash" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="EXECUTE_IN_TERMINAL" value="true" />
<envs />
<method v="2" />
</configuration>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="2fbaac5f-25ba-4502-a970-cc14728d7d55" name="Default Changelist" comment="" />
<created>1537353993493</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1537353993493</updated>
<workItem from="1537353995669" duration="3800000" />
<workItem from="1540127177718" duration="362000" />
<workItem from="1540127554029" duration="2000" />
<workItem from="1540127581792" duration="7784000" />
<workItem from="1542210149879" duration="9736000" />
<workItem from="1542297086254" duration="9567000" />
<workItem from="1542406540801" duration="9615000" />
<workItem from="1542727683895" duration="12063000" />
<workItem from="1542787061822" duration="2626000" />
<workItem from="1542806743382" duration="5489000" />
<workItem from="1542890756312" duration="12280000" />
<workItem from="1543070248579" duration="2602000" />
<workItem from="1543233637816" duration="18000" />
<workItem from="1544822014608" duration="4694000" />
<workItem from="1544829993268" duration="5406000" />
<workItem from="1546523595056" duration="30055000" />
<workItem from="1546704135920" duration="19864000" />
<workItem from="1546806383318" duration="9637000" />
<workItem from="1547205813997" duration="946000" />
<workItem from="1547208157542" duration="108000" />
<workItem from="1547214977808" duration="3425000" />
<workItem from="1547480630058" duration="1000" />
<workItem from="1547484887720" duration="1609000" />
<workItem from="1547540787341" duration="1640000" />
<workItem from="1547724573711" duration="736000" />
<workItem from="1548058316947" duration="24674000" />
<workItem from="1548143988826" duration="810000" />
<workItem from="1548231704434" duration="1070000" />
<workItem from="1548773013181" duration="1000" />
<workItem from="1549468946720" duration="8000" />
<workItem from="1550313918368" duration="329000" />
<workItem from="1550314558764" duration="1097000" />
<workItem from="1550498022950" duration="3845000" />
<workItem from="1550674465433" duration="14138000" />
<workItem from="1550736184159" duration="1000" />
<workItem from="1550765848683" duration="10855000" />
<workItem from="1550838986113" duration="11950000" />
<workItem from="1550935201261" duration="6226000" />
<workItem from="1551181680267" duration="14089000" />
<workItem from="1551261197445" duration="32000" />
<workItem from="1551277131077" duration="11095000" />
<workItem from="1551354000907" duration="15584000" />
<workItem from="1551429281485" duration="275000" />
<workItem from="1551429580227" duration="2056000" />
<workItem from="1551436264383" duration="33071000" />
<workItem from="1551522312534" duration="3206000" />
<workItem from="1551526048926" duration="2305000" />
<workItem from="1551530777330" duration="3050000" />
<workItem from="1551712620909" duration="2498000" />
<workItem from="1551962594785" duration="3948000" />
<workItem from="1552133587503" duration="961000" />
<workItem from="1552134613344" duration="6000" />
<workItem from="1552135056549" duration="494000" />
<workItem from="1552403932079" duration="1027000" />
<workItem from="1552405331969" duration="881000" />
<workItem from="1552473972131" duration="2992000" />
<workItem from="1552477317174" duration="722000" />
<workItem from="1552481695438" duration="231000" />
<workItem from="1552482684973" duration="1481000" />
<workItem from="1552485686862" duration="497000" />
<workItem from="1553078315005" duration="42000" />
<workItem from="1553172339375" duration="754000" />
<workItem from="1553174858066" duration="22000" />
<workItem from="1553175700548" duration="116000" />
<workItem from="1553176149267" duration="34000" />
<workItem from="1553687920206" duration="395000" />
<workItem from="1553692408844" duration="6000" />
<workItem from="1553694116510" duration="350000" />
<workItem from="1553694855934" duration="1157000" />
<workItem from="1553708521909" duration="492000" />
<workItem from="1555429292695" duration="630000" />
<workItem from="1555490678820" duration="3921000" />
<workItem from="1556891567027" duration="851000" />
<workItem from="1560255951776" duration="539000" />
<workItem from="1561993809455" duration="29000" />
<workItem from="1566462771075" duration="8798000" />
<workItem from="1566975548985" duration="1435000" />
<workItem from="1568115248448" duration="7659000" />
<workItem from="1573475266384" duration="174000" />
<workItem from="1573475447829" duration="81000" />
<workItem from="1573480792424" duration="1748000" />
<workItem from="1573806280308" duration="772000" />
<workItem from="1574173803219" duration="19000" />
<workItem from="1574495107293" duration="2126000" />
<workItem from="1574498597084" duration="18390000" />
<workItem from="1574870171463" duration="442000" />
<workItem from="1575135233364" duration="233000" />
<workItem from="1577966622446" duration="15215000" />
<workItem from="1578042899454" duration="15408000" />
<workItem from="1578069761418" duration="55000" />
<workItem from="1578070274627" duration="66000" />
<workItem from="1578493675622" duration="10000" />
<workItem from="1578493690816" duration="11299000" />
<workItem from="1578672302747" duration="1742000" />
<workItem from="1578831425036" duration="6019000" />
<workItem from="1578928076715" duration="559000" />
<workItem from="1579028224750" duration="42000" />
<workItem from="1580139983493" duration="1049000" />
<workItem from="1581156718221" duration="27110000" />
<workItem from="1581245547669" duration="5492000" />
<workItem from="1581502538849" duration="2174000" />
<workItem from="1581517312628" duration="9759000" />
<workItem from="1581604452585" duration="5853000" />
<workItem from="1581686945791" duration="4486000" />
<workItem from="1581691515338" duration="19033000" />
<workItem from="1582045337297" duration="7000" />
<workItem from="1582975911467" duration="18419000" />
<workItem from="1583498764097" duration="142000" />
<workItem from="1583572250584" duration="19295000" />
<workItem from="1583743438432" duration="10157000" />
<workItem from="1583757303144" duration="7000" />
<workItem from="1583758271548" duration="2118000" />
<workItem from="1584782149779" duration="14772000" />
<workItem from="1584954914592" duration="54000" />
<workItem from="1584965547046" duration="694000" />
<workItem from="1585396827913" duration="1986000" />
<workItem from="1585400638388" duration="9592000" />
<workItem from="1585576417290" duration="2940000" />
<workItem from="1585666412873" duration="6324000" />
<workItem from="1585729859738" duration="21452000" />
<workItem from="1585760254632" duration="571000" />
<workItem from="1587107320088" duration="1592000" />
<workItem from="1587109717986" duration="1617000" />
<workItem from="1587749609220" duration="1211000" />
<workItem from="1587975636191" duration="17000" />
<workItem from="1588146697363" duration="6072000" />
<workItem from="1588153881658" duration="6306000" />
<workItem from="1588167994966" duration="10515000" />
<workItem from="1588231371983" duration="3000" />
<workItem from="1588233321074" duration="6060000" />
<workItem from="1588244040497" duration="547000" />
<workItem from="1588244809449" duration="10424000" />
<workItem from="1588267918069" duration="1856000" />
<workItem from="1588410019835" duration="194000" />
<workItem from="1588411442653" duration="11498000" />
<workItem from="1588427157422" duration="5582000" />
<workItem from="1588577728345" duration="8457000" />
<workItem from="1588597117898" duration="3955000" />
<workItem from="1588604782047" duration="6478000" />
<workItem from="1588667412409" duration="3521000" />
<workItem from="1588753513112" duration="331000" />
<workItem from="1588754727146" duration="6339000" />
<workItem from="1588761249067" duration="27000" />
<workItem from="1588761617312" duration="1790000" />
<workItem from="1588771915210" duration="5000" />
<workItem from="1588778353962" duration="35000" />
<workItem from="1588779256522" duration="57000" />
<workItem from="1588921253853" duration="2440000" />
<workItem from="1589023916958" duration="245000" />
<workItem from="1589355379810" duration="20000" />
<workItem from="1589365636618" duration="4232000" />
<workItem from="1589442905154" duration="21886000" />
<workItem from="1589474488991" duration="3220000" />
<workItem from="1589526578461" duration="28000" />
<workItem from="1589881416788" duration="7714000" />
<workItem from="1589891829781" duration="681000" />
<workItem from="1589892673376" duration="9169000" />
<workItem from="1589902453020" duration="273000" />
<workItem from="1589974449247" duration="240000" />
<workItem from="1590758073413" duration="5869000" />
<workItem from="1590826972537" duration="2356000" />
<workItem from="1590829892402" duration="8158000" />
<workItem from="1591187714339" duration="7341000" />
<workItem from="1591361845658" duration="2000" />
<workItem from="1591619467115" duration="326000" />
<workItem from="1591864110935" duration="4671000" />
<workItem from="1591868858012" duration="15798000" />
<workItem from="1591889648864" duration="8510000" />
<workItem from="1591959307471" duration="5000" />
<workItem from="1591959326440" duration="5517000" />
<workItem from="1592132838802" duration="47000" />
<workItem from="1592134604562" duration="347000" />
<workItem from="1592134995936" duration="7000" />
<workItem from="1592135066330" duration="179000" />
<workItem from="1592831744708" duration="9000" />
<workItem from="1592831761021" duration="3000" />
<workItem from="1592905155133" duration="2081000" />
<workItem from="1593539130650" duration="5379000" />
<workItem from="1593607978036" duration="4673000" />
<workItem from="1594295945600" duration="612000" />
<workItem from="1594721064087" duration="5912000" />
<workItem from="1594733233309" duration="1305000" />
<workItem from="1595674257808" duration="9321000" />
<workItem from="1595923785716" duration="1023000" />
<workItem from="1595948227650" duration="1138000" />
<workItem from="1595949374319" duration="4908000" />
<workItem from="1596107641527" duration="35000" />
<workItem from="1596107688024" duration="1943000" />
<workItem from="1596111667880" duration="6240000" />
<workItem from="1596119318253" duration="10939000" />
<workItem from="1596188575338" duration="7868000" />
<workItem from="1596268902765" duration="165000" />
<workItem from="1596269074069" duration="69000" />
<workItem from="1596802450904" duration="6190000" />
<workItem from="1596873885106" duration="22962000" />
<workItem from="1597138806746" duration="5000" />
<workItem from="1597216110022" duration="32246000" />
<workItem from="1597299830339" duration="2158000" />
<workItem from="1597313688277" duration="5656000" />
<workItem from="1597410738317" duration="11162000" />
<workItem from="1597658985953" duration="2000" />
<workItem from="1597928402978" duration="7140000" />
<workItem from="1598016608485" duration="9648000" />
<workItem from="1598255562481" duration="22043000" />
<workItem from="1598282618629" duration="1154000" />
<workItem from="1598434849256" duration="514000" />
<workItem from="1598971116331" duration="4130000" />
<workItem from="1599033832974" duration="4000" />
<workItem from="1599558681455" duration="23060000" />
<workItem from="1599633110239" duration="250000" />
<workItem from="1600079440472" duration="408000" />
<workItem from="1600096831480" duration="2472000" />
<workItem from="1600175774205" duration="25000" />
<workItem from="1600179917484" duration="407000" />
<workItem from="1600328859516" duration="262000" />
<workItem from="1602762026312" duration="11122000" />
<workItem from="1602831799597" duration="12765000" />
<workItem from="1602854134928" duration="3330000" />
<workItem from="1602857574059" duration="218000" />
<workItem from="1603107642331" duration="5950000" />
<workItem from="1603264695225" duration="33000" />
<workItem from="1603272469212" duration="17000" />
<workItem from="1603730718098" duration="118000" />
<workItem from="1603985533656" duration="12738000" />
<workItem from="1604392770203" duration="27000" />
<workItem from="1604419165739" duration="43000" />
<workItem from="1604503127063" duration="71000" />
<workItem from="1604507908338" duration="28000" />
<workItem from="1604507968294" duration="8000" />
<workItem from="1604921993804" duration="1271000" />
<workItem from="1604923532802" duration="515000" />
<workItem from="1604939815128" duration="6462000" />
<workItem from="1605006776997" duration="3000" />
<workItem from="1605201129884" duration="22000" />
<workItem from="1605201310540" duration="157000" />
<workItem from="1605599347354" duration="281000" />
<workItem from="1608113166691" duration="26421000" />
<workItem from="1608198795441" duration="30640000" />
<workItem from="1608482656314" duration="1180000" />
<workItem from="1609845987050" duration="8455000" />
<workItem from="1609856766161" duration="7420000" />
<workItem from="1609921488733" duration="11747000" />
<workItem from="1609951522474" duration="3068000" />
<workItem from="1610017442331" duration="599000" />
<workItem from="1610105883226" duration="2999000" />
<workItem from="1610111682841" duration="993000" />
<workItem from="1610113229757" duration="58000" />
<workItem from="1610114243791" duration="73000" />
<workItem from="1610708369185" duration="36000" />
<workItem from="1610709005944" duration="206000" />
<workItem from="1610709247428" duration="439000" />
<workItem from="1610718553130" duration="104000" />
<workItem from="1610729780780" duration="23000" />
<workItem from="1610990236245" duration="284000" />
<workItem from="1611071419100" duration="35000" />
<workItem from="1611138964858" duration="11000" />
</task>
<servers />
</component>
<component name="TodoView">
<todo-panel id="selected-file">
<is-autoscroll-to-source value="true" />
</todo-panel>
<todo-panel id="all">
<are-packages-shown value="true" />
<is-autoscroll-to-source value="true" />
</todo-panel>
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
<option name="oldMeFiltersMigrated" value="true" />
</component>
</project>

View file

@ -58,7 +58,7 @@ namespace PHPSTORM_META {
'JoeDixon\Translation\Scanner' => \JoeDixon\Translation\Scanner::class,
'Laracasts\Flash\SessionStore' => \Laracasts\Flash\LaravelSessionStore::class,
'Laravel\Passport\ClientRepository' => \Laravel\Passport\ClientRepository::class,
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Parser::class,
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Token\Parser::class,
'League\OAuth2\Server\AuthorizationServer' => \League\OAuth2\Server\AuthorizationServer::class,
'League\OAuth2\Server\ResourceServer' => \League\OAuth2\Server\ResourceServer::class,
'Maatwebsite\Excel\Cache\CacheManager' => \Maatwebsite\Excel\Cache\CacheManager::class,
@ -265,7 +265,7 @@ namespace PHPSTORM_META {
'JoeDixon\Translation\Scanner' => \JoeDixon\Translation\Scanner::class,
'Laracasts\Flash\SessionStore' => \Laracasts\Flash\LaravelSessionStore::class,
'Laravel\Passport\ClientRepository' => \Laravel\Passport\ClientRepository::class,
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Parser::class,
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Token\Parser::class,
'League\OAuth2\Server\AuthorizationServer' => \League\OAuth2\Server\AuthorizationServer::class,
'League\OAuth2\Server\ResourceServer' => \League\OAuth2\Server\ResourceServer::class,
'Maatwebsite\Excel\Cache\CacheManager' => \Maatwebsite\Excel\Cache\CacheManager::class,
@ -472,7 +472,7 @@ namespace PHPSTORM_META {
'JoeDixon\Translation\Scanner' => \JoeDixon\Translation\Scanner::class,
'Laracasts\Flash\SessionStore' => \Laracasts\Flash\LaravelSessionStore::class,
'Laravel\Passport\ClientRepository' => \Laravel\Passport\ClientRepository::class,
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Parser::class,
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Token\Parser::class,
'League\OAuth2\Server\AuthorizationServer' => \League\OAuth2\Server\AuthorizationServer::class,
'League\OAuth2\Server\ResourceServer' => \League\OAuth2\Server\ResourceServer::class,
'Maatwebsite\Excel\Cache\CacheManager' => \Maatwebsite\Excel\Cache\CacheManager::class,
@ -679,7 +679,7 @@ namespace PHPSTORM_META {
'JoeDixon\Translation\Scanner' => \JoeDixon\Translation\Scanner::class,
'Laracasts\Flash\SessionStore' => \Laracasts\Flash\LaravelSessionStore::class,
'Laravel\Passport\ClientRepository' => \Laravel\Passport\ClientRepository::class,
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Parser::class,
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Token\Parser::class,
'League\OAuth2\Server\AuthorizationServer' => \League\OAuth2\Server\AuthorizationServer::class,
'League\OAuth2\Server\ResourceServer' => \League\OAuth2\Server\ResourceServer::class,
'Maatwebsite\Excel\Cache\CacheManager' => \Maatwebsite\Excel\Cache\CacheManager::class,
@ -886,7 +886,7 @@ namespace PHPSTORM_META {
'JoeDixon\Translation\Scanner' => \JoeDixon\Translation\Scanner::class,
'Laracasts\Flash\SessionStore' => \Laracasts\Flash\LaravelSessionStore::class,
'Laravel\Passport\ClientRepository' => \Laravel\Passport\ClientRepository::class,
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Parser::class,
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Token\Parser::class,
'League\OAuth2\Server\AuthorizationServer' => \League\OAuth2\Server\AuthorizationServer::class,
'League\OAuth2\Server\ResourceServer' => \League\OAuth2\Server\ResourceServer::class,
'Maatwebsite\Excel\Cache\CacheManager' => \Maatwebsite\Excel\Cache\CacheManager::class,
@ -1093,7 +1093,7 @@ namespace PHPSTORM_META {
'JoeDixon\Translation\Scanner' => \JoeDixon\Translation\Scanner::class,
'Laracasts\Flash\SessionStore' => \Laracasts\Flash\LaravelSessionStore::class,
'Laravel\Passport\ClientRepository' => \Laravel\Passport\ClientRepository::class,
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Parser::class,
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Token\Parser::class,
'League\OAuth2\Server\AuthorizationServer' => \League\OAuth2\Server\AuthorizationServer::class,
'League\OAuth2\Server\ResourceServer' => \League\OAuth2\Server\ResourceServer::class,
'Maatwebsite\Excel\Cache\CacheManager' => \Maatwebsite\Excel\Cache\CacheManager::class,
@ -1300,7 +1300,7 @@ namespace PHPSTORM_META {
'JoeDixon\Translation\Scanner' => \JoeDixon\Translation\Scanner::class,
'Laracasts\Flash\SessionStore' => \Laracasts\Flash\LaravelSessionStore::class,
'Laravel\Passport\ClientRepository' => \Laravel\Passport\ClientRepository::class,
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Parser::class,
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Token\Parser::class,
'League\OAuth2\Server\AuthorizationServer' => \League\OAuth2\Server\AuthorizationServer::class,
'League\OAuth2\Server\ResourceServer' => \League\OAuth2\Server\ResourceServer::class,
'Maatwebsite\Excel\Cache\CacheManager' => \Maatwebsite\Excel\Cache\CacheManager::class,
@ -1507,7 +1507,7 @@ namespace PHPSTORM_META {
'JoeDixon\Translation\Scanner' => \JoeDixon\Translation\Scanner::class,
'Laracasts\Flash\SessionStore' => \Laracasts\Flash\LaravelSessionStore::class,
'Laravel\Passport\ClientRepository' => \Laravel\Passport\ClientRepository::class,
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Parser::class,
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Token\Parser::class,
'League\OAuth2\Server\AuthorizationServer' => \League\OAuth2\Server\AuthorizationServer::class,
'League\OAuth2\Server\ResourceServer' => \League\OAuth2\Server\ResourceServer::class,
'Maatwebsite\Excel\Cache\CacheManager' => \Maatwebsite\Excel\Cache\CacheManager::class,
@ -1714,7 +1714,7 @@ namespace PHPSTORM_META {
'JoeDixon\Translation\Scanner' => \JoeDixon\Translation\Scanner::class,
'Laracasts\Flash\SessionStore' => \Laracasts\Flash\LaravelSessionStore::class,
'Laravel\Passport\ClientRepository' => \Laravel\Passport\ClientRepository::class,
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Parser::class,
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Token\Parser::class,
'League\OAuth2\Server\AuthorizationServer' => \League\OAuth2\Server\AuthorizationServer::class,
'League\OAuth2\Server\ResourceServer' => \League\OAuth2\Server\ResourceServer::class,
'Maatwebsite\Excel\Cache\CacheManager' => \Maatwebsite\Excel\Cache\CacheManager::class,
@ -1921,7 +1921,7 @@ namespace PHPSTORM_META {
'JoeDixon\Translation\Scanner' => \JoeDixon\Translation\Scanner::class,
'Laracasts\Flash\SessionStore' => \Laracasts\Flash\LaravelSessionStore::class,
'Laravel\Passport\ClientRepository' => \Laravel\Passport\ClientRepository::class,
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Parser::class,
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Token\Parser::class,
'League\OAuth2\Server\AuthorizationServer' => \League\OAuth2\Server\AuthorizationServer::class,
'League\OAuth2\Server\ResourceServer' => \League\OAuth2\Server\ResourceServer::class,
'Maatwebsite\Excel\Cache\CacheManager' => \Maatwebsite\Excel\Cache\CacheManager::class,
@ -2128,7 +2128,7 @@ namespace PHPSTORM_META {
'JoeDixon\Translation\Scanner' => \JoeDixon\Translation\Scanner::class,
'Laracasts\Flash\SessionStore' => \Laracasts\Flash\LaravelSessionStore::class,
'Laravel\Passport\ClientRepository' => \Laravel\Passport\ClientRepository::class,
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Parser::class,
'Lcobucci\JWT\Parser' => \Lcobucci\JWT\Token\Parser::class,
'League\OAuth2\Server\AuthorizationServer' => \League\OAuth2\Server\AuthorizationServer::class,
'League\OAuth2\Server\ResourceServer' => \League\OAuth2\Server\ResourceServer::class,
'Maatwebsite\Excel\Cache\CacheManager' => \Maatwebsite\Excel\Cache\CacheManager::class,

View file

@ -4,7 +4,7 @@
/**
* A helper file for Laravel, to provide autocomplete information to your IDE
* Generated for Laravel 8.83.27.
* Generated for Laravel 8.83.29.
*
* This file should not be included in your code, only analyzed by your IDE!
*
@ -712,7 +712,7 @@
* @param int $code
* @param string $message
* @param array $headers
* @return \Illuminate\Foundation\never
* @return never
* @throws \Symfony\Component\HttpKernel\Exception\HttpException
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
* @static
@ -1173,7 +1173,7 @@
* Resolve all of the bindings for a given tag.
*
* @param string $tag
* @return \Illuminate\Container\iterable
* @return iterable
* @static
*/
public static function tagged($tag)
@ -3503,10 +3503,10 @@
/**
* Obtains multiple cache items by their unique keys.
*
* @return \Illuminate\Cache\iterable
* @param \Psr\SimpleCache\iterable $keys A list of keys that can obtained in a single operation.
* @return iterable
* @param iterable $keys A list of keys that can obtained in a single operation.
* @param mixed $default Default value to return for keys that do not exist.
* @return \Psr\SimpleCache\iterable A list of key => value pairs. Cache keys that do not exist or are stale will have $default as value.
* @return iterable A list of key => value pairs. Cache keys that do not exist or are stale will have $default as value.
* @throws \Psr\SimpleCache\InvalidArgumentException
* MUST be thrown if $keys is neither an array nor a Traversable,
* or if any of the $keys are not a legal value.
@ -3580,7 +3580,7 @@
* Persists a set of key => value pairs in the cache, with an optional TTL.
*
* @return bool
* @param \Psr\SimpleCache\iterable $values A list of key => value pairs for a multiple-set operation.
* @param iterable $values A list of key => value pairs for a multiple-set operation.
* @param null|int|\DateInterval $ttl Optional. The TTL value of this item. If no value is sent and
* the driver supports TTL then the library may set a default value
* for it or let the driver take care of that.
@ -3719,7 +3719,7 @@
* Deletes multiple cache items in a single operation.
*
* @return bool
* @param \Psr\SimpleCache\iterable $keys A list of string-based keys to be deleted.
* @param iterable $keys A list of string-based keys to be deleted.
* @return bool True if the items were successfully removed. False if there was an error.
* @throws \Psr\SimpleCache\InvalidArgumentException
* MUST be thrown if $keys is neither an array nor a Traversable,
@ -6587,7 +6587,7 @@
/**
* Determine if all of the given abilities should be granted for the current user.
*
* @param \Illuminate\Auth\Access\iterable|string $abilities
* @param iterable|string $abilities
* @param array|mixed $arguments
* @return bool
* @static
@ -6600,7 +6600,7 @@
/**
* Determine if any one of the given abilities should be granted for the current user.
*
* @param \Illuminate\Auth\Access\iterable|string $abilities
* @param iterable|string $abilities
* @param array|mixed $arguments
* @return bool
* @static
@ -6613,7 +6613,7 @@
/**
* Determine if all of the given abilities should be denied for the current user.
*
* @param \Illuminate\Auth\Access\iterable|string $abilities
* @param iterable|string $abilities
* @param array|mixed $arguments
* @return bool
* @static
@ -9596,6 +9596,7 @@
* @param array $server The server parameters ($_SERVER)
* @param string|resource|null $content The raw body data
* @return static
* @throws BadRequestException When the URI is invalid
* @static
*/
public static function create($uri, $method = 'GET', $parameters = [], $cookies = [], $files = [], $server = [], $content = null)
@ -9765,7 +9766,7 @@
*
*
* @internal
* @param \Symfony\Component\HttpFoundation\callable(): SessionInterface $factory
* @param callable(): SessionInterface $factory
* @static
*/
public static function setSessionFactory($factory)
@ -17682,9 +17683,10 @@
/**
*
*
* @param string|null $disk Fallback for usage with named properties
* @param object $export
* @param string $filePath
* @param string|null $disk
* @param string|null $diskName
* @param string $writerType
* @param mixed $diskOptions
* @return bool
@ -17692,10 +17694,10 @@
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
* @static
*/
public static function store($export, $filePath, $diskName = null, $writerType = null, $diskOptions = [])
public static function store($export, $filePath, $diskName = null, $writerType = null, $diskOptions = [], $disk = null)
{
/** @var \Maatwebsite\Excel\Excel $instance */
return $instance->store($export, $filePath, $diskName, $writerType, $diskOptions);
return $instance->store($export, $filePath, $diskName, $writerType, $diskOptions, $disk);
}
/**
*
@ -17785,6 +17787,52 @@
{
/** @var \Maatwebsite\Excel\Excel $instance */
return $instance->queueImport($import, $filePath, $disk, $readerType);
}
/**
* Register a custom macro.
*
* @param string $name
* @param object|callable $macro
* @return void
* @static
*/
public static function macro($name, $macro)
{
\Maatwebsite\Excel\Excel::macro($name, $macro);
}
/**
* Mix another object into the class.
*
* @param object $mixin
* @param bool $replace
* @return void
* @throws \ReflectionException
* @static
*/
public static function mixin($mixin, $replace = true)
{
\Maatwebsite\Excel\Excel::mixin($mixin, $replace);
}
/**
* Checks if macro is registered.
*
* @param string $name
* @return bool
* @static
*/
public static function hasMacro($name)
{
return \Maatwebsite\Excel\Excel::hasMacro($name);
}
/**
* Flush the existing macros.
*
* @return void
* @static
*/
public static function flushMacros()
{
\Maatwebsite\Excel\Excel::flushMacros();
}
/**
*
@ -18180,7 +18228,7 @@
*
* @static
*/
public static function setShippingCountryWithPrice($shipping_country_id, $shipping_is_for = 'ot')
public static function setShippingCountryWithPrice($shipping_country_id, $shipping_is_for = 'ot-member')
{
/** @var \App\Services\Yard $instance */
return $instance->setShippingCountryWithPrice($shipping_country_id, $shipping_is_for);
@ -18715,10 +18763,10 @@
* @return void
* @static
*/
public static function restore($identifier, $eventOptions = [])
public static function restore($identifier, $eventOptions = [], $delteStoredCart = true)
{ //Method inherited from \Gloudemans\Shoppingcart\Cart
/** @var \App\Services\Yard $instance */
$instance->restore($identifier, $eventOptions);
$instance->restore($identifier, $eventOptions, $delteStoredCart);
}
/**
* Gets a specific fee from the fees array.
@ -18817,6 +18865,28 @@
{ //Method inherited from \Gloudemans\Shoppingcart\Cart
/** @var \App\Services\Yard $instance */
return $instance->fromArray($array);
}
/**
* Deletes the stored cart with given identifier
*
* @param mixed $identifier
* @static
*/
public static function deleteStoredCart($identifier)
{ //Method inherited from \Gloudemans\Shoppingcart\Cart
/** @var \App\Services\Yard $instance */
return $instance->deleteStoredCart($identifier);
}
/**
* Get the carts content, if there is no cart content set yet, return a new empty Collection
*
* @return \Illuminate\Support\Collection
* @static
*/
public static function getContent()
{ //Method inherited from \Gloudemans\Shoppingcart\Cart
/** @var \App\Services\Yard $instance */
return $instance->getContent();
}
}
@ -19093,7 +19163,7 @@
/**
* Returns an array of all data collectors
*
* @return \DebugBar\array[DataCollectorInterface]
* @return array[DataCollectorInterface]
* @static
*/
public static function getCollectors()
@ -19364,17 +19434,23 @@
/**
*
*
* @method static \Barryvdh\DomPDF\PDF setPaper($paper, $orientation = 'portrait')
* @method static \Barryvdh\DomPDF\PDF setBaseHost(string $baseHost)
* @method static \Barryvdh\DomPDF\PDF setProtocol(string $protocol)
* @method static \Barryvdh\DomPDF\PDF setHttpContext($httpContext)
* @method static \Barryvdh\DomPDF\PDF setCallbacks(array $callbacks)
* @method static BasePDF setBaseHost(string $baseHost)
* @method static BasePDF setBasePath(string $basePath)
* @method static BasePDF setCanvas(\Dompdf\Canvas $canvas)
* @method static BasePDF setCallbacks(array $callbacks)
* @method static BasePDF setCss(\Dompdf\Css\Stylesheet $css)
* @method static BasePDF setDefaultView(string $defaultView, array $options)
* @method static BasePDF setDom(\DOMDocument $dom)
* @method static BasePDF setFontMetrics(\Dompdf\FontMetrics $fontMetrics)
* @method static BasePDF setHttpContext(resource|array $httpContext)
* @method static BasePDF setPaper(string|float[] $paper, string $orientation = 'portrait')
* @method static BasePDF setProtocol(string $protocol)
* @method static BasePDF setTree(\Dompdf\Frame\FrameTree $tree)
*/
class Pdf {
/**
* Get the DomPDF instance
*
* @return \Dompdf\Dompdf
* @static
*/
public static function getDomPDF()
@ -19417,7 +19493,6 @@
* Add metadata info
*
* @param array<string, string> $info
* @return static
* @static
*/
public static function addInfo($info)
@ -19443,7 +19518,6 @@
*
* @param array<string, mixed>|string $attribute
* @param null|mixed $value
* @return \Barryvdh\DomPDF\PDF
* @static
*/
public static function setOption($attribute, $value = null)
@ -19454,14 +19528,13 @@
/**
* Replace all the Options from DomPDF
*
* @deprecated Use setOption to override individual options.
* @param array<string, mixed> $options
* @static
*/
public static function setOptions($options)
public static function setOptions($options, $mergeWithDefaults = false)
{
/** @var \Barryvdh\DomPDF\PDF $instance */
return $instance->setOptions($options);
return $instance->setOptions($options, $mergeWithDefaults);
}
/**
* Output the PDF as a string.
@ -19536,17 +19609,23 @@
/**
*
*
* @method static \Barryvdh\DomPDF\PDF setPaper($paper, $orientation = 'portrait')
* @method static \Barryvdh\DomPDF\PDF setBaseHost(string $baseHost)
* @method static \Barryvdh\DomPDF\PDF setProtocol(string $protocol)
* @method static \Barryvdh\DomPDF\PDF setHttpContext($httpContext)
* @method static \Barryvdh\DomPDF\PDF setCallbacks(array $callbacks)
* @method static BasePDF setBaseHost(string $baseHost)
* @method static BasePDF setBasePath(string $basePath)
* @method static BasePDF setCanvas(\Dompdf\Canvas $canvas)
* @method static BasePDF setCallbacks(array $callbacks)
* @method static BasePDF setCss(\Dompdf\Css\Stylesheet $css)
* @method static BasePDF setDefaultView(string $defaultView, array $options)
* @method static BasePDF setDom(\DOMDocument $dom)
* @method static BasePDF setFontMetrics(\Dompdf\FontMetrics $fontMetrics)
* @method static BasePDF setHttpContext(resource|array $httpContext)
* @method static BasePDF setPaper(string|float[] $paper, string $orientation = 'portrait')
* @method static BasePDF setProtocol(string $protocol)
* @method static BasePDF setTree(\Dompdf\Frame\FrameTree $tree)
*/
class Pdf {
/**
* Get the DomPDF instance
*
* @return \Dompdf\Dompdf
* @static
*/
public static function getDomPDF()
@ -19589,7 +19668,6 @@
* Add metadata info
*
* @param array<string, string> $info
* @return static
* @static
*/
public static function addInfo($info)
@ -19615,7 +19693,6 @@
*
* @param array<string, mixed>|string $attribute
* @param null|mixed $value
* @return \Barryvdh\DomPDF\PDF
* @static
*/
public static function setOption($attribute, $value = null)
@ -19626,14 +19703,13 @@
/**
* Replace all the Options from DomPDF
*
* @deprecated Use setOption to override individual options.
* @param array<string, mixed> $options
* @static
*/
public static function setOptions($options)
public static function setOptions($options, $mergeWithDefaults = false)
{
/** @var \Barryvdh\DomPDF\PDF $instance */
return $instance->setOptions($options);
return $instance->setOptions($options, $mergeWithDefaults);
}
/**
* Output the PDF as a string.
@ -20239,7 +20315,7 @@
/**
*
*
* @see \Maatwebsite\Excel\Mixins\DownloadCollection::downloadExcel()
* @see \Maatwebsite\Excel\Mixins\DownloadCollectionMixin::downloadExcel()
* @param string $fileName
* @param string|null $writerType
* @param mixed $withHeadings
@ -20253,7 +20329,7 @@
/**
*
*
* @see \Maatwebsite\Excel\Mixins\StoreCollection::storeExcel()
* @see \Maatwebsite\Excel\Mixins\StoreCollectionMixin::storeExcel()
* @param string $filePath
* @param string|null $disk
* @param string|null $writerType
@ -21766,6 +21842,64 @@ namespace {
return $instance->unless($value, $callback, $default);
}
/**
*
*
* @see \Maatwebsite\Excel\Mixins\DownloadQueryMacro::__invoke()
* @param string $fileName
* @param string|null $writerType
* @param mixed $withHeadings
* @static
*/
public static function downloadExcel($fileName, $writerType = null, $withHeadings = false)
{
return \Illuminate\Database\Eloquent\Builder::downloadExcel($fileName, $writerType, $withHeadings);
}
/**
*
*
* @see \Maatwebsite\Excel\Mixins\StoreQueryMacro::__invoke()
* @param string $filePath
* @param string|null $disk
* @param string|null $writerType
* @param mixed $withHeadings
* @static
*/
public static function storeExcel($filePath, $disk = null, $writerType = null, $withHeadings = false)
{
return \Illuminate\Database\Eloquent\Builder::storeExcel($filePath, $disk, $writerType, $withHeadings);
}
/**
*
*
* @see \Maatwebsite\Excel\Mixins\ImportMacro::__invoke()
* @param string $filename
* @param string|null $disk
* @param string|null $readerType
* @static
*/
public static function import($filename, $disk = null, $readerType = null)
{
return \Illuminate\Database\Eloquent\Builder::import($filename, $disk, $readerType);
}
/**
*
*
* @see \Maatwebsite\Excel\Mixins\ImportAsMacro::__invoke()
* @param string $filename
* @param callable $mapping
* @param string|null $disk
* @param string|null $readerType
* @static
*/
public static function importAs($filename, $mapping, $disk = null, $readerType = null)
{
return \Illuminate\Database\Eloquent\Builder::importAs($filename, $mapping, $disk, $readerType);
}
/**
* Set the columns to be selected.
*
@ -23700,7 +23834,7 @@ namespace {
/**
* Die and dump the current SQL and bindings.
*
* @return \Illuminate\Database\Query\never
* @return never
* @static
*/
public static function dd()
@ -23805,8 +23939,8 @@ namespace {
class DataTables extends \Yajra\DataTables\Facades\DataTables {}
class Yard extends \App\Services\Facade\Yard {}
class Debugbar extends \Barryvdh\Debugbar\Facades\Debugbar {}
class Pdf extends \Barryvdh\DomPDF\Facade\Pdf {}
class PDF extends \Barryvdh\DomPDF\Facade\Pdf {}
class Pdf extends \Barryvdh\DomPDF\Facade\Pdf {}
class Flare extends \Facade\Ignition\Facades\Flare {}
class Flash extends \Laracasts\Flash\Flash {}
class Html extends \Collective\Html\HtmlFacade {}

View file

@ -203,6 +203,7 @@ namespace App\Models{
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup whereCountry($value)
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup whereIpEnd($value)
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup whereIpStart($value)
* @mixin \Eloquent
*/
class DbipLookup extends \Eloquent {}
}
@ -223,6 +224,7 @@ namespace App\Models{
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup2 whereCountry($value)
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup2 whereIpEnd($value)
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup2 whereIpStart($value)
* @mixin \Eloquent
*/
class DbipLookup2 extends \Eloquent {}
}
@ -243,6 +245,7 @@ namespace App\Models{
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup3 whereCountry($value)
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup3 whereIpEnd($value)
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup3 whereIpStart($value)
* @mixin \Eloquent
*/
class DbipLookup3 extends \Eloquent {}
}
@ -271,6 +274,7 @@ namespace App\Models{
* @method static \Illuminate\Database\Eloquent\Builder|DcCategory whereSlug($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcCategory whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcCategory withUniqueSlugConstraints(\Illuminate\Database\Eloquent\Model $model, string $attribute, array $config, string $slug)
* @mixin \Eloquent
*/
class DcCategory extends \Eloquent {}
}
@ -291,9 +295,9 @@ namespace App\Models{
* @property Collection|DcFileTag[] $dc_file_tags
* @package App\Models
* @property-read int|null $dc_file_tags_count
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\DcFileTag> $fileTag
* @property-read Collection<int, \App\Models\DcFileTag> $fileTag
* @property-read int|null $file_tag_count
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\DcTag> $tags
* @property-read Collection<int, \App\Models\DcTag> $tags
* @property-read int|null $tags_count
* @method static \Illuminate\Database\Eloquent\Builder|DcFile newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|DcFile newQuery()
@ -307,6 +311,7 @@ namespace App\Models{
* @method static \Illuminate\Database\Eloquent\Builder|DcFile whereOriginalName($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcFile whereSize($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcFile whereUpdatedAt($value)
* @mixin \Eloquent
*/
class DcFile extends \Eloquent {}
}
@ -331,6 +336,7 @@ namespace App\Models{
* @method static \Illuminate\Database\Eloquent\Builder|DcFileTag whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcFileTag whereTagId($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcFileTag whereUpdatedAt($value)
* @mixin \Eloquent
*/
class DcFileTag extends \Eloquent {}
}
@ -363,6 +369,7 @@ namespace App\Models{
* @method static \Illuminate\Database\Eloquent\Builder|DcTag whereSlug($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcTag whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcTag withUniqueSlugConstraints(\Illuminate\Database\Eloquent\Model $model, string $attribute, array $config, string $slug)
* @mixin \Eloquent
*/
class DcTag extends \Eloquent {}
}
@ -803,9 +810,9 @@ namespace App\Models{
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentMethod whereUpdatedAt($value)
* @property array|null $show_on
* @method static \Illuminate\Database\Eloquent\Builder|PaymentMethod whereShowOn($value)
* @mixin \Eloquent
* @property bool $is_abo
* @method static \Illuminate\Database\Eloquent\Builder|PaymentMethod whereIsAbo($value)
* @mixin \Eloquent
*/
class PaymentMethod extends \Eloquent {}
}
@ -1356,6 +1363,12 @@ namespace App\Models{
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingInstance whereShoppingData($value)
* @property string|null $language
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingInstance whereLanguage($value)
* @property int|null $status
* @property float|null $amount
* @property int|null $shopping_user_id
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingInstance whereAmount($value)
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingInstance whereShoppingUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingInstance whereStatus($value)
* @mixin \Eloquent
*/
class ShoppingInstance extends \Eloquent {}
@ -1454,11 +1467,11 @@ namespace App\Models{
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereNetSplit($value)
* @property string|null $language
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereLanguage($value)
* @mixin \Eloquent
* @property bool|null $is_abo
* @property int|null $abo_interval
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereAboInterval($value)
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereIsAbo($value)
* @mixin \Eloquent
*/
class ShoppingOrder extends \Eloquent {}
}
@ -1557,11 +1570,13 @@ namespace App\Models{
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingPayment whereWallettype($value)
* @property string|null $mode
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingPayment whereMode($value)
* @mixin \Eloquent
* @property array|null $carddata
* @property int|null $is_abo
* @property int|null $abo_interval
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingPayment whereAboInterval($value)
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingPayment whereCarddata($value)
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingPayment whereIsAbo($value)
* @mixin \Eloquent
*/
class ShoppingPayment extends \Eloquent {}
}
@ -1901,7 +1916,6 @@ namespace App\Models{
* @property string $clearingtype
* @property string|null $wallettype
* @property int $amount
* @property string $currency
* @property bool $active
* @property int $status
* @property int $abo_interval
@ -1915,29 +1929,36 @@ namespace App\Models{
* @property User $user
* @property Collection|UserAboOrder[] $user_abo_orders
* @package App\Models
* @property int|null $member_id
* @property int $shopping_user_id
* @property int $abo_interval
* @property string|null $email
* @property string|null $is_for
* @property array|null $carddata
* @property \Illuminate\Support\Carbon|null $start_date
* @property \Illuminate\Support\Carbon|null $last_date
* @property \Illuminate\Support\Carbon|null $next_date
* @property int|null $count
* @property-read User|null $member
* @property-read \App\Models\ShoppingUser $shopping_user
* @property-read Collection<int, \App\Models\UserAboItem> $user_abo_items
* @property-read int|null $user_abo_items_count
* @property-read int|null $user_abo_orders_count
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo onlyTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo query()
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereAboInteval($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereAboInterval($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereActive($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereAmount($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereCancelDate($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereCarddata($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereClearingtype($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereCount($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereCurrency($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereDeletedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereEmail($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereIsFor($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereLastDate($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereMemberId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereNextDate($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo wherePayoneUserid($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereShoppingUserId($value)
@ -1949,10 +1970,42 @@ namespace App\Models{
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereWallettype($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo withoutTrashed()
* @mixin \Eloquent
*/
class UserAbo extends \Eloquent {}
}
namespace App\Models{
/**
* Class UserAboItem
*
* @property int $id
* @property int $user_abo_id
* @property int $product_id
* @property int|null $comp
* @property int $qty
* @property int $status
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Product $product
* @property UserAbo $user_abo
* @package App\Models
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem query()
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem whereComp($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem whereProductId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem whereQty($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem whereStatus($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem whereUserAboId($value)
* @mixin \Eloquent
*/
class UserAboItem extends \Eloquent {}
}
namespace App\Models{
/**
* Class UserAboOrder
@ -1975,6 +2028,7 @@ namespace App\Models{
* @method static \Illuminate\Database\Eloquent\Builder|UserAboOrder whereStatus($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAboOrder whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAboOrder whereUserAboId($value)
* @mixin \Eloquent
*/
class UserAboOrder extends \Eloquent {}
}
@ -2217,11 +2271,11 @@ namespace App\Models{
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereSalesVolumePointsTPSum($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereSalesVolumeTPPoints($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereVersion($value)
* @mixin \Eloquent
* @property string|null $user_birthday
* @property string|null $user_phone
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereUserBirthday($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereUserPhone($value)
* @mixin \Eloquent
*/
class UserBusiness extends \Eloquent {}
}
@ -2389,11 +2443,11 @@ namespace App\Models{
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem whereUserBusinessId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem whereUserCreditId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem whereUserId($value)
* @mixin \Eloquent
* @property int|null $from_month
* @property int|null $from_year
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem whereFromMonth($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem whereFromYear($value)
* @mixin \Eloquent
*/
class UserCreditItem extends \Eloquent {}
}
@ -2431,9 +2485,9 @@ namespace App\Models{
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserHistory whereIdentifier($value)
* @property int|null $abo_options
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserHistory whereAboOptions($value)
* @mixin \Eloquent
* @property int|null $is_abo
* @method static \Illuminate\Database\Eloquent\Builder|UserHistory whereIsAbo($value)
* @mixin \Eloquent
*/
class UserHistory extends \Eloquent {}
}

View file

@ -1 +1,4 @@
TODOS
- member_id bei Abos aktualisieren, wenn User neu zugewiesen wird oder gelöscht wird
-

View file

@ -52,48 +52,36 @@ class BusinessStore extends Command
*/
public function handle()
{
$executeDay = (int) Setting::getContentBySlug('day-exectute-business-structur');
$this->info('RUN Command BusinessStore on Day: '. $executeDay);
$presentDay = (int) date('d');
$this->info('RUN Command BusinessStore on Day: '. $executeDay);
$this->info('RUN Command BusinessStore present Day: '. $presentDay);
if($executeDay !== $presentDay){
$this->info('NOT RUN Command BusinessStore is not present Day: '. $presentDay);
return 0;
}
$this->timeStart = microtime(true);
//$this->info('RUN Command BusinessStore');
$this->month = $this->argument('month');
$this->year = $this->argument('year');
if(!$this->month || !$this->year){
$this->month = (int) date("m", strtotime("-1 month", time()));
$this->year = (int) date("Y", strtotime("-1 month", time()));
}
$this->info('RUN Command BusinessStore on month: '.$this->month.' | year: '.$this->year);
//erstellt die Business Struktur und die Details
$this->storeBusinessStructureUsersDetailMonth();
//Struktur und die Details für mehrere Montate for / to month
//$this->storeBusinessStructureUsersDetailPeriod(1, 6);
//erstellt die Gutschriften
// Argumente mit Standardwerten für den Vormonat
$this->month = $this->argument('month') ?: (int) date("m", strtotime("-1 month"));
$this->year = $this->argument('year') ?: (int) date("Y", strtotime("-1 month"));
$this->info('RUN Command BusinessStore on month: '.$this->month.' | year: '.$this->year);
// Prozesse ausführen
$this->storeBusinessStructureUsersDetailMonth();
$this->userBusinessCommissionsToCredit();
//erstellt aus den Gutschriften die PDFs
//$this->userCreatePaymentCreditsPDF();
//update user Level
//$this->userLevelUpdate();
// Auskommentierte Prozesse
// $this->userCreatePaymentCreditsPDF();
// $this->userLevelUpdate();
// $this->storeBusinessStructureUsersDetailPeriod(1, 6);
return 0;
//\Log::info('Cron is running');
//return 0;
}
private function storeBusinessStructureUsersDetailMonth(){
@ -104,11 +92,8 @@ class BusinessStore extends Command
$businessUsersStore->storeBusinessUsersDetail();
$bool = $businessUsersStore->storeBusinessCompleted();
$diff = microtime(true) - $this->timeStart;
$sec = intval($diff);
$micro = $diff - $sec;
$this->info('END Command storeBusinessStructureUsersDetailMonth: '.$bool. ' | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
$this->logExecutionTime('END Command storeBusinessStructureUsersDetailMonth: '.$bool);
}
private function userBusinessCommissionsToCredit(){
@ -121,11 +106,8 @@ class BusinessStore extends Command
$ret = $userPaymentCredits->addUserCreditItem($userBusiness);
$this->info('userBusinessCredit: '.$ret->user_id.' : Team: '.$ret->commission_pp_total.' | Shop: '.$ret->commission_shop_sales);
}
$diff = microtime(true) - $this->timeStart;
$sec = intval($diff);
$micro = $diff - $sec;
$this->info('END Command userBusinessCommissionsToCredit: | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
$this->logExecutionTime('END Command userBusinessCommissionsToCredit:');
}
private function userCreatePaymentCreditsPDF(){
@ -139,11 +121,8 @@ class BusinessStore extends Command
$this->info('creditsPDF: '.$bool.' user_id: '.$creditItemUser->user_id);
}
$diff = microtime(true) - $this->timeStart;
$sec = intval($diff);
$micro = $diff - $sec;
$this->info('END Command userCreatePaymentCreditsPDF: | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
$this->logExecutionTime('END Command userCreatePaymentCreditsPDF:');
}
private function userLevelUpdate(){
@ -162,29 +141,32 @@ class BusinessStore extends Command
}
}
$diff = microtime(true) - $this->timeStart;
$sec = intval($diff);
$micro = $diff - $sec;
$this->info('END Command userLevelUpdate: | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
$this->logExecutionTime('END Command userLevelUpdate:');
}
private function storeBusinessStructureUsersDetailPeriod($for, $to){
for($i = $for; $i<=$to; $i++){
$month = $i;
$this->info('Store Business Structure Users Detail month: '.$month.' year:'.$this->year);
$businessUsersStore = new BusinessUsersStore($month, $this->year);
private function storeBusinessStructureUsersDetailPeriod($from, $to)
{
for($i = $from; $i <= $to; $i++){
$this->info('Store Business Structure Users Detail month: '.$i.' year:'.$this->year);
$businessUsersStore = new BusinessUsersStore($i, $this->year);
$businessUsersStore->storeUserBusinessStructure();
$businessUsersStore->storeBusinessUsersDetail();
$bool = $businessUsersStore->storeBusinessCompleted();
$diff = microtime(true) - $this->timeStart;
$sec = intval($diff);
$micro = $diff - $sec;
$this->info('Period BusinessStore: '.$bool. ' | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
$this->logExecutionTime('Period BusinessStore: '.$bool);
}
}
}
private function logExecutionTime($message)
{
$diff = microtime(true) - $this->timeStart;
$sec = intval($diff);
$micro = $diff - $sec;
$this->info($message. ' | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
}
}

View file

@ -0,0 +1,664 @@
<?php
namespace App\Console\Commands;
use App\Http\Controllers\Api\KasController;
use App\Http\Controllers\Api\KasSLLController;
use App\Models\UserShop;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
class SubDomains extends Command
{
/**
* Die Signatur des Konsolenbefehls.
*
* Aufruf: php artisan subdomains:action --force --start=4 --debug
* /usr/bin/php82 artisan subdomains:action --force --start=4 --create-missing --debug
* /usr/bin/php82 artisan subdomains:action --force --debug
* @var string
*/
protected $signature = 'subdomains:action {user_id?} {--force} {--start=1} {--create-missing} {--debug}';
/**
* Die Beschreibung des Konsolenbefehls.
*
* @var string
*/
protected $description = 'Passt Parameter für die User-Subdomains an (PHP-Version, SSL)';
/**
* Zeitstempel für die Ausführungszeit-Messung
*
* @var float
*/
private $timeStart;
/**
* Standard-Domain für alle Subdomains
*
* @var string
*/
private $domain = 'mivita.care';
/**
* Zu überspringende Subdomain-Präfixe
*
* @var array
*/
private $skipPrefixes = ['www.', 'api.', 'checkout.', 'preview.'];
/**
* Erstellt eine neue Befehlsinstanz.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Führt den Konsolenbefehl aus.
*
* @return int
*/
public function handle()
{
$this->timeStart = microtime(true);
$userId = $this->argument('user_id');
$force = $this->option('force');
$startId = $this->option('start');
$createMissing = $this->option('create-missing');
$debug = $this->option('debug');
if ($debug) {
$this->warn("DEBUG-MODUS (DRY-RUN): Es werden keine tatsächlichen Änderungen vorgenommen!");
}
$this->info("Starte Subdomain-Verwaltung" . ($force ? " (erzwungener Modus)" : ""));
try {
if ($userId) {
$this->info("Verarbeite einzelnen Benutzer mit ID: {$userId}");
$result = $this->syncSingleUser($userId, $force, $createMissing, $debug);
if ($result) {
$this->info("Benutzer {$userId} erfolgreich synchronisiert" . ($debug ? " (simuliert)" : ""));
} else {
$this->warn("Benutzer {$userId} konnte nicht vollständig synchronisiert werden" . ($debug ? " (simuliert)" : ""));
}
} else {
$this->info("Verarbeite alle Benutzer ab ID: {$startId}");
$result = $this->syncAllUsers($force, $startId, $createMissing, $debug);
// Zusammenfassung der Ergebnisse
$this->displaySummary($result, $debug);
}
$this->logExecutionTime("Subdomain-Verwaltung abgeschlossen" . ($debug ? " (DEBUG-MODUS)" : ""));
return 0;
} catch (Exception $e) {
$this->error("Ein Fehler ist aufgetreten: " . $e->getMessage());
Log::error("Shopping User Sync Fehler: ", [
'error' => $e->getMessage(),
'trace' => $e->getTraceAsString(),
'user_id' => $userId,
'force' => $force,
'start_id' => $startId,
'debug' => $debug
]);
return 1;
}
}
/**
* Zeigt eine Zusammenfassung der Synchronisationsergebnisse an
*
* @param array $result Ergebnisdaten der Synchronisation
* @param bool $debug Debug-Modus (Dry-Run)
* @return void
*/
private function displaySummary($result, $debug = false)
{
$this->line("");
$this->info("=== Zusammenfassung " . ($debug ? "(DEBUG-MODUS)" : "") . " ===");
$this->info("Verarbeitete Shops: " . count($result['shops']));
$this->info("Aktualisierte PHP-Versionen: " . $result['updatedCount'] . ($debug ? " (simuliert)" : ""));
$this->info("Aktivierte SSL-Zertifikate: " . $result['sslEnabledCount'] . ($debug ? " (simuliert)" : ""));
$this->info("Aktualisierte SSL-Konfigurationen: " . $result['sslConfiguredCount'] . ($debug ? " (simuliert)" : ""));
if (!empty($result['createdSubdomains'])) {
$this->info("Neu erstellte Subdomains: " . count($result['createdSubdomains']) . ($debug ? " (simuliert)" : ""));
}
if (!empty($result['missingSubdomains'])) {
$this->warn("Fehlende Subdomains: " . count($result['missingSubdomains']));
}
if (!empty($result['unusedSubdomains'])) {
$this->warn("Ungenutzte Subdomains: " . count($result['unusedSubdomains']));
}
if (!empty($result['doubleDomains'])) {
$this->warn("Benutzer mit mehreren Shops: " . count($result['doubleDomains']));
}
}
/**
* Synchronisiert einen einzelnen Benutzer und seine Shops
*
* @param int $userId Benutzer-ID
* @param bool $force Erzwingt die Aktualisierung aller Subdomains
* @param bool $createMissing Erstellt fehlende Subdomains
* @param bool $debug Debug-Modus (Dry-Run)
* @return bool Erfolg der Operation
*/
private function syncSingleUser($userId, $force = false, $createMissing = false, $debug = false)
{
$this->info("Synchronisiere Benutzer mit ID: {$userId}");
// Benutzer-Shops abrufen
$userShops = UserShop::where('user_id', $userId)->get();
if ($userShops->isEmpty()) {
$this->warn("Keine Shops für Benutzer {$userId} gefunden");
return false;
}
$this->info("Gefundene Shops für Benutzer {$userId}: " . $userShops->count());
// Subdomains abrufen und filtern
$subdomains = $this->getFilteredSubdomains();
$success = true;
// Benutzer-Shops durchlaufen und mit Subdomains abgleichen
foreach ($userShops as $userShop) {
$fullDomainName = $userShop->slug . '.' . $this->domain;
$this->info("Verarbeite Shop: {$fullDomainName}");
// Prüfen, ob Subdomain existiert
if (array_key_exists($fullDomainName, $subdomains)) {
$success = $this->processExistingSubdomain($userShop, $subdomains[$fullDomainName], $force, $debug) && $success;
} else {
// Subdomain fehlt
$this->warn("Shop {$userShop->slug}: Keine Subdomain gefunden");
// Optional: Neue Subdomain erstellen
if ($createMissing) {
$this->info("Erstelle fehlende Subdomain für Shop {$userShop->slug}" . ($debug ? " (simuliert)" : ""));
$success = $this->createSubdomain($userShop->slug, $debug) && $success;
} else {
$success = false;
}
}
}
return $success;
}
/**
* Verarbeitet eine existierende Subdomain und aktualisiert sie bei Bedarf
*
* @param UserShop $userShop Shop-Objekt
* @param array $subdomainInfo Subdomain-Informationen
* @param bool $force Erzwingt die Aktualisierung
* @param bool $debug Debug-Modus (Dry-Run)
* @return bool Erfolg der Operation
*/
private function processExistingSubdomain($userShop, $subdomainInfo, $force, $debug = false)
{
$success = true;
$hasSSL = ($subdomainInfo['ssl_certificate_sni'] === 'Y' ||
$subdomainInfo['ssl_proxy'] === 'Y');
$sslActive = ($subdomainInfo['ssl_certificate_sni_is_active'] ?? 'N') === 'Y';
$phpVersion = $subdomainInfo['php_version'];
$this->info("Shop {$userShop->slug}: PHP-Version: {$phpVersion}, SSL: " .
($hasSSL ? "Aktiviert" : "Nicht aktiviert") .
($hasSSL ? ", SSL aktiv: " . ($sslActive ? "Ja" : "Nein") : ""));
// Prüfen, ob PHP-Version aktualisiert werden muss
$requiredPhpVersion = config('app.php_version');
if ($force || $phpVersion !== $requiredPhpVersion) {
$this->info("Shop {$userShop->slug}: PHP-Version aktualisieren von {$phpVersion} auf {$requiredPhpVersion}" . ($debug ? " (simuliert)" : ""));
if (!$debug && !$this->updateSubdomainParams($userShop->slug, $requiredPhpVersion)) {
$this->error("PHP-Version für {$userShop->slug}.{$this->domain} konnte nicht aktualisiert werden");
$success = false;
}
}
// Prüfen, ob SSL aktiviert werden muss
if ($force || !$hasSSL) {
$this->info("Shop {$userShop->slug}: SSL aktivieren" . ($debug ? " (simuliert)" : ""));
if (!$debug && !$this->enableSSL($userShop->slug)) {
$this->error("SSL für {$userShop->slug}.{$this->domain} konnte nicht aktiviert werden");
$success = false;
}
}
// Prüfen, ob SSL-Konfiguration aktualisiert werden muss
else if ($force || ($hasSSL && !$sslActive)) {
$this->info("Shop {$userShop->slug}: SSL-Konfiguration aktualisieren" . ($debug ? " (simuliert)" : ""));
if (!$debug && !$this->updateSSL($userShop->slug . '.' . $this->domain)) {
$this->error("SSL-Konfiguration für {$userShop->slug}.{$this->domain} konnte nicht aktualisiert werden");
$success = false;
}
}
return $success;
}
/**
* Synchronisiert alle Benutzer-Shops
*
* @param bool $force Erzwingt die Aktualisierung aller Subdomains
* @param int $startId Beginnt die Synchronisation ab dieser ID
* @param bool $createMissing Erstellt fehlende Subdomains
* @param bool $debug Debug-Modus (Dry-Run)
* @return array Ergebnisdaten der Synchronisation
*/
private function syncAllUsers($force, $startId, $createMissing = false, $debug = false)
{
$this->info("Starte Synchronisation aller Benutzer-Shops ab ID: {$startId}");
// Benutzer-Shops abrufen
$userShopsQuery = UserShop::query();
if ($startId > 1) {
$userShopsQuery->where('id', '>=', $startId);
}
$userShops = $userShopsQuery->limit(1000)->get();
$this->info("Gefundene Benutzer-Shops: " . $userShops->count());
// Subdomains abrufen und filtern
$subdomains = $this->getFilteredSubdomains();
$this->info("Gefilterte Subdomains: " . count($subdomains));
// Ergebnis-Arrays initialisieren
$doubleDomains = [];
$missingSubdomains = [];
$outdatedPhpVersions = [];
$missingSSL = [];
$sslConfigurationNeeded = [];
$createdSubdomains = [];
$updatedCount = 0;
$sslEnabledCount = 0;
$sslConfiguredCount = 0;
// Benutzer-Shops durchlaufen und mit Subdomains abgleichen
foreach ($userShops as $userShop) {
$fullDomainName = $userShop->slug . '.' . $this->domain;
// Status der Subdomain setzen
$userShop->hasSubdomain = false;
$userShop->hasSSL = false;
$userShop->sslActive = false;
$userShop->PHPversion = "";
// Prüfen, ob Subdomain existiert
if (array_key_exists($fullDomainName, $subdomains)) {
$userShop->hasSubdomain = true;
$userShop->hasSSL = ($subdomains[$fullDomainName]['ssl_certificate_sni'] === 'Y' ||
$subdomains[$fullDomainName]['ssl_proxy'] === 'Y');
$userShop->sslActive = ($subdomains[$fullDomainName]['ssl_certificate_sni_is_active'] ?? 'N') === 'Y';
$userShop->PHPversion = $subdomains[$fullDomainName]['php_version'];
// Prüfen, ob PHP-Version aktualisiert werden muss
$requiredPhpVersion = config('app.php_version');
if ($force || $userShop->PHPversion !== $requiredPhpVersion) {
$this->info("Shop {$userShop->slug}: PHP-Version aktualisieren von {$userShop->PHPversion} auf {$requiredPhpVersion}" . ($debug ? " (simuliert)" : ""));
$outdatedPhpVersions[] = $userShop->slug;
if (!$debug && $this->updateSubdomainParams($userShop->slug, $requiredPhpVersion)) {
$updatedCount++;
} else if ($debug) {
// Im Debug-Modus zählen wir trotzdem, als ob es erfolgreich wäre
$updatedCount++;
}
}else{
$this->info("Shop {$userShop->slug}: PHP-Version ist aktuell: {$userShop->PHPversion}");
}
// Prüfen, ob SSL aktiviert werden muss
/* if ($force || !$userShop->hasSSL) {
$this->info("Shop {$userShop->slug}: SSL aktivieren" . ($debug ? " (simuliert)" : ""));
$missingSSL[] = $userShop->slug;
if (!$debug && $this->enableSSL($userShop->slug)) {
$sslEnabledCount++;
} else if ($debug) {
// Im Debug-Modus zählen wir trotzdem, als ob es erfolgreich wäre
$sslEnabledCount++;
}
}
// Prüfen, ob SSL-Konfiguration aktualisiert werden muss
else if ($force || ($userShop->hasSSL && !$userShop->sslActive)) {
$this->info("Shop {$userShop->slug}: SSL-Konfiguration aktualisieren" . ($debug ? " (simuliert)" : ""));
$sslConfigurationNeeded[] = $userShop->slug;
if (!$debug && $this->updateSSL($fullDomainName)) {
$sslConfiguredCount++;
} else if ($debug) {
// Im Debug-Modus zählen wir trotzdem, als ob es erfolgreich wäre
$sslConfiguredCount++;
}
}*/
// Subdomain aus der Liste entfernen, um später ungenutzte zu identifizieren
unset($subdomains[$fullDomainName]);
} else {
// Subdomain fehlt
$missingSubdomains[] = $userShop->slug;
$this->warn("Shop {$userShop->slug}: Keine Subdomain gefunden");
// Optional: Neue Subdomain erstellen
if ($createMissing) {
$this->info("Erstelle fehlende Subdomain für Shop {$userShop->slug}" . ($debug ? " (simuliert)" : ""));
if (!$debug && $this->createSubdomain($userShop->slug)) {
$createdSubdomains[] = $userShop->slug;
} else if ($debug) {
// Im Debug-Modus zählen wir trotzdem, als ob es erfolgreich wäre
$createdSubdomains[] = $userShop->slug;
}
}
}
// Doppelte Domains pro Benutzer erfassen
$doubleDomains[$userShop->user_id][$userShop->id] = $fullDomainName;
}
// Bereinigen der doppelten Domains (nur Benutzer mit mehreren Shops behalten)
foreach ($doubleDomains as $userId => $domains) {
if (count($domains) === 1) {
unset($doubleDomains[$userId]);
}
}
$this->logExecutionTime("Synchronisation abgeschlossen" . ($debug ? " (DEBUG-MODUS)" : ""));
// Ergebnisdaten zurückgeben
return [
'shops' => $userShops,
'unusedSubdomains' => $subdomains,
'doubleDomains' => $doubleDomains,
'missingSubdomains' => $missingSubdomains,
'outdatedPhpVersions' => $outdatedPhpVersions,
'missingSSL' => $missingSSL,
'sslConfigurationNeeded' => $sslConfigurationNeeded,
'createdSubdomains' => $createdSubdomains,
'updatedCount' => $updatedCount,
'sslEnabledCount' => $sslEnabledCount,
'sslConfiguredCount' => $sslConfiguredCount
];
}
/**
* Ruft alle Subdomains ab und filtert sie
*
* @return array Gefilterte Subdomains
*/
private function getFilteredSubdomains()
{
$kas = new KasController();
$subdomains = [];
// Alle Subdomains abrufen
$this->info("Rufe Subdomains von KAS ab...");
$getSubdomains = $kas->action('get_subdomains');
// Subdomains filtern und in ein leicht zugängliches Array umwandeln
foreach ($getSubdomains as $subdomain) {
if (!isset($subdomain['subdomain_name'])) {
continue;
}
// Spezielle Subdomains überspringen
$skip = false;
foreach ($this->skipPrefixes as $prefix) {
if (strpos($subdomain['subdomain_name'], $prefix) !== false) {
$skip = true;
break;
}
}
if ($skip) {
continue;
}
// Subdomain-Informationen speichern
$subdomains[$subdomain['subdomain_name']] = [
'ssl_certificate_sni' => $subdomain['ssl_certificate_sni'] ?? 'N',
'php_version' => $subdomain['php_version'] ?? '',
'ssl_proxy' => $subdomain['ssl_proxy'] ?? 'N',
'ssl_certificate_sni_is_active' => $subdomain['ssl_certificate_sni_is_active'] ?? 'N',
];
}
return $subdomains;
}
/**
* Ändert Parameter einer Subdomain, insbesondere die PHP-Version
*
* @param string $subdomain Name der Subdomain ohne Domain
* @param string $phpVersion Neue PHP-Version (z.B. '8.2')
* @param array $additionalParams Weitere zu ändernde Parameter
* @param bool $debug Debug-Modus (Dry-Run)
* @return bool Erfolg der Operation
*/
private function updateSubdomainParams($subdomain, $phpVersion, $additionalParams = [], $debug = false)
{
$this->info("Aktualisiere Parameter für: {$subdomain}.{$this->domain}" . ($debug ? " (simuliert)" : ""));
if ($debug) {
$this->line(" - PHP-Version: {$phpVersion}");
if (!empty($additionalParams)) {
$this->line(" - Zusätzliche Parameter: " . json_encode($additionalParams));
}
return true;
}
try {
$kas = new KasController();
// Standardparameter
$params = [
'subdomain_name' => $subdomain . '.' . $this->domain, // Vollständigen Domainnamen verwenden
'php_version' => $phpVersion
];
// Oder alternativ, falls die API die Subdomain und Domain getrennt erwartet:
// $params = [
// 'subdomain_name' => $subdomain,
// 'domain_name' => $this->domain,
// 'php_version' => $phpVersion
// ];
// Zusätzliche Parameter hinzufügen
$params = array_merge($params, $additionalParams);
// Subdomain aktualisieren
$result = $kas->action('update_subdomain', $params);
$this->info("Parameter: ".json_encode($params));
if ($result) {
$this->info("Parameter für {$subdomain}.{$this->domain} erfolgreich aktualisiert " . json_encode($result));
return true;
} else {
$this->error("Fehler beim Aktualisieren der Parameter für {$subdomain}.{$this->domain}: " . json_encode($result));
return false;
}
} catch (Exception $e) {
$this->error("Fehler beim Aktualisieren der Parameter für {$subdomain}.{$this->domain}: " . $e->getMessage());
Log::error("Subdomain Parameter Update Fehler", [
'subdomain' => $subdomain,
'domain' => $this->domain,
'php_version' => $phpVersion,
'error' => $e->getMessage(),
'trace' => $e->getTraceAsString()
]);
return false;
}
}
/**
* Aktualisiert die SSL-Konfiguration einer Subdomain mit erweiterten Parametern
*
* @param string $subdomainName Vollständiger Domainname (z.B. 'shop.mivita.care')
* @param bool $debug Debug-Modus (Dry-Run)
* @return bool Erfolg der Operation
*/
private function updateSSL($subdomainName, $debug = false)
{
$this->info("Aktualisiere SSL-Konfiguration für: {$subdomainName}" . ($debug ? " (simuliert)" : ""));
if ($debug) {
$this->line(" - SSL-Parameter werden aktualisiert");
return true;
}
try {
$kas = new KasController();
$ssl = KasSLLController::getApiSSLParameter();
$params = array_merge(['hostname' => $subdomainName], $ssl);
$result = $kas->action('update_ssl', $params);
if ($result === "TRUE" || $result === true) {
$this->info("SSL-Konfiguration für {$subdomainName} erfolgreich aktualisiert");
return true;
} else {
$this->warn("SSL-Konfiguration für {$subdomainName} nicht vollständig aktualisiert: " . json_encode($result));
return false;
}
} catch (Exception $e) {
$this->error("Fehler bei der SSL-Konfiguration für {$subdomainName}: " . $e->getMessage());
Log::error("SSL Update Fehler", [
'subdomain' => $subdomainName,
'error' => $e->getMessage(),
'trace' => $e->getTraceAsString()
]);
return false;
}
}
/**
* Aktiviert SSL für eine Subdomain mit vollständiger Konfiguration
*
* @param string $subdomain Name der Subdomain ohne Domain
* @param bool $debug Debug-Modus (Dry-Run)
* @return bool Erfolg der Operation
*/
private function enableSSL($subdomain, $debug = false)
{
$fullDomainName = $subdomain . '.' . $this->domain;
$this->info("Aktiviere SSL für: {$fullDomainName}" . ($debug ? " (simuliert)" : ""));
if ($debug) {
$this->line(" - SSL-Proxy wird aktiviert");
$this->line(" - HTTP zu HTTPS Weiterleitung wird eingerichtet");
$this->line(" - SSL-Konfiguration wird aktualisiert");
return true;
}
// Schritt 1: Subdomain-Parameter aktualisieren (ssl_proxy aktivieren)
$subdomainResult = $this->updateSubdomainParams($subdomain, config('app.php_version'), [
'ssl_proxy' => 'Y',
'redirect_status' => 301 // Weiterleitung von HTTP auf HTTPS
]);
if (!$subdomainResult) {
$this->error("SSL-Aktivierung für {$fullDomainName} fehlgeschlagen: Subdomain-Parameter konnten nicht aktualisiert werden");
return false;
}
// Schritt 2: SSL-Konfiguration aktualisieren
$sslResult = $this->updateSSL($fullDomainName);
if (!$sslResult) {
$this->warn("SSL-Aktivierung für {$fullDomainName} teilweise erfolgreich: SSL-Konfiguration konnte nicht aktualisiert werden");
return false;
}
$this->info("SSL für {$fullDomainName} vollständig aktiviert");
return true;
}
/**
* Erstellt eine neue Subdomain für einen Shop
*
* @param string $slug Shop-Slug
* @param bool $debug Debug-Modus (Dry-Run)
* @return bool Erfolg der Operation
*/
private function createSubdomain($slug, $debug = false)
{
$fullDomainName = $slug . '.' . $this->domain;
$this->info("Erstelle neue Subdomain: {$fullDomainName}" . ($debug ? " (simuliert)" : ""));
if ($debug) {
$this->line(" - Pfad: /mein.mivita.care/public/");
$this->line(" - PHP-Version: " . config('app.php_version'));
$this->line(" - SSL wird direkt aktiviert");
return true;
}
try {
$kas = new KasController();
// Parameter für die neue Subdomain
$params = [
'subdomain_name' => $slug,
'domain_name' => $this->domain,
'subdomain_path' => '/mein.mivita.care/public/',
'php_version' => config('app.php_version'),
];
// Subdomain erstellen
$result = $kas->action('add_subdomain', $params);
if ($result === $fullDomainName) {
$this->info("Subdomain {$fullDomainName} erfolgreich erstellt");
// SSL direkt aktivieren
$this->enableSSL($slug);
return true;
} else {
$this->error("Fehler beim Erstellen der Subdomain {$fullDomainName}: " . json_encode($result));
return false;
}
} catch (Exception $e) {
$this->error("Fehler beim Erstellen der Subdomain {$fullDomainName}: " . $e->getMessage());
Log::error("Subdomain Erstellung Fehler", [
'slug' => $slug,
'domain' => $this->domain,
'error' => $e->getMessage(),
'trace' => $e->getTraceAsString()
]);
return false;
}
}
/**
* Protokolliert die Ausführungszeit einer Operation
*
* @param string $message Nachricht für die Protokollierung
* @return void
*/
private function logExecutionTime($message)
{
$diff = microtime(true) - $this->timeStart;
$sec = intval($diff);
$micro = $diff - $sec;
$this->info($message. ' | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
}
}

View file

@ -0,0 +1,129 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\User;
use App\Services\ShoppingUserService;
use Exception;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
class SyncShoppingUserData extends Command
{
//aufruf: php artisan shopping:sync-user-data --force --start=4
protected $signature = 'shopping:sync-user-data {user_id?} {--force} {--start=1}';
protected $description = 'Synchronisiere Shopping User Daten für einen oder alle User';
public function handle()
{
$userId = $this->argument('user_id');
$force = $this->option('force');
$startId = $this->option('start');
try {
if ($userId) {
$this->syncSingleUser($userId);
} else {
$this->syncAllUsers($force, $startId);
}
} catch (Exception $e) {
$this->error("Ein Fehler ist aufgetreten: " . $e->getMessage());
Log::error("Shopping User Sync Fehler: ", [
'error' => $e->getMessage(),
'trace' => $e->getTraceAsString()
]);
return 1;
}
return 0;
}
private function syncAllUsers($force, $startId)
{
$this->info("Starte Synchronisierung für alle User ab ID: {$startId}...");
$count = 0;
$errors = [];
// Aktiviere SQL Query Logging für Debugging
DB::enableQueryLog();
User::where('id', '>=', $startId)
->orderBy('id')
->chunk(10, function($users) use (&$count, &$errors, $force) {
foreach($users as $user) {
try {
$this->info("\nVerarbeite User ID: {$user->id} ({$user->email})");
$this->syncUser($user);
$count++;
$this->info("✓ User ID {$user->id} erfolgreich synchronisiert");
} catch (Exception $e) {
$errorMessage = "Fehler bei User ID {$user->id} ({$user->email}): " . $e->getMessage();
$errors[] = $errorMessage;
$this->error($errorMessage);
// Log die letzten SQL Queries
Log::error("Letzte SQL Queries:", [
'queries' => DB::getQueryLog()
]);
if (!$force) {
throw $e;
}
}
}
});
$this->newLine();
$this->info("Synchronisierung abgeschlossen!");
$this->info("Gesamt synchronisierte User: {$count}");
if (count($errors) > 0) {
$this->warn("Es gab " . count($errors) . " Fehler während der Synchronisierung:");
foreach($errors as $error) {
$this->warn("- " . $error);
}
}
}
private function syncUser(User $user)
{
try {
$this->output->write(" Setze Faker Mail... ");
ShoppingUserService::setFakerMail($user);
$this->info("");
$this->output->write(" Synchronisiere Numbers... ");
ShoppingUserService::syncNumbersByEmail($user);
$this->info("");
$this->output->write(" Synchronisiere Orders... ");
ShoppingUserService::syncOrdersByEmail($user);
$this->info("");
} catch (Exception $e) {
throw new Exception($e->getMessage() . "\n" . $e->getTraceAsString());
}
}
private function syncSingleUser($userId)
{
$user = User::find($userId);
if (!$user) {
throw new Exception("User ID {$userId} nicht gefunden");
}
$this->info("Starte Synchronisierung für User ID {$userId}...");
try {
$this->syncUser($user);
$this->info("✓ Synchronisierung erfolgreich abgeschlossen");
} catch (Exception $e) {
throw new Exception("Fehler bei User ID {$userId}: " . $e->getMessage());
}
}
}

View file

@ -0,0 +1,292 @@
<?php
namespace App\Console\Commands;
use Carbon\Carbon;
use App\Models\Setting;
use App\Models\UserAbo;
use App\Services\MyLog;
use App\Services\Payment;
use App\Cron\UserMakeOrder;
use App\Services\AboHelper;
use App\Models\UserAboOrder;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
class UserMakeAboOrder extends Command
{
/**
* ln -sfv /usr/bin/php73 /usr/bin/php
* php artisan business:store month year
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'user:make_abo_order';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Make Orders from Abos';
private $timeStart;
private $month;
private $year;
private $sendCreditMail = false;
private $sendUpdateMail = false;
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$this->timeStart = microtime(true);
Log::info('UserMakeAboOrder: Befehl gestartet');
$this->info('RUN Command user:make_abo_order');
try {
$this->checkAbosToOrder();
$executionTime = $this->getExecutionTime();
Log::info("UserMakeAboOrder: Befehl erfolgreich abgeschlossen in {$executionTime}");
$this->info("Befehl erfolgreich abgeschlossen in {$executionTime}");
return 0;
} catch (\Exception $e) {
Log::error('UserMakeAboOrder: Fehler beim Ausführen des Befehls', [
'error' => $e->getMessage(),
'trace' => $e->getTraceAsString()
]);
$this->error('Fehler beim Ausführen des Befehls: ' . $e->getMessage());
return 1;
}
}
/**
* Prüft alle Abos, die heute fällig sind und erstellt Bestellungen
*
* @return void
*/
private function checkAbosToOrder()
{
$dateNow = Carbon::now()->format('Y-m-d');
Log::info('UserMakeAboOrder: Suche nach fälligen Abos für Datum', ['date' => $dateNow]);
$userAbos = UserAbo::where('next_date', '=', $dateNow)
->where('active', true)
->get();
$count = $userAbos->count();
Log::info("UserMakeAboOrder: {$count} fällige Abos gefunden");
$this->info("Gefundene fällige Abos: {$count}");
foreach ($userAbos as $userAbo) {
Log::info('UserMakeAboOrder: Verarbeite Abo', [
'abo_id' => $userAbo->id,
'payone_userid' => $userAbo->payone_userid
]);
$this->info("Verarbeite Abo: {$userAbo->id} (PayoneUserid: {$userAbo->payone_userid})");
try {
$shoppingOrder = $this->makeOrder($userAbo);
if ($shoppingOrder) {
Log::info('UserMakeAboOrder: Bestellung erstellt', [
'abo_id' => $userAbo->id,
'order_id' => $shoppingOrder->id
]);
$this->info("Bestellung erstellt: {$shoppingOrder->id}");
} else {
Log::warning('UserMakeAboOrder: Keine Bestellung erstellt für Abo', ['abo_id' => $userAbo->id]);
$this->warn("Keine Bestellung erstellt für Abo: {$userAbo->id}");
}
} catch (\Exception $e) {
Log::error('UserMakeAboOrder: Fehler bei der Verarbeitung des Abos', [
'abo_id' => $userAbo->id,
'error' => $e->getMessage(),
'trace' => $e->getTraceAsString()
]);
$this->error("Fehler bei Abo {$userAbo->id}: " . $e->getMessage());
}
}
}
/**
* Erstellt eine Bestellung für ein Abo
*
* @param UserAbo $userAbo
* @return mixed
*/
private function makeOrder($userAbo)
{
Log::info('UserMakeAboOrder: Starte Bestellungserstellung', ['abo_id' => $userAbo->id]);
$this->info('Starte Bestellungserstellung für Abo: ' . $userAbo->id);
$shoppingOrder = null;
$userOrder = new UserMakeOrder($userAbo);
try {
if (!$userOrder->createShoppingUser()) {
Log::error('UserMakeAboOrder: Konnte Shopping-User nicht erstellen', ['abo_id' => $userAbo->id]);
$this->error("Konnte Shopping-User für Abo {$userAbo->id} nicht erstellen");
return null;
}
$shoppingOrder = $userOrder->makeShoppingOrder();
if (!$shoppingOrder) {
Log::error('UserMakeAboOrder: Konnte Bestellung nicht erstellen', ['abo_id' => $userAbo->id]);
$this->error("Konnte Bestellung für Abo {$userAbo->id} nicht erstellen");
return null;
}
Log::info('UserMakeAboOrder: Bestellung erstellt, starte Zahlungsvorgang', [
'abo_id' => $userAbo->id,
'order_id' => $shoppingOrder->id
]);
$response = $userOrder->makePayment();
$this->info('makePayment response: ' . json_encode($response));
if (!isset($response['status'])) {
Log::error('UserMakeAboOrder: Ungültige Zahlungsantwort', [
'abo_id' => $userAbo->id,
'order_id' => $shoppingOrder->id,
'response' => $response
]);
$this->error("Ungültige Zahlungsantwort für Abo {$userAbo->id}");
return $shoppingOrder;
}
if ($response['status'] === 'APPROVED') {
Log::info('UserMakeAboOrder: Zahlung erfolgreich', [
'abo_id' => $userAbo->id,
'order_id' => $shoppingOrder->id,
'response' => $response
]);
$this->info("Zahlung erfolgreich für Abo {$userAbo->id}");
$this->updateAbo($userAbo, $shoppingOrder, 1);
} elseif ($response['status'] === 'ERROR') {
Log::error('UserMakeAboOrder: Zahlungsfehler', [
'abo_id' => $userAbo->id,
'order_id' => $shoppingOrder->id,
'error' => $response
]);
$this->error("Zahlungsfehler für Abo {$userAbo->id}");
MyLog::writeLog(
'userabo',
'error',
'Error:3002 App\Console\Commands\UserMakeAboOrder::makeOrder / makePayment Error response',
$response
);
$this->updateAbo($userAbo, $shoppingOrder, 3);
$shoppingPayment = $userOrder->getShoppingPayment();
$data = [
'mode' => $shoppingPayment->mode,
'txaction' => 'error',
'send_link' => false,
'payment_error' => $response,
];
Payment::paymentStatusSendMail($shoppingOrder, $shoppingPayment, $data);
} else {
Log::warning('UserMakeAboOrder: Unbekannter Zahlungsstatus', [
'abo_id' => $userAbo->id,
'order_id' => $shoppingOrder->id,
'status' => $response['status']
]);
$this->warn("Unbekannter Zahlungsstatus für Abo {$userAbo->id}: {$response['status']}");
}
} catch (\Exception $e) {
Log::error('UserMakeAboOrder: Ausnahme bei der Bestellungserstellung', [
'abo_id' => $userAbo->id,
'error' => $e->getMessage(),
'trace' => $e->getTraceAsString()
]);
$this->error("Ausnahme bei Abo {$userAbo->id}: " . $e->getMessage());
}
return $shoppingOrder;
}
/**
* Aktualisiert das Abo nach einer Bestellung
*
* @param UserAbo $userAbo
* @param mixed $shoppingOrder
* @param int $status
* @return void
*/
private function updateAbo($userAbo, $shoppingOrder, $status = 1)
{
Log::info('UserMakeAboOrder: Aktualisiere Abo', [
'abo_id' => $userAbo->id,
'order_id' => $shoppingOrder->id,
'status' => $status
]);
$this->info("Aktualisiere Abo: {$userAbo->id} mit Status {$status}");
$updateData = [
'next_date' => AboHelper::setNextDate(now(), $userAbo->abo_interval),
'last_date' => now(),
];
if ($status !== 1) {
$updateData['status'] = $status;
}
try {
$userAbo->update($updateData);
UserAboOrder::create([
'user_abo_id' => $userAbo->id,
'shopping_order_id' => $shoppingOrder->id,
'status' => $status,
]);
Log::info('UserMakeAboOrder: Abo erfolgreich aktualisiert', [
'abo_id' => $userAbo->id,
'next_date' => $updateData['next_date']
]);
} catch (\Exception $e) {
Log::error('UserMakeAboOrder: Fehler beim Aktualisieren des Abos', [
'abo_id' => $userAbo->id,
'error' => $e->getMessage()
]);
$this->error("Fehler beim Aktualisieren des Abos {$userAbo->id}: " . $e->getMessage());
}
}
/**
* Berechnet die Ausführungszeit
*
* @return string
*/
private function getExecutionTime()
{
$diff = microtime(true) - $this->timeStart;
$sec = intval($diff);
$micro = $diff - $sec;
return $sec . ' Sekunden und ' . round($micro * 1000, 2) . ' ms';
}
}

View file

@ -12,7 +12,7 @@ class UserRestore extends Command
{
/**
* ln -sfv /usr/bin/php73 /usr/bin/php
* php artisan business:store month year
* php artisan user:restore {user_id}
* The name and signature of the console command.
*
* @var string

203
app/Cron/UserMakeOrder.php Normal file
View file

@ -0,0 +1,203 @@
<?php
namespace App\Cron;
use Yard;
use App\User;
use stdClass;
use App\Services\Shop;
use App\Models\Product;
use App\Models\UserAbo;
use App\Models\ShoppingOrder;
use App\Services\UserService;
use App\Models\ShippingCountry;
use App\Models\ShoppingOrderItem;
use App\Http\Controllers\Pay\PayoneController;
use App\Services\AboOrderCart;
use Illuminate\Support\Facades\Log;
class UserMakeOrder
{
private $userAbo;
private $shopping_user;
private $shopping_order;
private $is_for;
private $user;
private $pay;
public function __construct(UserAbo $userAbo)
{
$this->userAbo = $userAbo;
Log::info('UserMakeOrder initialisiert für UserAbo ID: ' . $userAbo->id);
}
public function checkProducts()
{
Log::info('Überprüfe Produkte für UserAbo ID: ' . $this->userAbo->id);
$ret = [];
if (!$this->userAbo->items || $this->userAbo->items->isEmpty()) {
Log::warning('Keine Artikel für UserAbo ID: ' . $this->userAbo->id . ' gefunden');
return $ret;
}
//preise prüfen, ob sie sich geändert haben?
foreach($this->userAbo->items as $item){
$ret[] = [
'product_id' => $item->product_id,
'comp' => $item->comp,
'qty' => $item->qty,
'price' => $item->price,
'price_net' => $item->price_net,
'tax_rate' => $item->tax_rate,
'tax' => $item->tax,
'price_vk_net' => $item->price_vk_net,
'discount' => $item->discount,
'points' => $item->points,
];
}
Log::info('Produkte überprüft: ' . count($ret) . ' Artikel gefunden');
return $ret;
}
public function makePayment()
{
Log::info('Starte Zahlungsvorgang für UserAbo ID: ' . $this->userAbo->id);
try {
$this->pay = new PayoneController();
$this->pay->init($this->shopping_user, $this->shopping_order);
$amount = $this->shopping_order->subtotal_ws * 100;
$this->pay->setAboPayment($this->userAbo, $amount, 'EUR');
$this->pay->setPersonalData();
$response = $this->pay->ResponseData(true);
Log::info('Zahlungsvorgang abgeschlossen für UserAbo ID: ' . $this->userAbo->id . ', Status: ' . ($response->status ?? 'unbekannt'));
return $response;
} catch (\Exception $e) {
Log::error('Fehler bei Zahlungsvorgang für UserAbo ID: ' . $this->userAbo->id . ': ' . $e->getMessage());
throw $e;
}
}
public function getShoppingPayment()
{
Log::info('Rufe Zahlungsinformationen ab für UserAbo ID: ' . $this->userAbo->id);
if($this->pay){
$payment = $this->pay->getShoppingPayment();
Log::info('Zahlungsinformationen abgerufen: ' . ($payment ? 'erfolgreich' : 'nicht verfügbar'));
return $payment;
}
Log::warning('Keine Zahlungsinformationen verfügbar für UserAbo ID: ' . $this->userAbo->id);
return false;
}
public function createShoppingUser()
{
Log::info('Erstelle Shopping-User für UserAbo ID: ' . $this->userAbo->id);
//hier muss der letzte shopping_user verwendet werden
try {
$this->shopping_user = AboOrderCart::makeCustomerDetail($this->userAbo);
$this->shopping_user->created_at = now();
$this->shopping_user->updated_at = now();
$this->shopping_user->save();
Log::info('Shopping-User erstellt für UserAbo ID: ' . $this->userAbo->id . ', Neue User-ID: ' . $this->shopping_user->id);
return $this->shopping_user;
} catch (\Exception $e) {
Log::error('Fehler beim Erstellen des Shopping-Users für UserAbo ID: ' . $this->userAbo->id . ': ' . $e->getMessage());
throw $e;
}
Log::warning('Kein Shopping-User verfügbar für UserAbo ID: ' . $this->userAbo->id);
return false;
}
public function makeShoppingOrder()
{
Log::info('Erstelle Bestellung für UserAbo ID: ' . $this->userAbo->id);
try {
if (!$this->shopping_user) {
Log::error('Kein Shopping-User verfügbar für Bestellerstellung, UserAbo ID: ' . $this->userAbo->id);
return false;
}
AboOrderCart::initYard($this->userAbo, $this->shopping_user);
//hier wird die Bestellung erstellt inkl aktueller Preise
AboOrderCart::makeOrderYard($this->userAbo);
$yard = Yard::instance('shopping');
if (!$this->userAbo->shopping_user || !$this->userAbo->shopping_user->shopping_order || !$this->userAbo->shopping_user->shopping_order->user_shop) {
Log::error('Fehlende Beziehungsdaten für Bestellerstellung, UserAbo ID: ' . $this->userAbo->id);
return false;
}
$this->shopping_order = ShoppingOrder::create([
'shopping_user_id' => $this->shopping_user->id,
'auth_user_id' => $this->shopping_user->auth_user_id,
'country_id' => $yard->getShippingCountryId(),
'language' => \App::getLocale(),
'user_shop_id' => $this->userAbo->shopping_user->shopping_order->user_shop->id,
'payment_for' => $this->shopping_user->getOrderPaymentFor(),
'total' => $yard->total(2, '.', ''),
'subtotal' => $yard->subtotal(2, '.', ''),
'shipping' => $yard->shipping(2, '.', ','),
'shipping_net' => $yard->shippingNet(2, '.', ''),
'subtotal_ws' => $yard->subtotalWithShipping(2, '.', ''),
'tax' => $yard->taxWithShipping(2, '.', ''),
'total_shipping' => $yard->totalWithShipping(2, '.', ''),
'points' => $yard->points(),
'weight' => $yard->weight(),
'is_abo' => 1,
'abo_interval' => 0,
'txaction' => 'prev',
'mode' => $this->userAbo->shopping_user->shopping_order->mode,
]);
Log::info('Bestellung erstellt für UserAbo ID: ' . $this->userAbo->id . ', Bestellnummer: ' . $this->shopping_order->id);
$items = $yard->getContentByOrder();
$itemCount = 0;
foreach ($items as $item) {
if (!ShoppingOrderItem::where('shopping_order_id', $this->shopping_order->id)->where('row_id', $item->rowId)->count()){
$price_net = $yard->rowPriceNet($item, 2, '.', '');
$tax = $item->price - $price_net;
$data = [
'shopping_order_id' => $this->shopping_order->id,
'row_id' => $item->rowId,
'product_id' => $item->id,
'comp' => $item->options->comp,
'qty' => $item->qty,
'price' => $item->price,
'price_net' => $price_net,
'tax_rate' => $item->taxRate,
'tax' => $tax,
'price_vk_net' => $this->shopping_order->getPriceVkNetBy($item->id),
'discount' => $item->options->no_commission ? 0 : $this->shopping_order->getUserDiscount(),
'points' => $item->options->points,
'slug' => $item->options->slug
];
ShoppingOrderItem::create($data);
$itemCount++;
}
}
Log::info('Bestellpositionen hinzugefügt für UserAbo ID: ' . $this->userAbo->id . ', Anzahl: ' . $itemCount);
$this->shopping_order->makeTaxSplit();
Log::info('Steueraufteilung für Bestellung abgeschlossen, UserAbo ID: ' . $this->userAbo->id);
return $this->shopping_order;
} catch (\Exception $e) {
Log::error('Fehler bei Bestellerstellung für UserAbo ID: ' . $this->userAbo->id . ': ' . $e->getMessage());
throw $e;
}
}
}

View file

@ -0,0 +1,151 @@
<?php
namespace App\Http\Controllers\Admin;
use Request;
use App\Services\Shop;
use App\Models\UserAbo;
use App\Services\AboOrderCart;
use App\Repositories\AboRepository;
use App\Http\Controllers\Controller;
class AboController extends Controller
{
protected $aboRepository;
public function __construct(AboRepository $aboRepository)
{
$this->middleware('admin');
$this->aboRepository = $aboRepository;
}
public function index()
{
if (Request::get('reset') === 'filter') {
set_user_attr('filter_user_shop_id', null);
set_user_attr('filter_status', null);
set_user_attr('filter_member_id', null);
return redirect(route('admin_sales_customers'));
}
//$filter_user_shops = UserAbo::join('user_shops', 'user_shop_id', '=', 'user_shops.id')->orderBy('slug')->get()->pluck('slug', 'id')->unique()->toArray();
$filter_members = UserAbo::join('users', 'user_id', '=', 'users.id')->groupBy('user_id')->join('user_accounts', 'account_id', '=', 'user_accounts.id')->select('users.id', 'users.email', 'user_accounts.first_name', 'user_accounts.last_name')->get();
$data = [
//'filter_user_shops' => $filter_user_shops,
'filter_members' => $filter_members,
];
return view('admin.abo.index', $data);
}
public function detail($id)
{
$data = Request::all();
$user_abo = UserAbo::findOrFail($id);
//init Yard
AboOrderCart::initYard($user_abo);
$customer_detail = AboOrderCart::getCustomerDetail();
AboOrderCart::makeOrderYard($user_abo);
$comp_products = [];
if ($user_abo->is_for === 'me') {
$comp_products = Shop::getCompProducts('abo-me');
}
$data = [
'user_abo' => $user_abo,
'isAdmin' => true,
'customer_detail' => $customer_detail,
'view' => $user_abo->is_for,
'comp_products' => $comp_products,
];
return view('admin.abo.detail', $data);
}
public function update($id)
{
$data = Request::all();
if (isset($data['action'])) {
if ($data['action'] === 'abo_update_settings') {
$user_abo = UserAbo::findOrFail($data['id']);
$this->aboRepository->setModel($user_abo);
$this->aboRepository->update($data);
return redirect(route('admin_abos_detail', [$id]));
}
}
}
public function datatable()
{
$query = UserAbo::with('user_abo_orders')->with('shopping_user')->select('user_abos.*');
set_user_attr('filter_member_id', Request::get('filter_member_id'));
if (Request::get('filter_member_id') != "") {
$query->where('user_id', '=', Request::get('filter_member_id'));
}
set_user_attr('filter_status', Request::get('filter_status'));
if (Request::get('filter_status') != "") {
$query->where('status', '=', Request::get('filter_status'));
}
return \DataTables::eloquent($query)
->addColumn('id', function (UserAbo $user_abo) {
return '<a href="' . route('admin_abos_detail', [$user_abo->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
})
->addColumn('start_date', function (UserAbo $user_abo) {
return $user_abo->start_date;
})
->addColumn('next_date', function (UserAbo $user_abo) {
return $user_abo->next_date;
})
->addColumn('abo_interval', function (UserAbo $user_abo) {
return \App\Services\HTMLHelper::getAboStrLang($user_abo->abo_interval);
})
->addColumn('status', function (UserAbo $user_abo) {
return $user_abo->getStatusFormated();
})
->addColumn('active', function (UserAbo $user_abo) {
return get_active_badge($user_abo->active);
})
->addColumn('is_for', function (UserAbo $user_abo) {
return $user_abo->getIsForFormated();
})
->addColumn('count', function (UserAbo $user_abo) {
return $user_abo->getCountOrders();
})
->addColumn('amount', function (UserAbo $user_abo) {
return $user_abo->getFormattedAmount() . ' €';
})
->addColumn('payment', function (UserAbo $user_abo) {
return $user_abo->getPaymentType();
})
->addColumn('member', function (UserAbo $user_abo) {
if (isset($user_abo->shopping_user) && $user_abo->shopping_user->member_id > 0) {
return '<a href="' . route('admin_lead_edit', [$user_abo->shopping_user->member_id]) . '">' . $user_abo->shopping_user->member->getFullName() . '</a>';
}
})
->addColumn('payone_userid', function (UserAbo $user_abo) {
return $user_abo->payone_userid;
})
->orderColumn('id', 'id $1')
->orderColumn('start_date', 'start_date $1')
->orderColumn('next_date', 'next_date $1')
->orderColumn('abo_interval', 'abo_interval $1')
->orderColumn('status', 'status $1')
->orderColumn('active', 'active $1')
->orderColumn('is_for', 'is_for $1')
->orderColumn('count', 'count $1')
->orderColumn('amount', 'amount $1')
->orderColumn('payone_userid', 'payone_userid $1')
->rawColumns(['id', 'status', 'active', 'is_for', 'member'])
->make(true);
}
}

View file

@ -56,7 +56,7 @@ class KasController extends Controller
}
// Fehler abfangen und ausgeben
catch (SoapFault $fault)
catch (\SoapFault $fault)
{
trigger_error(" Fehlernummer: {$fault->faultcode},
Fehlermeldung: {$fault->faultstring},
@ -88,7 +88,7 @@ class KasController extends Controller
}
// Fehler abfangen und ausgeben
catch (SoapFault $fault)
catch (\SoapFault $fault)
{
trigger_error("Fehlernummer: {$fault->faultcode},
Fehlermeldung: {$fault->faultstring},

View file

@ -8,48 +8,38 @@ use App\Http\Controllers\Controller;
class KasSLLController extends Controller
{
private static $ssl_certificate_sni_csr = "-----BEGIN CERTIFICATE REQUEST-----
MIIBfzCCASUCAQAwgYoxCzAJBgNVBAYTAkRFMQ4wDAYDVQQRDAU4Nzc1NTEPMA0G
A1UECAwGQmF5ZXJuMRUwEwYDVQQHDAxLaXJjaGhhc2xhY2gxEzARBgNVBAkMCkxl
aW5mZWxkIDIxFjAUBgNVBAoMDXJpd2EtdGVjIGUuSy4xFjAUBgNVBAMMDSoubWl2
aXRhLmNhcmUwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATHOCZrM/6Ry1iMHtpL
3OM+nm2NZJwbT91yWM25yaxXkkfgaKxfvjfTSgK3Yl/nE+cSrijT4BdP7H3U2ZnZ
Rg0FoDgwNgYJKoZIhvcNAQkOMSkwJzAlBgNVHREEHjAcgg0qLm1pdml0YS5jYXJl
ggttaXZpdGEuY2FyZTAKBggqhkjOPQQDBANIADBFAiEAva2vcfT1l/NvrMdFrujf
pFrbXTZMecYsa9SDnHXhp1gCIG8BFZSN/mPjM3EZXunj4bb1AXqqdxe+VjPiw6VL
lZwE
-----END CERTIFICATE REQUEST-----";
private static $ssl_certificate_sni_csr = "";
private static $ssl_certificate_sni_key = "-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgGd8N4RsRov6Kd81z
iclbCpD5e7nT1cTN2u8XQZRU/1ChRANCAATHOCZrM/6Ry1iMHtpL3OM+nm2NZJwb
T91yWM25yaxXkkfgaKxfvjfTSgK3Yl/nE+cSrijT4BdP7H3U2ZnZRg0F
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgohGr2e3ysw/Awvzh
qkqDS4iQgRvWwNIYxTcPxpdcndGhRANCAASZjlV2bQbLQrOveMlYOowR3IlfND7z
OxauFGabhvWSU1cg2w4U4bu/QXnDXfHHkcLp4M5WgHzX9Nw2m/abyJJ6
-----END PRIVATE KEY-----";
private static $ssl_certificate_sni_crt = "-----BEGIN CERTIFICATE-----
MIIEpzCCBEygAwIBAgIRAOdJ/xXHharlPCF26cIYht0wCgYIKoZIzj0EAwIwgY8x
CzAJBgNVBAYTAkdCMRswGQYDVQQIExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAOBgNV
BAcTB1NhbGZvcmQxGDAWBgNVBAoTD1NlY3RpZ28gTGltaXRlZDE3MDUGA1UEAxMu
U2VjdGlnbyBFQ0MgRG9tYWluIFZhbGlkYXRpb24gU2VjdXJlIFNlcnZlciBDQTAe
Fw0yMzA3MzEwMDAwMDBaFw0yNDA4MzAyMzU5NTlaMBgxFjAUBgNVBAMMDSoubWl2
aXRhLmNhcmUwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATHOCZrM/6Ry1iMHtpL
3OM+nm2NZJwbT91yWM25yaxXkkfgaKxfvjfTSgK3Yl/nE+cSrijT4BdP7H3U2ZnZ
Rg0Fo4IC/TCCAvkwHwYDVR0jBBgwFoAU9oUKOxGG4QR9DqoLLNLuzGR7e64wHQYD
VR0OBBYEFJco1/8VAvZA85Ct2Z/7XSA+DKNUMA4GA1UdDwEB/wQEAwIHgDAMBgNV
HRMBAf8EAjAAMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjBJBgNVHSAE
QjBAMDQGCysGAQQBsjEBAgIHMCUwIwYIKwYBBQUHAgEWF2h0dHBzOi8vc2VjdGln
by5jb20vQ1BTMAgGBmeBDAECATCBhAYIKwYBBQUHAQEEeDB2ME8GCCsGAQUFBzAC
hkNodHRwOi8vY3J0LnNlY3RpZ28uY29tL1NlY3RpZ29FQ0NEb21haW5WYWxpZGF0
aW9uU2VjdXJlU2VydmVyQ0EuY3J0MCMGCCsGAQUFBzABhhdodHRwOi8vb2NzcC5z
ZWN0aWdvLmNvbTAlBgNVHREEHjAcgg0qLm1pdml0YS5jYXJlggttaXZpdGEuY2Fy
ZTCCAX8GCisGAQQB1nkCBAIEggFvBIIBawFpAHcAdv+IPwq2+5VRwmHM9Ye6NLSk
zbsp3GhCCp/mZ0xaOnQAAAGJquwmHwAABAMASDBGAiEA7/7/S0CxtvREygwS3qR5
THaAwfObqF09zN4AE+rjGSQCIQDNat5O0VSbx+cwaNrrVWz86C0PnUufqWNkBVEa
5XM0bQB2ANq2v2s/tbYin5vCu1xr6HCRcWy7UYSFNL2kPTBI1/urAAABiarsJnYA
AAQDAEcwRQIhAMkJ4iRoexvBzGa7zuHLn0/R4iDvUstKVb7ZK1XqjuVQAiACwcKG
5WNIIeTjJ+CNDeME8mqHpgbFNWIAiiz0u+ANZwB2AO7N0GTV2xrOxVy3nbTNE6Iy
h0Z8vOzew1FIWUZxH7WbAAABiarsJmEAAAQDAEcwRQIgVVxidEYEx6g2xLxAcI57
eKJ4NDol/bnhmb0iERQmXOoCIQDf6Hviv4+SO+K3OoxxLI9qzFHNP6sb6aDaXfTW
ucyTtTAKBggqhkjOPQQDAgNJADBGAiEA4hOvVoXr58YPVGi5/UEEnyDXlUfX4ZKq
9PmblI2ZQVkCIQDRllVwklX+DUBcvzG6hapvn5Wv2171yIeoJo+vm7UO5g==
MIIEpDCCBEqgAwIBAgIQVIm0T0SQ6D20YQxMaHEKbDAKBggqhkjOPQQDAjCBjzEL
MAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE
BxMHU2FsZm9yZDEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTcwNQYDVQQDEy5T
ZWN0aWdvIEVDQyBEb21haW4gVmFsaWRhdGlvbiBTZWN1cmUgU2VydmVyIENBMB4X
DTI0MDgwMTAwMDAwMFoXDTI1MDkwMTIzNTk1OVowGDEWMBQGA1UEAwwNKi5taXZp
dGEuY2FyZTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJmOVXZtBstCs694yVg6
jBHciV80PvM7Fq4UZpuG9ZJTVyDbDhThu79BecNd8ceRwungzlaAfNf03Dab9pvI
knqjggL8MIIC+DAfBgNVHSMEGDAWgBT2hQo7EYbhBH0Oqgss0u7MZHt7rjAdBgNV
HQ4EFgQUVCkHH2AasJQFWFs63rdcb6BRvyowDgYDVR0PAQH/BAQDAgeAMAwGA1Ud
EwEB/wQCMAAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMEkGA1UdIARC
MEAwNAYLKwYBBAGyMQECAgcwJTAjBggrBgEFBQcCARYXaHR0cHM6Ly9zZWN0aWdv
LmNvbS9DUFMwCAYGZ4EMAQIBMIGEBggrBgEFBQcBAQR4MHYwTwYIKwYBBQUHMAKG
Q2h0dHA6Ly9jcnQuc2VjdGlnby5jb20vU2VjdGlnb0VDQ0RvbWFpblZhbGlkYXRp
b25TZWN1cmVTZXJ2ZXJDQS5jcnQwIwYIKwYBBQUHMAGGF2h0dHA6Ly9vY3NwLnNl
Y3RpZ28uY29tMCUGA1UdEQQeMByCDSoubWl2aXRhLmNhcmWCC21pdml0YS5jYXJl
MIIBfgYKKwYBBAHWeQIEAgSCAW4EggFqAWgAdgDd3Mo0ldfhFgXnlTL6x5/4PRxQ
39sAOhQSdgosrLvIKgAAAZEMky0iAAAEAwBHMEUCICSH9TLHP8tqMyBTBpxF1+lw
4wAnWf4E5pPJ6651S8P9AiEAkKqOQDaVdoFI1+jM28grXnG5o0vFLUwa0o49KYQ3
k+sAdgAN4fIwK9MNwUBiEgnqVS78R3R8sdfpMO8OQh60fk6qNAAAAZEMkyzbAAAE
AwBHMEUCIFJfJS4cojUm9nHQ1TVlxpFwOV7QwCj9MOfq0CCkVzsGAiEA8WQrE1ri
kJkeIVPSgUVJpIz8TKef2aR+Ivzkzon52QIAdgAS8U40vVNyTIQGGcOPP3oT+Oe1
YoeInG0wBYTr5YYmOgAAAZEMkyzBAAAEAwBHMEUCIQCH8/qTmCNea3FdBVk0c3Wu
FrvYnoQlTQaaDS/zeTxSzwIge6VO5Aeor30Wu675zBYzNsIru5gXOTl4dteBMYnC
0JswCgYIKoZIzj0EAwIDSAAwRQIhAKxmgpPqW6UAcWHCoWAPN673pBMxnCKn3vFq
wUkhGrT7AiBDUsDuMhabsGlZ10X2GXcm+1mwxdMLSDYEWiwk5fUaNA==
-----END CERTIFICATE-----";
private static $ssl_certificate_sni_bundle = "-----BEGIN CERTIFICATE-----
MIIDqDCCAy6gAwIBAgIRAPNkTmtuAFAjfglGvXvh9R0wCgYIKoZIzj0EAwMwgYgx

View file

@ -3,13 +3,17 @@
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\PaymentTransaction;
use App\Models\ShoppingOrder;
use App\Models\ShoppingPayment;
use App\Services\Payment;
use App\Services\Shop;
use App\Services\Util;
use App\Models\UserAbo;
use App\Services\MyLog;
use App\Services\Payment;
use App\Services\AboHelper;
use App\Models\ShoppingOrder;
use App\Models\ShoppingPayment;
use App\Models\PaymentTransaction;
use App\Http\Controllers\Controller;
use App\Services\ShoppingUserService;
class PayoneController extends Controller
@ -41,47 +45,60 @@ class PayoneController extends Controller
*/
if(!isset($data['key']) || !isset($data['param']) || !isset($data['userid']) || !isset($data['txid']) || !isset($data['reference']) || !isset($data['price'])){
\Log::channel('payone')->error('PaymentStatus: parameter incomplete: '.json_encode($data));
echo "PaymentStatus: parameter incomplete:";
var_dump($data);
die();
MyLog::writeLog(
'payone',
'error',
'Error:2001 App\Http\Controllers\Api\PayoneController::paymentStatus parameter incomplete',
$data
);
print("TSOK");
exit;
}
if($data['key'] != config('payone.defaults.key')) {
\Log::channel('payone')->error('PaymentStatus: Key error: '.json_encode($data));
echo "PaymentStatus: Key error:";
var_dump($data);
die();
MyLog::writeLog(
'payone',
'error',
'Error:2002 App\Http\Controllers\Api\PayoneController::paymentStatus Key error',
$data
);
print("TSOK");
exit;
}
$shopping_order = ShoppingOrder::find($data['param']);
if(!$shopping_order){
\Log::channel('payone')->error('PaymentStatus: ShoppingOrder not found: '.json_encode($data));
echo "PaymentStatus: ShoppingOrder not found:";
var_dump($data);
die();
MyLog::writeLog(
'payone',
'error',
'Error:2003 App\Http\Controllers\Api\PayoneController::paymentStatus ShoppingOrder not found:',
$data
);
print("TSOK");
exit;
}
$shopping_payment = ShoppingPayment::where('reference', $data['reference'])->first();
if(!$shopping_payment){
\Log::channel('payone')->error('PaymentStatus: ShoppingPayment not found: '.json_encode($data));
echo "PaymentStatus: ShoppingPayment not found:";
var_dump($data);
die();
MyLog::writeLog(
'payone',
'error',
'Error:2004 App\Http\Controllers\Api\PayoneController::paymentStatus ShoppingPayment not found',
$data
);
print("TSOK");
exit;
}
if($shopping_payment->shopping_order_id != $shopping_order->id){
\Log::channel('payone')->error('PaymentStatus: ShoppingPayment no realation ShoppingOrder: '.json_encode($data));
echo "PaymentStatus: ShoppingPayment no realation ShoppingOrder:";
var_dump($data);
die();
}
if($data['key'] != config('payone.defaults.key')) {
\Log::channel('payone')->error('PaymentStatus: Key error: '.json_encode($data));
echo "PaymentStatus: ShoppingPayment no realation ShoppingOrder:";
var_dump($data);
die();
MyLog::writeLog(
'payone',
'error',
'Error:2005 App\Http\Controllers\Api\PayoneController::paymentStatus ShoppingPayment no realation ShoppingOrder',
$data
);
print("TSOK");
exit;
}
$price = number_format((round($data['price'],2) * 100), 0, '.', '');
@ -89,21 +106,39 @@ class PayoneController extends Controller
if($price_amount != $price){
$data['shopping_payment-amount'] = $price_amount;
$data['price-amount'] = $price;
\Log::channel('payone')->error('PaymentStatus: Price error: '.json_encode($data));
echo "PaymentStatus: Price error:";
var_dump($data);
die();
MyLog::writeLog(
'payone',
'error',
'Error:2006 App\Http\Controllers\Api\PayoneController::paymentStatus Price error',
$data
);
print("TSOK");
exit;
}
/* TODO -- need this?
/* TODO -- need this? */
if($shopping_payment->txaction == $data['txaction']){
\Log::channel('payone')->error('PaymentStatus: same txaction error: '.json_encode($data));
echo "PaymentStatus: same txaction:";
var_dump($data);
die();
if($data['txaction'] === 'paid' && $shopping_order->txaction === 'paid'){
MyLog::writeLog(
'payone',
'error',
'Error:2007 App\Http\Controllers\Api\PayoneController::paymentStatus same txaction - was already paid',
$data
);
//was already paid
print("TSOK");
exit;
}else{
MyLog::writeLog(
'payone',
'error',
'Error:2007 App\Http\Controllers\Api\PayoneController::paymentStatus same txaction - show',
$data
);
}
}
*/
//create transaction
PaymentTransaction::create([
'shopping_payment_id' => $shopping_payment->id,
@ -124,19 +159,19 @@ class PayoneController extends Controller
$send_link = false;
$send_mail = true;
if($data['txaction'] === 'failed'){
$shopping_order->setUserHistoryValue(['status' => 6]);
Util::setInstanceStatusByPayment($shopping_payment, 5);
}
if($data['txaction'] === 'appointed'){
$shopping_order->setUserHistoryValue(['status' => 7]);
Shop::userOrders();
ShoppingUserService::snycOrdersByShoppingOrder($shopping_order);
Util::setInstanceStatusByPayment($shopping_payment, 4);
}
if($data['txaction'] === 'paid'){
if(!$shopping_order->paid){
$send_link = Payment::paymentStatusPaidAction($shopping_order, true);
$send_link = Payment::paymentStatusPaidAction($shopping_order, true, $shopping_payment);
}else{
$send_mail = false;
}

View file

@ -593,7 +593,7 @@ class ShoppingUserController extends Controller
if ($order->price != ($product->price * 100)) {
$error[] = "different price: " . ($product->price * 100);
}
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), (int) $order->qty, $product->price, false, false, ['image' => [], 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission]);
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), (int) $order->qty, $product->price, false, false, ['image' => [], 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission, 'show_on' => $product->show_on]);
Yard::setTax($cartItem->rowId, $product->getTaxWith());
}
}

View file

@ -17,7 +17,7 @@ class BusinessController extends Controller
private $filter_active = [1 => 'aktiv', 2 => 'nicht aktiv', 3 => 'alle'];
private $month;
private $year;
public function __construct()
{
$this->middleware('admin');
@ -42,7 +42,7 @@ class BusinessController extends Controller
$TreeCalcBot = new TreeCalcBot($this->month, $this->year, 'admin');
$TreeCalcBot->initStructureAdmin();
$data = [
'filter_months' => HTMLHelper::getTransMonths(),
'filter_years' => HTMLHelper::getYearRange(),
@ -61,7 +61,7 @@ class BusinessController extends Controller
$data['year'] = session('business_user_filter_year');
$TreeCalcBot = new TreeCalcBot($data['month'], $data['year'], 'admin');
$TreeCalcBot->initBusinesslUserDetail($user);
if(!$TreeCalcBot->business_user){
if (!$TreeCalcBot->business_user) {
abort(403, 'no user found');
}
return view('admin.business.user_detail', compact('TreeCalcBot', 'user', 'data'));
@ -82,49 +82,52 @@ class BusinessController extends Controller
//return back();
}
private function setFilterVars(){
private function setFilterVars()
{
if(!session('business_user_filter_month')){
if (!session('business_user_filter_month')) {
session(['business_user_filter_month' => intval(date('m'))]);
}
if(!session('business_user_filter_year')){
if (!session('business_user_filter_year')) {
session(['business_user_filter_year' => intval(date('Y'))]);
}
if(!session('business_user_filter_active')){
if (!session('business_user_filter_active')) {
session(['business_user_filter_active' => 1]);
}
if(!session('business_user_filter_depiction')){
if (!session('business_user_filter_depiction')) {
session(['business_user_filter_depiction' => 'active']);
}
if(Request::get('business_user_filter_depiction')){
if (Request::get('business_user_filter_depiction')) {
session(['business_user_filter_depiction' => Request::get('business_user_filter_depiction')]);
}
if(Request::get('business_user_filter_name')){
if (Request::get('business_user_filter_name')) {
session(['business_user_filter_name' => Request::get('business_user_filter_name')]);
} else {
session(['business_user_filter_name' => '']);
}
if(Request::get('business_user_filter_active')){
if (Request::get('business_user_filter_active')) {
session(['business_user_filter_active' => Request::get('business_user_filter_active')]);
}
if(Request::get('business_user_filter_month')){
if (Request::get('business_user_filter_month')) {
session(['business_user_filter_month' => Request::get('business_user_filter_month')]);
}
if(Request::get('business_user_filter_year')){
if (Request::get('business_user_filter_year')) {
session(['business_user_filter_year' => Request::get('business_user_filter_year')]);
}
}
public function userDatatable()
{
{
$this->month = Request::get('business_user_filter_month');
$this->year = Request::get('business_user_filter_year');
//only the currently month get from Users -> older month from UserBusiness
return $this->userCurrentlyDatatable();
if(TreeCalcBot::isFromStored($this->month, $this->year)){
return $this->userCurrentlyDatatable();
if (TreeCalcBot::isFromStored($this->month, $this->year)) {
return $this->userStoredDatatable();
}else{
} else {
return $this->userCurrentlyDatatable();
}
}
@ -132,16 +135,16 @@ class BusinessController extends Controller
private function initStoredSearch($archive = false, $request = true)
{
$this->setFilterVars();
$query = UserBusiness::select('user_businesses.*')->where('month', $this->month)->where('year', $this->year);
if(Request::get('business_user_filter_active')){
if(Request::get('business_user_filter_active') == 1){
if (Request::get('business_user_filter_active')) {
if (Request::get('business_user_filter_active') == 1) {
$query->where('user_businesses.active_account', 1);
}
if(Request::get('business_user_filter_active') == 2){
if (Request::get('business_user_filter_active') == 2) {
$query->where('user_businesses.active_account', 0);
}
if(Request::get('business_user_filter_active') == 3){
if (Request::get('business_user_filter_active') == 3) {
//both -> payment_account only not null
}
}
@ -149,18 +152,18 @@ class BusinessController extends Controller
}
private function userStoredDatatable()
{
{
$query = $this->initStoredSearch();
return \DataTables::eloquent($query)
->addColumn('id', function (UserBusiness $userBusiness) {
return '<button type="button" class="btn icon-btn btn-xs btn-secondary" data-toggle="modal" data-target="#modals-load-content"
data-id="'.$userBusiness->user_id.'"
data-id="' . $userBusiness->user_id . '"
data-action="business-user-detail"
data-back=""
data-modal="modal-xl"
data-init_from="admin"
data-route="'.route('modal_load').'"><span class="fa fa-calculator"></span></button>'.
(config('app.debug') === true ? '<a href="' . route('admin_business_user_detail', [$userBusiness->user_id]) . '" class="btn icon-btn btn-xs btn-primary"><span class="fa fa-calculator"></span></a>' : '');
data-route="' . route('modal_load') . '"><span class="fa fa-calculator"></span></button>' .
(config('app.debug') === true ? '<a href="' . route('admin_business_user_detail', [$userBusiness->user_id]) . '" class="btn icon-btn btn-xs btn-primary"><span class="fa fa-calculator"></span></a>' : '');
})
->addColumn('m_account', function (UserBusiness $userBusiness) {
return $userBusiness->m_account;
@ -169,19 +172,19 @@ class BusinessController extends Controller
return $userBusiness->user_level_name;
})
->addColumn('is_qual_kp', function (UserBusiness $userBusiness) {
if($userBusiness->m_level_id){
if ($userBusiness->m_level_id) {
$isQualKP = ($userBusiness->sales_volume_points_sum >= $userBusiness->qual_kp) ? true : false;
return '<span class="badge '.($isQualKP ? 'badge-outline-success' : 'badge-outline-danger').'"> KU '.$userBusiness->qual_kp.'</span>';
return '<span class="badge ' . ($isQualKP ? 'badge-outline-success' : 'badge-outline-danger') . '"> KU ' . $userBusiness->qual_kp . '</span>';
}
return '-';
})
->addColumn('sales_volume_KP_points', function (UserBusiness $userBusiness) {
return '<div class="no-line-break">'.$userBusiness->sales_volume_points_sum.'</div>'.
'<span class="small no-line-break">E: '.$userBusiness->sales_volume_KP_points.' | S: '.$userBusiness->sales_volume_points_shop.'</span>';
return '<div class="no-line-break">' . $userBusiness->sales_volume_points_sum . '</div>' .
'<span class="small no-line-break">E: ' . $userBusiness->sales_volume_KP_points . ' | S: ' . $userBusiness->sales_volume_points_shop . '</span>';
})
->addColumn('sales_volume_total', function (UserBusiness $userBusiness) {
return '<div class="no-line-break">'.formatNumber($userBusiness->sales_volume_total_sum).' &euro;</div>'.
'<span class="small no-line-break">E: '.formatNumber($userBusiness->sales_volume_total).' | S: '.formatNumber($userBusiness->sales_volume_total_shop).'</span>';
return '<div class="no-line-break">' . formatNumber($userBusiness->sales_volume_total_sum) . ' &euro;</div>' .
'<span class="small no-line-break">E: ' . formatNumber($userBusiness->sales_volume_total) . ' | S: ' . formatNumber($userBusiness->sales_volume_total_shop) . '</span>';
})
->addColumn('email', function (UserBusiness $userBusiness) {
return $userBusiness->email;
@ -193,23 +196,23 @@ class BusinessController extends Controller
return $userBusiness->last_name;
})
->addColumn('sponsor', function (UserBusiness $userBusiness) {
if($userBusiness->sponsor){
if ($userBusiness->sponsor) {
$sponsor = "";
if($userBusiness->sponsor->is_sponsor){
$sponsor .= $userBusiness->sponsor->first_name." ".$userBusiness->sponsor->last_name;
$sponsor .= " &nbsp;".'<button type="button" class="btn icon-btn btn-xs btn-secondary" data-toggle="modal" data-target="#modals-load-content"
data-id="'.$userBusiness->sponsor->user_id.'"
if ($userBusiness->sponsor->is_sponsor) {
$sponsor .= $userBusiness->sponsor->first_name . " " . $userBusiness->sponsor->last_name;
$sponsor .= " &nbsp;" . '<button type="button" class="btn icon-btn btn-xs btn-secondary" data-toggle="modal" data-target="#modals-load-content"
data-id="' . $userBusiness->sponsor->user_id . '"
data-action="business-user-detail"
data-back=""
data-modal="modal-xl"
data-init_from="admin"
data-route="'.route('modal_load').'"><span class="fa fa-calculator"></span></button><br>';
data-route="' . route('modal_load') . '"><span class="fa fa-calculator"></span></button><br>';
$sponsor .= '<span class="small no-line-break">' . $userBusiness->sponsor->email;
$sponsor .= ' | ' . $userBusiness->sponsor->m_account;
$sponsor .= '</span>';
}
$sponsor .= '<span class="small no-line-break">'.$userBusiness->sponsor->email;
$sponsor .= ' | '.$userBusiness->sponsor->m_account;
$sponsor .= '</span>';
}
return $sponsor;
}
return '-';
@ -222,25 +225,25 @@ class BusinessController extends Controller
return $userBusiness->active_date ? formatDate($userBusiness->active_date) : "-";
})
->filterColumn('m_account', function($query, $keyword) {
if($keyword != ""){
$query->whereRaw("m_account LIKE ?", '%'.$keyword.'%');
}
})
->filterColumn('first_name', function($query, $keyword) {
if($keyword != ""){
$query->whereRaw("first_name LIKE ?", '%'.$keyword.'%');
->filterColumn('m_account', function ($query, $keyword) {
if ($keyword != "") {
$query->whereRaw("m_account LIKE ?", '%' . $keyword . '%');
}
})
->filterColumn('last_name', function($query, $keyword) {
if($keyword != ""){
$query->whereRaw("last_name LIKE ?", '%'.$keyword.'%');
->filterColumn('first_name', function ($query, $keyword) {
if ($keyword != "") {
$query->whereRaw("first_name LIKE ?", '%' . $keyword . '%');
}
})
->filterColumn('email', function($query, $keyword) {
if($keyword != ""){
$query->whereRaw("email LIKE ?", '%'.$keyword.'%');
->filterColumn('last_name', function ($query, $keyword) {
if ($keyword != "") {
$query->whereRaw("last_name LIKE ?", '%' . $keyword . '%');
}
})
->filterColumn('email', function ($query, $keyword) {
if ($keyword != "") {
$query->whereRaw("email LIKE ?", '%' . $keyword . '%');
}
})
@ -253,29 +256,29 @@ class BusinessController extends Controller
->rawColumns(['id', 'is_qual_kp', 'sales_volume_KP_points', 'sales_volume_total', 'sponsor', 'active_account'])
->make(true);
}
private function initCurrentlySearch($archive = false, $request = true)
{
$this->setFilterVars();
$query = User::join('user_accounts', 'account_id', '=', 'user_accounts.id')
->select('users.*', 'user_accounts.m_account', 'user_accounts.first_name', 'user_accounts.last_name')
->where('users.deleted_at', '=', null)
->where('users.id', '!=', 1)
->where('users.admin', "<", 4)
->where('users.m_level', "!=", null)
->where('users.payment_account', "!=", null);
// $query = User::with('account')->select('users.*')
if(Request::get('business_user_filter_active')){
if(Request::get('business_user_filter_active') == 1){
$query = User::join('user_accounts', 'account_id', '=', 'user_accounts.id')
->select('users.*', 'user_accounts.m_account', 'user_accounts.first_name', 'user_accounts.last_name')
->where('users.deleted_at', '=', null)
->where('users.id', '!=', 1)
->where('users.admin', "<", 4)
->where('users.m_level', "!=", null)
->where('users.payment_account', "!=", null);
// $query = User::with('account')->select('users.*')
if (Request::get('business_user_filter_active')) {
if (Request::get('business_user_filter_active') == 1) {
$query->where('users.payment_account', ">=", now());
}
if(Request::get('business_user_filter_active') == 2){
if (Request::get('business_user_filter_active') == 2) {
$query->where('users.payment_account', "<", now());
}
if(Request::get('business_user_filter_active') == 3){
if (Request::get('business_user_filter_active') == 3) {
//both -> payment_account only not null
}
}
@ -283,18 +286,18 @@ class BusinessController extends Controller
}
private function userCurrentlyDatatable()
{
{
$query = $this->initCurrentlySearch();
return \DataTables::eloquent($query)
->addColumn('id', function (User $user) {
return '<button type="button" class="btn icon-btn btn-xs btn-secondary" data-toggle="modal" data-target="#modals-load-content"
data-id="'.$user->id.'"
data-id="' . $user->id . '"
data-action="business-user-detail"
data-back=""
data-modal="modal-xl"
data-init_from="admin"
data-route="'.route('modal_load').'"><span class="fa fa-calculator"></span></button>'.
(config('app.debug') === true ? '<a href="' . route('admin_business_user_detail', [$user->id]) . '" class="btn icon-btn btn-xs btn-primary"><span class="fa fa-calculator"></span></a>' : '');
data-route="' . route('modal_load') . '"><span class="fa fa-calculator"></span></button>' .
(config('app.debug') === true ? '<a href="' . route('admin_business_user_detail', [$user->id]) . '" class="btn icon-btn btn-xs btn-primary"><span class="fa fa-calculator"></span></a>' : '');
})
->addColumn('m_account', function (User $user) {
return $user->account ? $user->account->m_account : '';
@ -303,21 +306,21 @@ class BusinessController extends Controller
return $user->user_level ? $user->user_level->getLang('name') : '';
})
->addColumn('is_qual_kp', function (User $user) {
if($user->user_level){
if ($user->user_level) {
$qual_kp = $user->user_level->qual_kp;
$sales_volume_points_sum = $user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_points_KP_sum');
$isQualKP = ($sales_volume_points_sum >= $qual_kp) ? true : false;
return '<span class="badge '.($isQualKP ? 'badge-outline-success' : 'badge-outline-warning-dark').'"> KU '.$qual_kp.'</span>';
return '<span class="badge ' . ($isQualKP ? 'badge-outline-success' : 'badge-outline-warning-dark') . '"> KU ' . $qual_kp . '</span>';
}
return '-';
})
->addColumn('sales_volume_KP_points', function (User $user) {
return '<div class="no-line-break">'.$user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_points_KP_sum').'</div>'.
'<span class="small no-line-break">E: '.$user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_KP_points').' | S: '.$user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_points_shop').'</span>';
})
->addColumn('sales_volume_KP_points', function (User $user) {
return '<div class="no-line-break">' . $user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_points_KP_sum') . '</div>' .
'<span class="small no-line-break">E: ' . $user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_KP_points') . ' | S: ' . $user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_points_shop') . '</span>';
})
->addColumn('sales_volume_total', function (User $user) {
return '<div class="no-line-break">'.formatNumber($user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total_sum')).' &euro;</div>'.
'<span class="small no-line-break">E: '.formatNumber($user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total')).' | S: '.formatNumber($user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total_shop')).'</span>';
return '<div class="no-line-break">' . formatNumber($user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total_sum')) . ' &euro;</div>' .
'<span class="small no-line-break">E: ' . formatNumber($user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total')) . ' | S: ' . formatNumber($user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total_shop')) . '</span>';
})
->addColumn('email', function (User $user) {
return $user->email;
@ -329,24 +332,24 @@ class BusinessController extends Controller
return $user->account ? $user->account->last_name : '';
})
->addColumn('sponsor', function (User $user) {
if($user->user_sponsor){
if ($user->user_sponsor) {
$sponsor = "";
if($user->user_sponsor->account){
$sponsor .= $user->user_sponsor->account->first_name." ".$user->user_sponsor->account->last_name;
$sponsor .= " &nbsp;".'<button type="button" class="btn icon-btn btn-xs btn-secondary" data-toggle="modal" data-target="#modals-load-content"
data-id="'.$user->user_sponsor->id.'"
if ($user->user_sponsor->account) {
$sponsor .= $user->user_sponsor->account->first_name . " " . $user->user_sponsor->account->last_name;
$sponsor .= " &nbsp;" . '<button type="button" class="btn icon-btn btn-xs btn-secondary" data-toggle="modal" data-target="#modals-load-content"
data-id="' . $user->user_sponsor->id . '"
data-action="business-user-detail"
data-back=""
data-modal="modal-xl"
data-init_from="admin"
data-route="'.route('modal_load').'"><span class="fa fa-calculator"></span></button><br>';
}
$sponsor .= '<span class="small no-line-break">'.$user->user_sponsor->email;
if($user->user_sponsor->account){
$sponsor .= ' | '.$user->user_sponsor->account->m_account;
}
$sponsor .= '</span>';
data-route="' . route('modal_load') . '"><span class="fa fa-calculator"></span></button><br>';
}
$sponsor .= '<span class="small no-line-break">' . $user->user_sponsor->email;
if ($user->user_sponsor->account) {
$sponsor .= ' | ' . $user->user_sponsor->account->m_account;
}
$sponsor .= '</span>';
return $sponsor;
}
return '-';
@ -358,25 +361,25 @@ class BusinessController extends Controller
->addColumn('payment_account_date', function (User $user) {
return $user->payment_account ? $user->getPaymentAccountDateFormat(false) : "-";
})
->filterColumn('m_account', function($query, $keyword) {
if($keyword != ""){
$query->whereRaw("m_account LIKE ?", '%'.$keyword.'%');
}
})
->filterColumn('first_name', function($query, $keyword) {
if($keyword != ""){
$query->whereRaw("first_name LIKE ?", '%'.$keyword.'%');
->filterColumn('m_account', function ($query, $keyword) {
if ($keyword != "") {
$query->whereRaw("m_account LIKE ?", '%' . $keyword . '%');
}
})
->filterColumn('last_name', function($query, $keyword) {
if($keyword != ""){
$query->whereRaw("last_name LIKE ?", '%'.$keyword.'%');
->filterColumn('first_name', function ($query, $keyword) {
if ($keyword != "") {
$query->whereRaw("first_name LIKE ?", '%' . $keyword . '%');
}
})
->filterColumn('email', function($query, $keyword) {
if($keyword != ""){
$query->whereRaw("email LIKE ?", '%'.$keyword.'%');
->filterColumn('last_name', function ($query, $keyword) {
if ($keyword != "") {
$query->whereRaw("last_name LIKE ?", '%' . $keyword . '%');
}
})
->filterColumn('email', function ($query, $keyword) {
if ($keyword != "") {
$query->whereRaw("email LIKE ?", '%' . $keyword . '%');
}
})
->orderColumn('id', 'm_account $1')
@ -387,5 +390,5 @@ class BusinessController extends Controller
->orderColumn('active_account', 'payment_account $1')
->rawColumns(['id', 'is_qual_kp', 'sales_volume_KP_points', 'sales_volume_total', 'sponsor', 'active_account'])
->make(true);
}
}
}
}

View file

@ -12,13 +12,16 @@ use App\Mail\MailVerifyAccount;
use App\Services\PaymentHelper;
use App\Repositories\UserRepository;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Log;
class CronController extends Controller
{
protected $userRepo;
// Konstanten für bessere Lesbarkeit
private const CRON_KEY = 'CqZHL79FwUCcy9pjvi';
private const RUN_CRON_KEY = 'G8ZvEbnP8fEPfnWX4L';
/**
* Create a new controller instance.
@ -28,58 +31,94 @@ class CronController extends Controller
public function __construct(UserRepository $userRepo)
{
$this->userRepo = $userRepo;
// $this->middleware('auth');
Log::channel('cron')->info('CronController initialisiert');
}
/**
* Hauptindex-Methode für Cron-Jobs
*
* @return string
*/
public function index()
{
Log::channel('cron')->info('Cron-Index aufgerufen');
//$this->checkConfirmation();
//TODO
//SEPA Booking
//Mail reminder
return "Cron-Index ausgeführt";
}
public function action($action = false, $key = false){
if($key !== 'CqZHL79FwUCcy9pjvi'){
/**
* Führt eine bestimmte Cron-Aktion aus
*
* @param string|bool $action Die auszuführende Aktion
* @param string|bool $key Sicherheitsschlüssel
* @return mixed
*/
public function action($action = false, $key = false)
{
Log::channel('cron')->info('Cron-Aktion aufgerufen: ' . $action);
if($key !== self::CRON_KEY){
Log::channel('cron')->warning('Ungültiger Cron-Key verwendet: ' . $key);
abort(404);
}
if($action === 'check_payments_account'){
$this->checkPaymentsAccounts();
Log::channel('cron')->info('Starte Überprüfung der Zahlungskonten');
return $this->checkPaymentsAccounts();
}
Log::channel('cron')->warning('Unbekannte Aktion angefordert: ' . $action);
return response('Keine gültige Aktion angegeben', 400);
}
/**
* Show the application dashboard.
* Überprüft Benutzerbestätigungen und sendet Erinnerungen
*
* @return \Illuminate\Http\Response
* @return string
*/
public function checkConfirmation()
{
Log::channel('cron')->info('Starte Überprüfung der Benutzerbestätigungen');
$now = date('Y-m-d H:i:s');
$next = date('Y-m-d H:i:s', strtotime('+3 week'));
$users = User::where('confirmed', '=', 0)->where('confirmation_code_to', '<', $now)->get();
Log::channel('cron')->info('Gefundene unbestätigte Benutzer: ' . $users->count());
foreach ($users as $user) {
//delete user
if ($user->confirmation_code_remider == 1) {
Log::channel('cron')->warning('Lösche unbestätigten Benutzer: ' . $user->email);
$this->userRepo->deleteUser($user);
}
//send new remider
if ($user->confirmation_code_remider == 0) {
Mail::to($user->email)->locale($user->getLocale())->send(new MailVerifyAccount($user->confirmation_code, $user));
$user->confirmation_code_to = $next;
$user->confirmation_code_remider = 1;
$user->save();
if(!Util::isTestSystem()){
Log::channel('cron')->info('Sende Bestätigungserinnerung an: ' . $user->email);
Mail::to($user->email)->locale($user->getLocale())->send(new MailVerifyAccount($user->confirmation_code, $user));
$user->confirmation_code_to = $next;
$user->confirmation_code_remider = 1;
$user->save();
} else {
Log::channel('cron')->info('Testsystem: Bestätigungserinnerung an: ' . $user->email);
}
}
}
return "TOSK";
}
public function checkPaymentsAccounts(){
/**
* Überprüft Zahlungskonten und sendet Erinnerungen
*
* @return string
*/
public function checkPaymentsAccounts()
{
Log::channel('cron')->info('Starte Überprüfung der Zahlungskonten');
/*RULES
reminders
@ -93,207 +132,289 @@ class CronController extends Controller
*/
//max Date for reminder
$renewalDate = Carbon::now()->modify('+'.(config('mivita.remind_first_days')+1).' days');
//dump($renewalDate);
Log::channel('cron')->info('Erneuerungsdatum für Zahlungen: ' . $renewalDate->format('Y-m-d H:i:s'));
$users = User::where('payment_account', '!=', NULL)
->where('active', '=', 1)
->where('blocked', '!=', 1)
->where('payment_account', '<', $renewalDate)
->get();
/* $user = User::find(2);
$this->checkReminderPayments($user);
dump($user->daysActiveAccount());
dump($user->email." | ".$user->getPaymentAccountDateFormat());
die();*/
Log::channel('cron')->info('Gefundene Benutzer für Zahlungserinnerungen: ' . $users->count());
foreach ($users as $user){
Log::channel('cron')->info('Prüfe Zahlungserinnerungen für Benutzer: ' . $user->email);
$this->checkReminderPayments($user);
/* Abo Option deaktiviert
$this->userInitAboPayment($user);
*/
}
return "TOSK";
}
private function userInitAboPayment(User $user){
/**
* Initiiert Abo-Zahlungen für einen Benutzer
* hier geht es um die Mitglieschaft Abos - die sind derzeit deaktiviert
*
* @param User $user Benutzer
* @return bool
*/
private function userInitAboPayment(User $user)
{
if(!$user->isAcountAboPayDate()){
Log::channel('cron')->info('Kein Abo-Zahlungsdatum für Benutzer: ' . $user->email);
return false;
}
//user has a open Abo Payment
if($this->checkIsAboPaymentOpen($user)){
Log::channel('cron')->info('Offene Abo-Zahlung für Benutzer: ' . $user->email);
return false;
}
if($user->payment_order_product){
Log::channel('cron')->info('Starte Abo-Zahlung für Benutzer: ' . $user->email);
$this->buyProductAboPayment($user, $user->payment_order_product);
}
/*dump($user->daysActiveAccount());
dump($user->email." | ".$user->getPaymentAccountDateFormat());
dump('-------------------');*/
return true;
}
private function checkIsAboPaymentOpen(User $user){
/**
* Prüft, ob eine offene Abo-Zahlung existiert
*
* @param User $user Benutzer
* @return bool
*/
private function checkIsAboPaymentOpen(User $user)
{
$isOpen = UserHistory::whereUserId($user->id)
->whereAction('abo_open_payment')
->whereIdentifier($user->payment_account)
->where('status', '>=', 1) //open //error // payment
->get()->last();
if($isOpen){
Log::channel('cron')->info('Offene Abo-Zahlung gefunden für: ' . $user->email);
return true;
}
return false;
}
private function checkReminderPayments(User $user){
/* $isSend = $this->checkIsReminderSend($user, 31);
$isSend = $this->checkIsReminderSend($user, 32);
$isSend = $this->checkIsReminderSend($user, 33);
$isSend = $this->checkIsReminderSend($user, 34);
$isSend = $this->checkIsReminderSend($user, 35);
$isSend = $this->checkIsReminderSend($user, 36);
return ;*/
/**
* Prüft und sendet Zahlungserinnerungen basierend auf Benutzerkontostand
*
* @param User $user Benutzer
* @return bool
*/
private function checkReminderPayments(User $user)
{
//35 reminder_deaktiv, 36 reminder_deaktiv_sepa
if(!$user->isActiveAccount()){
/* Abo Option deaktiviert
if($user->isAboOption()){
$isSend = $this->checkIsReminderSend($user, 36);
return $isSend;
}
*/
Log::channel('cron')->info('Inaktives Konto für Benutzer: ' . $user->email);
$isSend = $this->checkIsReminderSend($user, 35);
return $isSend;
}
//34 reminder_last
if($user->daysActiveAccount() <= config('mivita.remind_last_days')){
Log::channel('cron')->info('Letzte Erinnerung für Benutzer: ' . $user->email . ' (Tage aktiv: ' . $user->daysActiveAccount() . ')');
$isSend = $this->checkIsReminderSend($user, 34);
return $isSend;
}
//33 reminder_sec
if($user->daysActiveAccount() <= config('mivita.remind_sec_days')){
/* Abo Option deaktiviert
if(!$user->isAboOption()){
$isSend = $this->checkIsReminderSend($user, 33);
return $isSend;
}
*/
Log::channel('cron')->info('Zweite Erinnerung für Benutzer: ' . $user->email . ' (Tage aktiv: ' . $user->daysActiveAccount() . ')');
$isSend = $this->checkIsReminderSend($user, 33);
return $isSend;
}
//31 reminder_first, 32 reminder_first_sepa
//31 reminder_first
if($user->daysActiveAccount() > config('mivita.remind_sec_days')){
/* Abo Option deaktiviert
if($user->isAboOption()){
$isSend = $this->checkIsReminderSend($user, 32);
return $isSend;
} */
Log::channel('cron')->info('Erste Erinnerung für Benutzer: ' . $user->email . ' (Tage aktiv: ' . $user->daysActiveAccount() . ')');
$isSend = $this->checkIsReminderSend($user, 31);
return $isSend;
}
return false;
}
private function checkIsReminderSend(User $user, $status){
/**
* Überprüft, ob eine Erinnerung bereits gesendet wurde
*
* @param User $user Benutzer
* @param int $status Status-Code der Erinnerung
* @return bool
*/
private function checkIsReminderSend(User $user, $status)
{
$isSend = UserHistory::whereUserId($user->id)
->whereAction('reminder_payments')
->whereIdentifier($user->payment_account)
->whereStatus($status)
->get()->last();
->latest()
->first();
if($isSend){
Log::channel('cron')->info('Erinnerung bereits gesendet für Benutzer: ' . $user->email . ' (Status: ' . $status . ')');
return true;
}
Log::channel('cron')->info('Sende neue Erinnerung für Benutzer: ' . $user->email . ' (Status: ' . $status . ')');
$referenz = $this->sendReminderMail($user, $status);
//is not sent create
UserHistory::create(['user_id' => $user->id, 'action'=>'reminder_payments', 'referenz'=>$referenz, 'identifier'=>$user->payment_account, 'status'=>$status]);
UserHistory::create([
'user_id' => $user->id,
'action' => 'reminder_payments',
'referenz' => $referenz,
'identifier' => $user->payment_account,
'status' => $status
]);
return false;
}
private function sendReminderMail(User $user, $status){
$days = $user->daysActiveAccount();
if($days < 0){
$days = $days*-1;
}
//dump($days);
//dump($status);
$pay_date = Carbon::parse($user->payment_account)->modify('- '.config('mivita.abo_booking_days').' days')->format('d.m.Y');
/**
* Sendet eine Erinnerungs-E-Mail an den Benutzer
*
* @param User $user Benutzer
* @param int $status Status-Code der Erinnerung
* @return int
*/
private function sendReminderMail(User $user, $status)
{
$days = abs($user->daysActiveAccount());
$pay_date = Carbon::parse($user->payment_account)
->modify('- ' . config('mivita.abo_booking_days') . ' days')
->format('d.m.Y');
$datetime = $user->getPaymentAccountDateFormat();
$price = "";
if($user->payment_order_id && isset($user->payment_order_product->price)){
$price = 'von '.$user->payment_order_product->getFormattedPrice().' EUR';
$price = 'von ' . $user->payment_order_product->getFormattedPrice() . ' EUR';
}
$message = __('reminder.copy_first_'.$status, ['days'=>$days, 'datetime'=>$datetime, 'price' =>$price, 'pay_date'=>$pay_date]);
$message_last = __('reminder.copy_last_'.$status, ['days'=>$days, 'datetime'=>$datetime, 'price' =>$price, 'pay_date'=>$pay_date]);
$button = __('reminder.button_'.$status);
$message = __('reminder.copy_first_' . $status, [
'days' => $days,
'datetime' => $datetime,
'price' => $price,
'pay_date' => $pay_date
]);
$message_last = __('reminder.copy_last_' . $status, [
'days' => $days,
'datetime' => $datetime,
'price' => $price,
'pay_date' => $pay_date
]);
$button = __('reminder.button_' . $status);
$message = preg_replace("/[\n\r]/","",$message);
$message_last = preg_replace("/[\n\r]/","",$message_last);
$message = preg_replace("/[\n\r]/", "", $message);
$message_last = preg_replace("/[\n\r]/", "", $message_last);
$data = [
'subject' => __('reminder.subject')." | ID: ".$status,
'subject' => __('reminder.subject') . " | ID: " . $status,
'message' => $message,
'message_last' => $message_last,
'url' => route('user_membership'),
'button' => $button,
];
//dump($data);
$sender = User::find(1);
$customer_mail = UserMessage::create([
'user_id' => $user->id,
'user_id' => $user->id,
'send_user_id' => $sender->id,
'email' => $user->email,
'subject' => $data['subject'],
'message' => $data['message']." ".$data['message_last'],
'message' => $data['message'] . " " . $data['message_last'],
]);
try{
if($status >= 34){
Mail::to($user->email)->locale($user->getLocale())->bcc(config('app.default_mail'))->send(new MailCustomMessage($user, $data, $sender, false));
}else{
Mail::to($user->email)->locale($user->getLocale())->send(new MailCustomMessage($user, $data, $sender, false));
try {
if(!Util::isTestSystem()){
if($status >= 34){
Log::channel('cron')->info('Sende kritische Erinnerung mit BCC an: ' . $user->email);
Mail::to($user->email)
->locale($user->getLocale())
->bcc(config('app.default_mail'))
->send(new MailCustomMessage($user, $data, $sender, false));
} else {
Log::channel('cron')->info('Sende normale Erinnerung an: ' . $user->email);
Mail::to($user->email)
->locale($user->getLocale())
->send(new MailCustomMessage($user, $data, $sender, false));
}
} else {
Log::channel('cron')->info('Testsystem: E-Mail-Versand simuliert für: ' . $user->email);
}
}
catch(\Exception $e){
\Log::channel('cron')->error('Mail Error: '.$e->getMessage());
// Never reached
} catch(\Exception $e) {
Log::channel('cron')->error('Mail-Fehler für Benutzer ' . $user->email . ': ' . $e->getMessage());
$customer_mail->fail = true;
$customer_mail->error = $e->getMessage();
$customer_mail->save();
return 0;
}
$customer_mail->send = true;
$customer_mail->sent_at = now();
$customer_mail->save();
Log::channel('cron')->info('Erinnerungsmail erfolgreich gesendet an: ' . $user->email);
return 1;
}
private function buyProductAboPayment($user, $product){
/**
* Kauft ein Produkt mit Abo-Zahlung
*
* @param User $user Benutzer
* @param object $product Produkt
* @return void
*/
private function buyProductAboPayment($user, $product)
{
Log::channel('cron')->info('Starte Abo-Produktkauf für Benutzer: ' . $user->email);
$paymentHelper = new PaymentHelper();
$paymentHelper->setProduct($product);
$paymentHelper->initELVPayment($user);
Log::channel('cron')->info('Abo-Produktkauf abgeschlossen für: ' . $user->email);
}
/**
* Führt das Cron-Script aus
*
* @param string $key Sicherheitsschlüssel
* @return \Illuminate\Http\Response
*/
public function runCron($key)
{
if($key !== 'G8ZvEbnP8fEPfnWX4L'){
Log::channel('cron')->info('Cron-Script-Ausführung angefordert');
if($key !== self::RUN_CRON_KEY){
Log::channel('cron')->warning('Ungültiger Cron-Script-Key verwendet: ' . $key);
abort(404);
}
if(Util::isTestSystem()){
exec("/bin/bash ../cron_script_local.sh 2>&1", $out, $result);
}else{
exec("/bin/bash ../cron_script_server.sh 2>&1", $out, $result);
}
echo "Returncode: " .$result ."<br>";
echo "Ausgabe des Scripts: " ."<br>";
$scriptPath = Util::isTestSystem() ? '../cron_script_local.sh' : '../cron_script_server.sh';
Log::channel('cron')->info('Führe Script aus: ' . $scriptPath);
exec("/bin/bash {$scriptPath} 2>&1", $out, $result);
Log::channel('cron')->info('Cron-Script-Ausführung abgeschlossen mit Code: ' . $result);
echo "Returncode: " . $result . "<br>";
echo "Ausgabe des Scripts: " . "<br>";
echo "<pre>"; print_r($out);
exit;
/*return response()->view('cron.result', [
'result' => $result,
'output' => $out
]);*/
}
}

View file

@ -84,7 +84,7 @@ class CustomerController extends Controller
\Session()->flash('alert-save', true);
return redirect(route('admin_customer_detail', [$shopping_user->id]));
}
if ($data['action'] === 'shopping-user-store') {
if($data['action'] === 'shopping-user-store') {
$rules = array(
'billing_salutation' => 'required',
'billing_firstname'=>'required',

View file

@ -128,7 +128,7 @@ class FileController extends Controller
if(!Storage::disk($disk)->exists($path)){
// return Response::make('File no found.', 404);
return Response::make('Datei nicht gefunden.', 404);
}
$file = Storage::disk($disk)->get($path);
$mime = Storage::disk($disk)->mimeType($path);

View file

@ -2,11 +2,12 @@
namespace App\Http\Controllers;
use Image;
use Request;
use Validator;
use App\Models\Product;
use App\Models\ProductImage;
use App\Repositories\ProductRepository;
use Request;
use Validator;
@ -23,6 +24,7 @@ class ImportProductController extends Controller
public function import(){
dd('nicht aktiv, wenn muss geprüft werden, ob die funktion IMAGE existieren');
$path = app_path().'/../_static/products/';
include($path.'_all_products.php');
@ -73,7 +75,7 @@ class ImportProductController extends Controller
$name = \App\Services\Slim::sanitizeFileName($image['image']);
$name = uniqid() . '_' . $name;
$img = \Image::make($i_path);
$img = Image::make($i_path);
$img->resize(600, 800, function ($c) {
// $c->aspectRatio();
$c->upsize();

View file

@ -7,7 +7,7 @@ use App\Models\Ingredient;
use App\Models\IqImage;
use App\Models\ProductCategory;
use App\Models\ProductIngredient;
use\Request;
use Request;
class IngredientController extends Controller

View file

@ -198,6 +198,9 @@ class LeadController extends Controller
'city' => 'required',
'email' => 'required|string|email|max:255|exists:users,email',
'email-confirm' => 'required|same:email',
'bank_owner' => 'required',
'bank_iban' => 'required',
'bank_bic' => 'required',
);
if(!Request::get('same_as_billing')){
$rules = array_merge($rules, [

View file

@ -5,9 +5,10 @@ namespace App\Http\Controllers;
use Request;
use App\User;
use App\Models\Product;
use App\Models\UserAbo;
use App\Models\Homeparty;
use App\Models\UserLevel;
use App\Models\UserLevel;
use App\Models\UserCredit;
use App\Models\ShoppingUser;
use App\Services\HTMLHelper;
@ -99,7 +100,7 @@ class ModalController extends Controller
$homeparty = Homeparty::find($data['id']);
$homeparty_user = HomepartyUser::find($data['user_id']);
$data['homeparty'] = $homeparty;
$ret = view("user.homeparty.modal_show_products", compact( 'data', 'homeparty', 'homeparty_user'))->render();
$ret = view("user.homeparty.modal_hp_show_products", compact( 'data', 'homeparty', 'homeparty_user'))->render();
}
if($data['action'] === 'user-level-edit'){
@ -153,6 +154,20 @@ class ModalController extends Controller
$UserCredit = UserCredit::find($data['id']); //current user form order
$ret = view("admin.payment.modal_credit_status", compact('UserCredit', 'data'))->render();
}
if($data['action'] === 'abo_update_settings'){
$user_abo = UserAbo::find($data['id']);
if($data['view'] === 'admin'){
$route = route('admin_abos_update', [$user_abo->id]);
}else{
$route = route('user_abos_update', [$data['view'], $user_abo->id]);
}
$ret = view("admin.abo.modal_abo_update", compact('user_abo', 'data', 'route'))->render();
}
if($data['action'] === 'abo-add-product') {
$user_abo = UserAbo::find($data['id']);
$ret = view("user.abo.modal_abo_show_products", compact( 'data', 'user_abo'))->render();
}
}
return response()->json(['response' => $data, 'html'=>$ret, 'status'=>$status]);
}

View file

@ -79,7 +79,48 @@ class PayoneController extends Controller
public function getShoppingPayment(){
return $this->shopping_payment;
}
public function setAboPayment($user_abo, $amount, $currency){
$this->reference = substr(uniqid('m', false), 0, 16);
$this->method = [
"clearingtype" => $user_abo->clearingtype,
"wallettype" => $user_abo->wallettype,
"pseudocardpan" => isset($user_abo->carddata['pseudocardpan']) ? $user_abo->carddata['pseudocardpan'] : '',
"cardexpiredate" => isset($user_abo->carddata['cardexpiredate']) ? $user_abo->carddata['cardexpiredate'] : '',
'userid' => $user_abo->payone_userid,
'onlinebanktransfertype' => '',
"request" => "authorization",
];
$this->aboInitPayment = [
'recurrence'=>'recurring',
'customer_is_present'=>'no',
'request' => 'authorization',
'amount' => $amount
];
$this->prepayment = [
"reference" => $this->reference, // a unique reference, e.g. order number
"amount" => $amount, // amount in smallest currency unit, i.e. cents
"currency" => $currency,
"param" => $this->shopping_order->id,
];
$this->shopping_payment = ShoppingPayment::create([
'shopping_order_id' => $this->shopping_order->id,
'clearingtype' => $this->method["clearingtype"],
'wallettype' => $this->method["wallettype"],
'onlinebanktransfertype' => $this->method["onlinebanktransfertype"],
'carddata' => $user_abo->carddata,
'reference' => $this->reference,
'amount' => $amount,
'currency' => $currency,
'is_abo' => $this->shopping_order->is_abo,
'abo_interval' => 0,
'mode' => $this->shopping_order->mode,
]);
}
//make Payone payment
public function setPrePayment($payment_method, $amount, $currency, $ret = []){
@ -87,7 +128,7 @@ class PayoneController extends Controller
$this->setMethod($payment_method, $ret);
$this->urls = [
'successurl' => route('checkout.transaction_status', ['success', $this->reference]),
'successurl' => route('checkout.transaction_status', ['success', $this->reference]),
'errorurl' => route('checkout.transaction_status', ['error', $this->reference]),
'backurl' => route('checkout.transaction_status', ['cancel', $this->reference]),
];
@ -100,10 +141,30 @@ class PayoneController extends Controller
];
//init Abo
if($this->shopping_order->is_abo){
$this->aboInitPayment = [
'recurrence'=>'recurring',
'customer_is_present'=>'yes'
];
if($this->method["clearingtype"] === "cc"){
$this->aboInitPayment = [
'recurrence'=>'recurring',
'customer_is_present'=>'yes',
'request' => 'authorization',
'amount' => $amount,
];
$this->method['request'] = 'authorization';
}
if($this->method["clearingtype"] === "wlt"){
//payment for Abo PayPal
$this->aboInitPayment = [
'recurrence'=>'recurring',
'customer_is_present'=>'yes',
'request' => 'authorization',
'amount' => $amount,
'add_paydata[redirection_mode]' => 'DIRECT_TO_MERCHANT',
];
$this->setDeliverylData($this->shopping_user);
$this->method['request'] = 'authorization';
}
}
$this->shopping_payment = ShoppingPayment::create([
@ -111,11 +172,13 @@ class PayoneController extends Controller
'clearingtype' => $this->method["clearingtype"],
'wallettype' => $this->method["wallettype"],
'onlinebanktransfertype' => $this->method["onlinebanktransfertype"],
'carddata' => isset($ret['cc']) ? $ret['cc'] : null,
'reference' => $this->reference,
'amount' => $amount,
'currency' => $currency,
'is_abo' => $this->shopping_order->is_abo,
'abo_interval' => $this->shopping_order->abo_interval,
'identifier' => Util::getUserShopIdentifier(),
'mode' => $this->shopping_order->mode,
]);
@ -163,6 +226,8 @@ class PayoneController extends Controller
'onlinebanktransfertype' => "",
"request" => "authorization"
];
}
//Online-Überweisung
if($payment_method[0] === 'sb'){
@ -240,17 +305,17 @@ class PayoneController extends Controller
}
public function onlyPaymentResponse(){
$request = array_merge($this->default, $this->personalData, $this->deliveryData, $this->method, $this->aboInitPayment, $this->prepayment, $this->urls);
$request = array_merge($this->default, $this->personalData, $this->deliveryData, $this->method, $this->prepayment, $this->aboInitPayment, $this->urls);
$response = Payone::sendRequest($request);
return $response;
}
public function ResponseData(){
public function ResponseData($is_abo = false){
$request = array_merge($this->default, $this->personalData, $this->deliveryData, $this->method, $this->aboInitPayment, $this->prepayment, $this->urls);
$request = array_merge($this->default, $this->personalData, $this->deliveryData, $this->method, $this->prepayment, $this->aboInitPayment, $this->urls);
//dd($request);
//RECHNUNG MIV
if($this->shopping_payment->clearingtype === 'fnc' && $this->shopping_payment->onlinebanktransfertype === 'MIV'){
$payt = PaymentTransaction::create([
'shopping_payment_id' => $this->shopping_payment->id,
'request' => $this->method['request'],
@ -262,6 +327,9 @@ class PayoneController extends Controller
'mode' => $this->shopping_payment->mode,
]);
Util::setUserHistoryValue(['status'=>5]);
if($is_abo){
return $this->reference;
}
return redirect(route('checkout.transaction_approved', [$payt->id, $this->reference]));
exit;
}
@ -271,6 +339,12 @@ class PayoneController extends Controller
* status APPROVED / REDIRECT / ERROR / PENDING
*/
if($response['status'] === 'ERROR'){
MyLog::writeLog(
'payone',
'error',
'PayPal Preauthorization Fehler: ' . $response['errormessage'],
$response
);
PaymentTransaction::create([
'shopping_payment_id' => $this->shopping_payment->id,
'request' => $this->method['request'],
@ -281,6 +355,9 @@ class PayoneController extends Controller
'mode' => $this->shopping_payment->mode,
]);
Util::setUserHistoryValue(['status'=>3]);
if($is_abo){
return $response;
}
\Session::flash('errormessage', $response['errormessage']);
\Session::flash('customermessage', $response['customermessage']);
return redirect(route('checkout.checkout_card'));
@ -298,6 +375,9 @@ class PayoneController extends Controller
]);
Util::setUserHistoryValue(['status'=>4]);
if($is_abo){
return $response;
}
return redirect()->away($response["redirecturl"]);
exit;
@ -316,6 +396,9 @@ class PayoneController extends Controller
]);
Util::setUserHistoryValue(['status'=>5]);
if($is_abo){
return $response;
}
if($payt->shopping_payment->clearingtype === "vor"){
//vorkasse
@ -335,7 +418,6 @@ class PayoneController extends Controller
exit;
}
var_dump($response);
die();
//txid
@ -407,6 +489,27 @@ class PayoneController extends Controller
return Payone::sendRequest($request);
}
public function setDeliverylData($shopping_user){
if($shopping_user->same_as_billing == true){
$this->deliveryData = [
'shipping_firstname' => $shopping_user->billing_firstname,
'shipping_lastname' => $shopping_user->billing_lastname,
'shipping_zip' => $shopping_user->billing_zipcode,
'shipping_city' => $shopping_user->billing_city,
'shipping_country' => $shopping_user->billing_country->code,
'shipping_street' => $shopping_user->billing_address,
];
}else{
$this->deliveryData = [
'shipping_firstname' => $shopping_user->shipping_firstname,
'shipping_lastname' => $shopping_user->shipping_lastname,
'shipping_zip' => $shopping_user->shipping_zipcode,
'shipping_city' => $shopping_user->shipping_city,
'shipping_country' => $shopping_user->shipping_country->code,
'shipping_street' => $shopping_user->shipping_address,
];
}
}
/* public function getPDFFile($mandateId)
{
@ -492,17 +595,7 @@ class PayoneController extends Controller
public function setDeliverylData($data){
$this->deliveryData = [
"shipping_company" => "Mr.",
"shipping_firstname" => "Henry",
"shipping_lastname" => "Tudor",
"shipping_street" => "Royal Street 1",
"shipping_zip" => "24118",
"shipping_city" => "Kiel",
"shipping_country" => "DE",
];
}
*/

View file

@ -41,24 +41,25 @@ class PaymentCreditController extends Controller
}
public function store(){
public function store()
{
$data = Request::all();
if(isset($data['action']) && $data['action'] === 'add-user-credit'){
if(!isset($data['member_id']) || !$user = User::find($data['member_id'])){
if (isset($data['action']) && $data['action'] === 'add-user-credit') {
if (!isset($data['member_id']) || !$user = User::find($data['member_id'])) {
\Session()->flash('alert-error', 'Vertriebspartner nicht gefunden');
return back();
}
if(!isset($data['credit'])){
if (!isset($data['credit'])) {
\Session()->flash('alert-error', 'Bitte Betrag eingeben');
return back();
}
if(!isset($data['message'])){
if (!isset($data['message'])) {
\Session()->flash('alert-error', 'Bitte Betreff eingeben');
return back();
}
$credit = Util::reFormatNumber($data['credit']);
$credit = number_format($credit, 2, '.', '');
$credit = number_format($credit, 2, '.', '');
Payment::addUserCreditMargin($user, $credit, 3, $data['message']);
\Session()->flash('alert-success', "Guthaben hinzugefügt");
}
@ -66,11 +67,12 @@ class PaymentCreditController extends Controller
return redirect(route('admin_payments_credit'));
}
public function create(){
public function create()
{
$data = Request::all();
if(isset($data['action'])){
if($data['action'] === 'create_credit'){
if(!isset($data['userid'])){
if (isset($data['action'])) {
if ($data['action'] === 'create_credit') {
if (!isset($data['userid'])) {
abort(404);
}
$user = User::findOrFail($data['userid']);
@ -79,7 +81,7 @@ class PaymentCreditController extends Controller
\Session()->flash('alert-success', "Gutschrift erstellt");
return redirect($data['back']);
}
if($data['action'] === 'user-credit-status'){
if ($data['action'] === 'user-credit-status') {
$UserCredit = UserCredit::findOrFail($data['id']);
$UserCredit->status = $data['status'];
$UserCredit->save();
@ -89,34 +91,38 @@ class PaymentCreditController extends Controller
}
}
private function setFilterVars(){
if(!session('credit_filter_month')){
private function setFilterVars()
{
if (!session('credit_filter_month')) {
session(['credit_filter_month' => intval(date('m'))]);
}
if(!session('credit_filter_year')){
if (!session('credit_filter_year')) {
session(['credit_filter_year' => intval(date('Y'))]);
}
if(Request::get('credit_filter_name')){
if (Request::get('credit_filter_name')) {
session(['credit_filter_name' => Request::get('credit_filter_name')]);
} else {
session(['credit_filter_name' => '']);
}
if(Request::get('credit_filter_month')){
if (Request::get('credit_filter_month')) {
session(['credit_filter_month' => Request::get('credit_filter_month')]);
}
if(Request::get('credit_filter_year')){
if (Request::get('credit_filter_year')) {
session(['credit_filter_year' => Request::get('credit_filter_year')]);
}
}
private function makeUserCreditItems(){
private function makeUserCreditItems()
{
$ret = [];
$UserCreditItems = UserCreditItem::wherePaid(false)->get();
foreach($UserCreditItems as $userCreditItem){
if(isset($ret[$userCreditItem->user_id])){
foreach ($UserCreditItems as $userCreditItem) {
if (isset($ret[$userCreditItem->user_id])) {
$ret[$userCreditItem->user_id]['sum'] += $userCreditItem->credit;
$ret[$userCreditItem->user_id]['entries'][$userCreditItem->id] = $userCreditItem;
}else{
if(!isset($userCreditItem->user)){
/* gelöschte User nicht anzeigen
} else {
if (!isset($userCreditItem->user)) {
/* gelöschte User nicht anzeigen
$user = User::withTrashed()->with(['account' => fn($q) => $q->withTrashed()])->where('id', $userCreditItem->user_id)->first();
$ret[$userCreditItem->user_id] = [
'user_id' => $userCreditItem->user_id,
@ -128,7 +134,7 @@ class PaymentCreditController extends Controller
'entries' => [$userCreditItem->id => $userCreditItem],
];
*/
}else{
} else {
$ret[$userCreditItem->user_id] = [
'user_id' => $userCreditItem->user_id,
'm_account' => $userCreditItem->user->account->m_account,
@ -138,20 +144,21 @@ class PaymentCreditController extends Controller
'sum' => $userCreditItem->credit,
'entries' => [$userCreditItem->id => $userCreditItem],
];
}
}
}
}
}
return $ret;
}
}
public function delete($id, $del){
public function delete($id, $del)
{
if($del === 'user_credit_item'){
if ($del === 'user_credit_item') {
$UserCreditItem = UserCreditItem::findOrFail($id);
if($deleteTime = $UserCreditItem->deleteTime()){
if ($deleteTime = $UserCreditItem->deleteTime()) {
$UserCreditItem->delete();
\Session()->flash('alert-success', "Guthaben ist gelöscht");
}else{
} else {
\Session()->flash('alert-error', "Guthaben kann nicht gelöscht werden");
}
}
@ -160,24 +167,25 @@ class PaymentCreditController extends Controller
private function initSearch($archive = false, $request = true)
{
$this->setFilterVars();
$date_start = Carbon::parse('01.'.Request::get('credit_filter_month').'.'.Request::get('credit_filter_year'))->format('Y-m-d');
$date_end = Carbon::parse('01.'.Request::get('credit_filter_month').'.'.Request::get('credit_filter_year'))->endOfMonth()->format('Y-m-d');
$date_start = Carbon::parse('01.' . Request::get('credit_filter_month') . '.' . Request::get('credit_filter_year'))->format('Y-m-d');
$date_end = Carbon::parse('01.' . Request::get('credit_filter_month') . '.' . Request::get('credit_filter_year'))->endOfMonth()->format('Y-m-d');
$query = UserCredit::with('user', 'user.account')->select('user_credits.*')
->whereBetween('date', [$date_start, $date_end]);
if(Request::get('credit_filter_name')){
->whereBetween('date', [$date_start, $date_end]);
if (Request::get('credit_filter_name')) {
$query->whereHas('user.account', function ($query) {
return $query->where('first_name', 'LIKE', '%'.Request::get('credit_filter_name').'%')
->orWhere('last_name', 'LIKE', '%'.Request::get('credit_filter_name').'%');
});
return $query->where('first_name', 'LIKE', '%' . Request::get('credit_filter_name') . '%')
->orWhere('last_name', 'LIKE', '%' . Request::get('credit_filter_name') . '%');
});
}
return $query;
}
public function datatable(){
public function datatable()
{
$query = $this->initSearch();
@ -194,57 +202,54 @@ class PaymentCreditController extends Controller
})
->addColumn('view', function (UserCredit $UserCredit) {
$ret = "";
if($UserCredit->isCredit()){
$ret .= '<a href="'.route('storage_file', [$UserCredit->id, 'credit', 'download']).'" class="btn btn-primary btn-xs"><i class="fa fa-download"></i></a> ';
$ret .= '<a href="'.route('storage_file', [$UserCredit->id, 'credit', 'stream']).'" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a><br>';
if ($UserCredit->isCredit()) {
$ret .= '<a href="' . route('storage_file', [$UserCredit->id, 'credit', 'download']) . '" class="btn btn-primary btn-xs"><i class="fa fa-download"></i></a> ';
$ret .= '<a href="' . route('storage_file', [$UserCredit->id, 'credit', 'stream']) . '" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a><br>';
$ret .= '<a href="'.route('storage_file', [$UserCredit->id, 'credit_detail', 'html']).'" target="_blank" class="btn btn-secondary btn-xs mt-2"><i class="fa fa-eye"></i></a> ';
$ret .= '<a href="'.route('storage_file', [$UserCredit->id, 'credit_detail', 'pdf']).'" target="_blank" class="btn btn-secondary btn-xs mt-2"><i class="fa fa-file-pdf" style="min-width:13.5px"></i></a> ';
}else{
$ret .= '<a href="' . route('storage_file', [$UserCredit->id, 'credit_detail', 'html']) . '" target="_blank" class="btn btn-secondary btn-xs mt-2"><i class="fa fa-eye"></i></a> ';
$ret .= '<a href="' . route('storage_file', [$UserCredit->id, 'credit_detail', 'pdf']) . '" target="_blank" class="btn btn-secondary btn-xs mt-2"><i class="fa fa-file-pdf" style="min-width:13.5px"></i></a> ';
} else {
$ret = "-";
}
return $ret;
})
->addColumn('total', function (UserCredit $UserCredit) {
return '<span class="no-line-break">'.$UserCredit->getFormattedTotal()." €</span>";
return '<span class="no-line-break">' . $UserCredit->getFormattedTotal() . " €</span>";
})
->addColumn('credits', function (UserCredit $UserCredit) {
$ret = "";
if($UserCredit->user_credit_items){
foreach($UserCredit->user_credit_items as $user_credit_item){
$ret .= nl2br($user_credit_item->getTransMessage())." / ".$user_credit_item->created_at->format('d.m.Y')."<br>";
if ($UserCredit->user_credit_items) {
foreach ($UserCredit->user_credit_items as $user_credit_item) {
$ret .= nl2br($user_credit_item->getTransMessage()) . " / " . $user_credit_item->created_at->format('d.m.Y') . "<br>";
}
}
return $ret;
})
->addColumn('status', function (UserCredit $UserCredit) {
return '<a href="#" data-toggle="modal" data-target="#modals-load-content" data-modal="modal-lg"
data-id="'.$UserCredit->id.'" data-route="'.route('modal_load').'" data-action="user-credit-status" data-view="">
<span class="badge badge-pill badge-'.$UserCredit->getStatusColor().'">'.$UserCredit->getStatusType().' <span class="ion ion-md-cash"></span></span>
data-id="' . $UserCredit->id . '" data-route="' . route('modal_load') . '" data-action="user-credit-status" data-view="">
<span class="badge badge-pill badge-' . $UserCredit->getStatusColor() . '">' . $UserCredit->getStatusType() . ' <span class="ion ion-md-cash"></span></span>
</a>';
})
->filterColumn('user.account.first_name', function($query, $keyword) {
if($keyword != ""){
->filterColumn('user.account.first_name', function ($query, $keyword) {
if ($keyword != "") {
$query->whereHas('user.account', function ($query) use ($keyword) {
return $query->where('first_name', 'LIKE', '%'.$keyword.'%');
return $query->where('first_name', 'LIKE', '%' . $keyword . '%');
});
}
})
->filterColumn('user.account.last_name', function($query, $keyword) {
if($keyword != ""){
->filterColumn('user.account.last_name', function ($query, $keyword) {
if ($keyword != "") {
$query->whereHas('user.account', function ($query) use ($keyword) {
return $query->where('last_name', 'LIKE', '%'.$keyword.'%');
return $query->where('last_name', 'LIKE', '%' . $keyword . '%');
});
}
})
->filterColumn('user.email', function($query, $keyword) {
if($keyword != ""){
->filterColumn('user.email', function ($query, $keyword) {
if ($keyword != "") {
$query->whereHas('user', function ($query) use ($keyword) {
return $query->where('email', 'LIKE', '%'.$keyword.'%');
return $query->where('email', 'LIKE', '%' . $keyword . '%');
});
}
})
@ -254,4 +259,4 @@ class PaymentCreditController extends Controller
->rawColumns(['total', 'credits', 'status', 'view'])
->make(true);
}
}
}

View file

@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use Carbon;
use Request;
use App\Services\Payment;
@ -19,7 +20,7 @@ class PaymentInvoiceController extends Controller
public function index()
{
$this->setFilterVars();
$data = [
'filter_months' => HTMLHelper::getTransMonths(),
@ -28,21 +29,24 @@ class PaymentInvoiceController extends Controller
return view('admin.payment.invoice', $data);
}
private function setFilterVars(){
private function setFilterVars()
{
if(!session('invoice_filter_month')){
if (!session('invoice_filter_month')) {
session(['invoice_filter_month' => intval(date('m'))]);
}
if(!session('invoice_filter_year')){
if (!session('invoice_filter_year')) {
session(['invoice_filter_year' => intval(date('Y'))]);
}
if(Request::get('invoice_filter_name')){
if (Request::get('invoice_filter_name')) {
session(['invoice_filter_name' => Request::get('invoice_filter_name')]);
} else {
session(['invoice_filter_name' => '']);
}
if(Request::get('invoice_filter_month')){
if (Request::get('invoice_filter_month')) {
session(['invoice_filter_month' => Request::get('invoice_filter_month')]);
}
if(Request::get('invoice_filter_year')){
if (Request::get('invoice_filter_year')) {
session(['invoice_filter_year' => Request::get('invoice_filter_year')]);
}
}
@ -50,53 +54,53 @@ class PaymentInvoiceController extends Controller
private function initSearch($archive = false, $request = true)
{
$this->setFilterVars();
$query = UserInvoice::with('shopping_order')->with('shopping_order.shopping_user')->select('user_invoices.*')
->where('user_invoices.month', '=', Request::get('invoice_filter_month'))
->where('user_invoices.year', '=', Request::get('invoice_filter_year'));
if(Request::get('invoice_filter_name')){
$query = UserInvoice::with('shopping_order')->with('shopping_order.shopping_user')->select('user_invoices.*')
->where('user_invoices.month', '=', Request::get('invoice_filter_month'))
->where('user_invoices.year', '=', Request::get('invoice_filter_year'));
if (Request::get('invoice_filter_name')) {
$query->whereHas('shopping_order.shopping_user', function ($query) {
return $query->where('billing_firstname', 'LIKE', '%'.Request::get('invoice_filter_name').'%')->orWhere('billing_lastname', 'LIKE', '%'.Request::get('invoice_filter_name').'%')->orWhere('billing_email', 'LIKE', '%'.Request::get('invoice_filter_name').'%');
return $query->where('billing_firstname', 'LIKE', '%' . Request::get('invoice_filter_name') . '%')->orWhere('billing_lastname', 'LIKE', '%' . Request::get('invoice_filter_name') . '%')->orWhere('billing_email', 'LIKE', '%' . Request::get('invoice_filter_name') . '%');
})->get();
}
return $query;
}
public function datatable(){
public function datatable()
{
$query = $this->initSearch();
return \DataTables::eloquent($query)
->addColumn('id', function (UserInvoice $UserInvoice) {
if($UserInvoice->shopping_order->auth_user_id){
if ($UserInvoice->shopping_order->auth_user_id) {
return '<a href="' . route('admin_sales_users_detail', [$UserInvoice->shopping_order->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
}
return '<a href="' . route('admin_sales_customers_detail', [$UserInvoice->shopping_order->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
})
->addColumn('total_shipping', function (UserInvoice $UserInvoice) {
return '<span class="no-line-break">'.$UserInvoice->shopping_order->getFormattedTotalShipping()." €</span>";
return '<span class="no-line-break">' . $UserInvoice->shopping_order->getFormattedTotalShipping() . " €</span>";
})
->addColumn('created_at', function (UserInvoice $UserInvoice) {
return $UserInvoice->created_at->format("d.m.Y");
})
->addColumn('txaction', function (UserInvoice $UserInvoice) {
if($UserInvoice->shopping_order){
if ($UserInvoice->shopping_order) {
return Payment::getShoppingOrderBadge($UserInvoice->shopping_order);
}
return "-";
})
->addColumn('status', function (UserInvoice $UserInvoice) {
return '<a href="#" data-toggle="modal" data-target="#modals-load-content" data-modal="modal-lg"
data-id="'.$UserInvoice->id.'" data-route="'.route('modal_load').'" data-action="user-credit-status" data-view="">
<span class="badge badge-pill badge-'.$UserInvoice->getStatusColor().'">'.$UserInvoice->getStatusType().'</span>
data-id="' . $UserInvoice->id . '" data-route="' . route('modal_load') . '" data-action="user-credit-status" data-view="">
<span class="badge badge-pill badge-' . $UserInvoice->getStatusColor() . '">' . $UserInvoice->getStatusType() . '</span>
</a>';
})
->addColumn('invoice', function (UserInvoice $UserInvoice) {
$ret = "";
$ret .= '<a href="'.route('storage_file', [$UserInvoice->shopping_order->id, 'invoice', 'download']).'" class="btn btn-primary btn-xs"><i class="fa fa-download"></i></a> ';
$ret .= '<a href="'.route('storage_file', [$UserInvoice->shopping_order->id, 'invoice', 'stream']).'" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a>';
$ret .= '<a href="' . route('storage_file', [$UserInvoice->shopping_order->id, 'invoice', 'download']) . '" class="btn btn-primary btn-xs"><i class="fa fa-download"></i></a> ';
$ret .= '<a href="' . route('storage_file', [$UserInvoice->shopping_order->id, 'invoice', 'stream']) . '" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a>';
return $ret;
})
->orderColumn('id', 'id $1')
@ -110,4 +114,4 @@ class PaymentInvoiceController extends Controller
->rawColumns(['id', 'shipping_order', 'txaction', 'total_shipping', 'status', 'txaction', 'invoice'])
->make(true);
}
}
}

View file

@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use Carbon;
use Request;
use App\Services\Payment;
@ -32,21 +33,24 @@ class PaymentPointsController extends Controller
return view('admin.payment.invoice', $data);
}
private function setFilterVars(){
private function setFilterVars()
{
if(!session('invoice_filter_month')){
if (!session('invoice_filter_month')) {
session(['invoice_filter_month' => intval(date('m'))]);
}
if(!session('invoice_filter_year')){
if (!session('invoice_filter_year')) {
session(['invoice_filter_year' => intval(date('Y'))]);
}
if(Request::get('invoice_filter_name')){
if (Request::get('invoice_filter_name')) {
session(['invoice_filter_name' => Request::get('invoice_filter_name')]);
} else {
session(['invoice_filter_name' => '']);
}
if(Request::get('invoice_filter_month')){
if (Request::get('invoice_filter_month')) {
session(['invoice_filter_month' => Request::get('invoice_filter_month')]);
}
if(Request::get('invoice_filter_year')){
if (Request::get('invoice_filter_year')) {
session(['invoice_filter_year' => Request::get('invoice_filter_year')]);
}
}
@ -54,59 +58,59 @@ class PaymentPointsController extends Controller
private function initSearch($archive = false, $request = true)
{
$this->setFilterVars();
$query = UserInvoice::with('shopping_order')->with('shopping_order.shopping_user')->select('user_invoices.*')
->where('user_invoices.month', '=', Request::get('invoice_filter_month'))
->where('user_invoices.year', '=', Request::get('invoice_filter_year'));
if(Request::get('invoice_filter_name')){
$query->where('shopping_order.shopping_user.billing_firstname', 'LIKE', '%'.Request::get('invoice_filter_name').'%');
$query->where('shopping_order.shopping_user.billing_lastname', 'LIKE', '%'.Request::get('invoice_filter_name').'%');
$query->where('shopping_order.shopping_user.billing_email', 'LIKE', '%'.Request::get('invoice_filter_name').'%');
$query = UserInvoice::with('shopping_order')->with('shopping_order.shopping_user')->select('user_invoices.*')
->where('user_invoices.month', '=', Request::get('invoice_filter_month'))
->where('user_invoices.year', '=', Request::get('invoice_filter_year'));
if (Request::get('invoice_filter_name')) {
$query->where('shopping_order.shopping_user.billing_firstname', 'LIKE', '%' . Request::get('invoice_filter_name') . '%');
$query->where('shopping_order.shopping_user.billing_lastname', 'LIKE', '%' . Request::get('invoice_filter_name') . '%');
$query->where('shopping_order.shopping_user.billing_email', 'LIKE', '%' . Request::get('invoice_filter_name') . '%');
}
//->orderBy('created_at', 'DESC');
/* $query = FlexHour::leftJoin("flex_hour_items", function($join) {
/* $query = FlexHour::leftJoin("flex_hour_items", function($join) {
$join->on("flex_hour_items.flex_hour_id","=","flex_hours.id");
$join->where("flex_hour_items.date","=", FlexHourItemBot::$date);
})*/
return $query;
}
public function datatable(){
public function datatable()
{
$query = $this->initSearch();
return \DataTables::eloquent($query)
->addColumn('id', function (UserInvoice $UserInvoice) {
if($UserInvoice->shopping_order->auth_user_id){
if ($UserInvoice->shopping_order->auth_user_id) {
return '<a href="' . route('admin_sales_users_detail', [$UserInvoice->shopping_order->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
}
return '<a href="' . route('admin_sales_customers_detail', [$UserInvoice->shopping_order->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
})
->addColumn('total_shipping', function (UserInvoice $UserInvoice) {
return '<span class="no-line-break">'.$UserInvoice->shopping_order->getFormattedTotalShipping()." €</span>";
return '<span class="no-line-break">' . $UserInvoice->shopping_order->getFormattedTotalShipping() . " €</span>";
})
->addColumn('created_at', function (UserInvoice $UserInvoice) {
return $UserInvoice->created_at->format("d.m.Y");
})
->addColumn('txaction', function (UserInvoice $UserInvoice) {
if($UserInvoice->shopping_order){
if ($UserInvoice->shopping_order) {
return Payment::getShoppingOrderBadge($UserInvoice->shopping_order);
}
return "-";
})
->addColumn('status', function (UserInvoice $UserInvoice) {
return '<a href="#" data-toggle="modal" data-target="#modals-load-content" data-modal="modal-lg"
data-id="'.$UserInvoice->id.'" data-route="'.route('modal_load').'" data-action="user-credit-status" data-view="">
<span class="badge badge-pill badge-'.$UserInvoice->getStatusColor().'">'.$UserInvoice->getStatusType().'</span>
data-id="' . $UserInvoice->id . '" data-route="' . route('modal_load') . '" data-action="user-credit-status" data-view="">
<span class="badge badge-pill badge-' . $UserInvoice->getStatusColor() . '">' . $UserInvoice->getStatusType() . '</span>
</a>';
})
->addColumn('invoice', function (UserInvoice $UserInvoice) {
$ret = "";
$ret .= '<a href="'.route('storage_file', [$UserInvoice->shopping_order->id, 'invoice', 'download']).'" class="btn btn-primary btn-xs"><i class="fa fa-download"></i></a> ';
$ret .= '<a href="'.route('storage_file', [$UserInvoice->shopping_order->id, 'invoice', 'stream']).'" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a>';
$ret .= '<a href="' . route('storage_file', [$UserInvoice->shopping_order->id, 'invoice', 'download']) . '" class="btn btn-primary btn-xs"><i class="fa fa-download"></i></a> ';
$ret .= '<a href="' . route('storage_file', [$UserInvoice->shopping_order->id, 'invoice', 'stream']) . '" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a>';
return $ret;
})
@ -118,4 +122,4 @@ class PaymentPointsController extends Controller
->rawColumns(['id', 'shipping_order', 'txaction', 'total_shipping', 'status', 'txaction', 'invoice'])
->make(true);
}
}
}

View file

@ -94,7 +94,7 @@ class SalesController extends Controller
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getShippedColor().'">'.$ShoppingOrder->getShippedType().'</span>';
})
->addColumn('payment_for', function (ShoppingOrder $ShoppingOrder) {
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getPaymentForColor().'">'.$ShoppingOrder->getPaymentForType().'</span>';
return Payment::getPaymentForBadge($ShoppingOrder);
})
->addColumn('invoice', function (ShoppingOrder $ShoppingOrder) {
return $ShoppingOrder->isInvoice() ? '<span class="no-line-break"><a href="'.route('storage_file', [$ShoppingOrder->id, 'invoice', 'download']).'" class="btn btn-primary btn-xs"><i class="fa fa-download"></i></a>
@ -132,9 +132,17 @@ class SalesController extends Controller
set_user_attr('filter_member_id', null);
return redirect(route('admin_sales_customers'));
}
$filter_user_shops = ShoppingOrder::join('user_shops', 'user_shop_id', '=', 'user_shops.id')->orderBy('slug')->get()->pluck('slug', 'id')->unique()->toArray();
$filter_user_shops = ShoppingOrder::select('user_shops.id', 'user_shops.slug')
->join('user_shops', 'shopping_orders.user_shop_id', '=', 'user_shops.id')
->orderBy('user_shops.slug')
->distinct()
->pluck('slug', 'id')
->toArray();
$filter_members = ShoppingOrder::join('users', 'member_id', '=', 'users.id')->groupBy('member_id')->join('user_accounts', 'account_id', '=', 'user_accounts.id')->select('users.id', 'users.email', 'user_accounts.first_name', 'user_accounts.last_name')->get();
//->pluck('email', 'id')->unique()->toArray();
$data = [
'filter_user_shops' => $filter_user_shops,
'filter_members' => $filter_members,
@ -270,7 +278,7 @@ class SalesController extends Controller
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getShippedColor().'">'.$ShoppingOrder->getShippedType().'</span>';
})
->addColumn('payment_for', function (ShoppingOrder $ShoppingOrder) {
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getPaymentForColor().'">'.$ShoppingOrder->getPaymentForType().'</span>';
return Payment::getPaymentForBadge($ShoppingOrder);
})
->addColumn('invoice', function (ShoppingOrder $ShoppingOrder) {
if(($ShoppingOrder->txaction === 'extern' || $ShoppingOrder->txaction === 'extern_paid') && $ShoppingOrder->wp_invoice_path){
@ -365,11 +373,13 @@ class SalesController extends Controller
if(isset($data['action'])){
if($data['action'] === 'create_invoice'){
$shopping_order = ShoppingOrder::findOrFail($data['id']);
$invoice_repo = new InvoiceRepository($shopping_order);
if($shopping_order->isInvoice()){
$invoice_repo->update($data);
}else{
$invoice_repo->createAndSalesVolume($data);
if($shopping_order->mode === 'live'){
$invoice_repo = new InvoiceRepository($shopping_order);
if($shopping_order->isInvoice()){
$invoice_repo->update($data);
}else{
$invoice_repo->createAndSalesVolume($data);
}
}
if(isset($data['view']) && $data['view'] === 'sales_customer'){
return redirect(route('admin_sales_customers_detail', [$shopping_order->id]));

View file

@ -0,0 +1,322 @@
<?php
namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use App\Models\Product;
use App\Models\ShoppingUser;
use App\Models\UserAbo;
use App\Models\UserAboItem;
use App\Repositories\AboRepository;
use App\Services\AboHelper;
use App\Services\AboOrderCart;
use App\Services\Shop;
use App\Services\UserService;
use App\User;
use Request;
use Yard;
class AboController extends Controller
{
protected $aboRepository;
public function __construct(AboRepository $aboRepository)
{
$this->middleware('active.account');
$this->aboRepository = $aboRepository;
}
public function index($view)
{
if ($view === 'me') {
// Nur Abos des aktuellen Benutzers
$user_abos = UserAbo::where('user_id', \Auth::user()->id)
->where('status', '>', 1);
if ($user_abos->count() > 0) {
return redirect(route('user_abos_detail', ['me', $user_abos->first()->id]));
}
return view('user.abo.index', [
'user_abos' => [],
'view' => 'me',
'isAdmin' => false
]);
}
if ($view === 'ot') {
$user_abos = UserAbo::where('member_id', \Auth::user()->id)
->where('status', '>', 1)
->where('is_for', 'ot')
->orderBy('id', 'desc')
->get();
return view('user.abo.index', [
'user_abos' => $user_abos,
'view' => 'ot',
'isAdmin' => false
]);
}
// Standardfall, wenn weder 'me' noch 'ot'
return view('user.abo.index', [
'user_abos' => [],
'view' => 'me',
'isAdmin' => false
]);
}
public function detail($view, $id)
{
$data = Request::all();
$user_abo = UserAbo::findOrFail($id);
$this->checkPermissions($view, $user_abo);
//init Yard
AboOrderCart::initYard($user_abo);
//holt die aktuellen UserAccount Daten oder die Userdaten des Abo
$customer_detail = AboOrderCart::getCustomerDetail();
AboOrderCart::makeOrderYard($user_abo);
$comp_products = [];
if ($user_abo->is_for === 'me') {
$comp_products = Shop::getCompProducts('abo-me');
}
$data = [
'user_abo' => $user_abo,
'isAdmin' => false,
'customer_detail' => $customer_detail,
'view' => $view,
'comp_products' => $comp_products,
];
return view('user.abo.detail', $data);
}
public function update($view, $id)
{
$data = Request::all();
$user_abo = UserAbo::findOrFail($id);
$this->checkPermissions($view, $user_abo);
if (isset($data['action'])) {
if ($data['action'] === 'abo_update_settings') {
$user_abo = UserAbo::findOrFail($data['id']);
$this->aboRepository->setModel($user_abo);
$this->aboRepository->update($data);
return redirect(route('user_abos_detail', [$view, $id]));
}
if (Request::ajax()) {
$message = false;
//addProduct
if ($data['action'] === 'addProduct') {
if ($product = Product::find($data['product_id'])) {
if ($UserAboItem = UserAboItem::where('user_abo_id', $user_abo->id)->where('product_id', $product->id)->where('comp', 0)->first()) {
$UserAboItem->qty = $UserAboItem->qty + 1;
$UserAboItem->save();
} else {
UserAboItem::create([
'user_abo_id' => $user_abo->id,
'product_id' => $product->id,
'comp' => 0,
'qty' => 1,
'status' => 1,
]);
}
}
}
//updateCart
if ($data['action'] === 'updateCart') {
//product_id | order_item_id | cart_order_id | qty
if (isset($data['product_id']) && $product = Product::find($data['product_id'])) {
if (isset($data['order_item_id']) && $UserAboItem = UserAboItem::find($data['order_item_id'])) {
if (isset($data['qty'])) {
$qty = (int) $data['qty'];
$qty = $qty < 1 ? 1 : $qty;
$qty = $qty > 100 ? 100 : $qty;
$UserAboItem->qty = $qty;
$UserAboItem->save();
}
}
}
}
//removeFromCart
if ($data['action'] === 'removeFromCart') {
if (!isset($data['product_id']) || !($product = Product::find($data['product_id']))) {
$message = __('abo.product_not_found');
}
if (!isset($data['order_item_id']) || !($userAboItem = UserAboItem::find($data['order_item_id']))) {
$message = __('abo.abo_item_not_found');
}
$has_basis_product = $this->check_need_basis_product($user_abo, $product, $data['order_item_id']);
if (!$has_basis_product) {
$message = __('abo.need_basis_product');
}
if (!$message) {
$userAboItem->delete();
$user_abo->refresh(); // Abo neu laden um die aktualisierten Items zu erhalten
}
}
//updateCompProduct
if ($data['action'] === 'updateCompProduct') {
if ($UserAboItem = UserAboItem::where('user_abo_id', $user_abo->id)->where('comp', $data['comp_num'])->first()) {
$UserAboItem->product_id = $data['comp_product_id'];
$UserAboItem->save();
} else {
UserAboItem::create([
'user_abo_id' => $user_abo->id,
'product_id' => $data['comp_product_id'],
'comp' => $data['comp_num'],
'qty' => 1,
'status' => 1,
]);
}
}
AboOrderCart::initYard($user_abo);
AboOrderCart::makeOrderYard($user_abo); //reCalculateShippingPrice
AboOrderCart::checkNumOfCompProducts($user_abo); //after reCalculateShippingPrice check it and remove or add comp product
if ($user_abo->is_for === 'me') {
$data['comp_products'] = Shop::getCompProducts('abo-me');
}
$error_message = $message ? $message : false;
$html_cart = view("admin.abo._order_abo_show", ['user_abo' => $user_abo, 'error_message' => $error_message])->render();
$html_comp = view("user.order.comp_product", $data)->render();
$amount = $user_abo->getFormattedAmount();
// $html_total = view("user.homeparty.show_total_order", ['homeparty' => $homeparty])->render();
return response()->json(['response' => true, 'data' => $data, 'html_cart' => $html_cart, 'html_comp' => $html_comp, 'amount' => $amount]);
}
}
}
public function check_need_basis_product($user_abo, $product, $order_item_id)
{
// Wenn das zu entfernende Produkt kein Basis-Produkt ist, keine weitere Prüfung nötig
if (AboHelper::getAboShowOn($product) !== 'base') {
return true;
}
// Prüfe ob noch ein anderes Basis-Produkt vorhanden ist
foreach ($user_abo->user_abo_items as $user_abo_item) {
if ($user_abo_item->id == $order_item_id) {
continue;
}
if (AboHelper::getAboShowOn($user_abo_item->product) === 'base') {
return true;
}
}
return false;
}
public function datatable($user_abo_id)
{
$user_abo = UserAbo::findOrFail($user_abo_id);
if (!$user_abo) {
abort(404);
}
//$user_abo->is_for === 'me'
$show_on_ids = ['12', '13'];
$query = Product::select('products.*')
->where('active', true)
->where(function ($q) use ($show_on_ids) {
foreach ($show_on_ids as $id) {
$q->orWhereJsonContains('show_on', $id);
}
})
->orderByRaw(
"CASE
WHEN JSON_CONTAINS(show_on, ?, '$') THEN 1
WHEN JSON_CONTAINS(show_on, ?, '$') THEN 2
ELSE 3 END",
[$show_on_ids[0], isset($show_on_ids[1]) ? $show_on_ids[1] : $show_on_ids[0]]
);
return \DataTables::eloquent($query)
->addColumn('add_card', function (Product $product) use ($user_abo) {
$ufactor = $user_abo->is_for === 'me' ? true : false;
$tax_free = $user_abo->is_for === 'me' ? true : Yard::instance('shopping')->getUserTaxFree();
return '<button type="button" class="btn btn-sm btn-md-extra btn-secondary add-product-basket" data-product-id="' . $product->id . '">
<strong>&euro; ' . $product->getFormattedPriceWith($tax_free, $ufactor, Yard::instance('shopping')->getUserCountry()) . '</strong>&nbsp; +<span class="ion ion-md-cart"></span>
</button>';
})
->addColumn('picture', function (Product $product) {
if (count($product->images)) {
return '<img class="img-fluid img-extra" alt="" src="' . route('product_image', [$product->images->first()->slug]) . '">';
}
return "";
})
->addColumn('name', function (Product $product) use ($user_abo) {
return '<strong>' . $product->getLang('name') . '</strong><br>' . get_abo_type_badge_by_product($product);
})
->addColumn('price_net', function (Product $product) use ($user_abo) {
$ufactor = $user_abo->is_for === 'me' ? true : false;
return '<span class="no-line-break">' . $product->getFormattedPriceWith(true, $ufactor, Yard::instance('shopping')->getUserCountry()) . " €</span>" . '<span class="no-line-break">' . $product->getFormattedPriceCurrencyWith(true, true, Yard::instance('shopping')->getUserCountry()) . '</span>';
})
->addColumn('price_gross', function (Product $product) use ($user_abo) {
$ufactor = $user_abo->is_for === 'me' ? true : false;
return '<span class="no-line-break">' . $product->getFormattedPriceWith(false, $ufactor, Yard::instance('shopping')->getUserCountry()) . " €</span>" . '<span class="no-line-break">' . $product->getFormattedPriceCurrencyWith(true, true, Yard::instance('shopping')->getUserCountry()) . '</span>';
})
->addColumn('action', function (Product $product) {
return '<button class="btn btn-default btn-sm icon-btn md-btn-flat product-tooltip" title="details" data-modal="modal-lg"
data-toggle="modal" data-target="#modals-load-content" data-id="' . $product->id . '" data-route="' . route('modal_load') . '"
data-action="user-order-show-product" data-view="customer"><i class="ion ion-md-eye"></i></button>';
})
->filterColumn('product', function ($query, $keyword) {
if ($keyword != "") {
$query->where('name', 'LIKE', '%' . $keyword . '%');
}
})
->orderColumn('name', 'name $1')
->orderColumn('product', 'name $1')
->orderColumn('number', 'number $1')
->orderColumn('points', 'points $1')
->orderColumn('price_net', 'price_net $1')
->orderColumn('price_gross', 'price_gross $1')
->orderColumn('contents_total', 'contents_total $1')
->orderColumn('weight', 'weight $1')
->rawColumns(['add_card', 'product', 'name', 'quantity', 'picture', 'price_net', 'price_gross', 'action'])
->make(true);
}
private function checkPermissions($view, $user_abo)
{
if ($view === 'me' && $user_abo->is_for !== 'me') {
abort(403, 'Unauthorized action. Is not for me');
}
if ($view === 'ot' && $user_abo->is_for !== 'ot') {
abort(403, 'Unauthorized action. Is not your customer');
}
if ($view === 'me' && $user_abo->user_id !== \Auth::user()->id) {
abort(403, 'Unauthorized action. Is not my abo');
}
if ($view === 'ot' && $user_abo->member_id !== \Auth::user()->id) {
abort(403, 'Unauthorized action. Is not my customer abo');
}
}
}

View file

@ -5,10 +5,13 @@ namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use App\Models\ShoppingUser;
use App\Repositories\CustomerRepository;
use App\Services\AboHelper;
use App\Services\CustomerPriority;
use App\Services\HTMLHelper;
use App\Services\ShoppingUserService;
use App\User;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Request;
use Validator;
@ -227,23 +230,51 @@ class CustomerController extends Controller
return redirect(route('user_customer_detail', [$shopping_user->id]));
}
private function checkShoppingUsersByEmail(){
//ist an dieser stelle nicht machbar, zu viele Datenbankzugriffe
//siehe App\Console\Commands\SyncShoppingUserData
/* $user = User::find(\Auth::user()->id);
ShoppingUserService::setFakerMail($user);
ShoppingUserService::syncNumbersByEmail($user);
ShoppingUserService::syncOrdersByEmail($user); */
}
public function getCustomers()
{
//$this->checkShoppingUsersByEmail();
$user = User::find(\Auth::user()->id);
//\Log::info('Current user ID: ' . $user->id);
$query = ShoppingUser::select(['id', 'billing_company', 'billing_salutation', 'billing_firstname', 'billing_lastname', 'billing_email', 'faker_mail', 'billing_zipcode', 'billing_city', 'billing_country_id', 'orders', 'subscribed', 'created_at', 'number', 'mode', 'is_like', 'wp_order_number'])
->where('shopping_users.member_id', '=', $user->id);
//->groupBy('shopping_users.number');
->with('billing_country')
->whereIn('id', function($query) {
$query->select(DB::raw('MAX(id)'))
->from('shopping_users')
->groupBy('billing_email');
})->where('shopping_users.member_id', '=', $user->id)->where('shopping_users.auth_user_id', '=', NULL);
/*set_user_attr('filter_member_id', Request::get('filter_member_id'));
if(Request::get('filter_member_id') != ""){
$query->where('member_id', '=', Request::get('filter_member_id'));
}*/
if(Request::get('isfor') === 'ot-member'){ //Bestellung für Kunden
}
if(Request::get('isfor') === 'ot-customer' || Request::get('isfor') === 'abo-ot-customer'){ //Bestellung für Kunden Zahlungslink
$query->where(function($q) {
$q->where('shopping_users.faker_mail', '!=', 1)
->orWhereNull('shopping_users.faker_mail');
});
}
//\Log::info('SQL Query: ' . $query->toSql());
//\Log::info('Query Bindings: ' . print_r($query->getBindings(), true));
return \DataTables::eloquent($query)
->addColumn('send_to', function (ShoppingUser $ShoppingUser) {
$ot = Request::get('isfor') ? Request::get('isfor') : 'ot-member';
if(Request::get('isfor') === 'abo-ot-customer' && AboHelper::memberHasAbo($ShoppingUser)){
return '<span class="badge badge-pill badge-success"><i class="fa fa-check-circle"></i> '.__('abo.abo_assigned').'</span>';
}
return $ShoppingUser->is_like ? '<span class="badge badge-pill badge-warning"><i class="fa fa-clock"></i> '.__('customer.under_review').'</span>' : '<a href="' . route('user_order_my_delivery', [$ot, $ShoppingUser->id]) . '" class="btn btn-sm btn-secondary"><span class="fa fa-shopping-cart"></span> '.__('customer.select').'</a>';
})
->addColumn('billing_email', function (ShoppingUser $ShoppingUser) {
@ -262,7 +293,7 @@ class CustomerController extends Controller
return $ShoppingUser->firstEntryByNumber()->created_at->format('d.m.Y');
})
->addColumn('orders', function (ShoppingUser $ShoppingUser) {
return $ShoppingUser->lastEntryByNumber()->orders;
return $ShoppingUser->orders;
})
->addColumn('subscribed', function (ShoppingUser $ShoppingUser) {
return get_active_badge($ShoppingUser->subscribed);

View file

@ -10,12 +10,14 @@ use Request;
use App\User;
use App\Mail\MailInfo;
use App\Models\Product;
use App\Services\Payment;
use App\Models\UserHistory;
use App\Models\ShoppingOrder;
use App\Services\UserService;
use App\Models\ShippingCountry;
use App\Models\ShoppingInstance;
use Illuminate\Support\Facades\Mail;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Mail;
class MembershipController extends Controller
@ -39,11 +41,35 @@ class MembershipController extends Controller
if($user->payment_account){
$diff_months = Carbon::now()->diffInMonths(Carbon::parse($user->payment_account)) +1;
}
$userShoppingOrders = ShoppingOrder::with('shopping_user', 'shopping_payments')->select('shopping_orders.*')
->where('auth_user_id', '=', $user->id)
->where('txaction', '!=', NULL)
->whereIn('payment_for', [1, 2])
->orderBy('created_at', 'DESC')
->get();
$userHistoryPaymentOrder = UserHistory::whereUserId($user->id)->whereAction('payment_order')->get()->last();
$userHistoryUpgradeOrder = UserHistory::whereUserId($user->id)->whereAction('upgrade_order')->get()->last();
$userHistoryPaymentOrder = null;
$userHistoryUpgradeOrder = null;
/* Bezhalung ist nur 29 Tage vor ablauf möglich */
/* isRenewalAccount payment_account date - config('mivita.renewal_days') Vertragsverlängerung */
if($user->isRenewalAccount()){
//Acount ist noch nicht verlängert / bezahlt
if ($user->payment_account) {
//Die Order muss größer als das Datum sein.
$payment_greaterThan = Carbon::parse($user->payment_account)->modify('-'.(config('mivita.renewal_days')+1).' days');
$userHistoryPaymentOrder = UserHistory::whereUserId($user->id)->whereAction('payment_order')->where('created_at', '>=', $payment_greaterThan)->get()->last();
}
}
if($user->isActiveAccount() && !$user->isActiveShop()){
$payment_greaterThan = Carbon::parse($user->payment_account)->modify('-'.(config('mivita.renewal_days')+1).' days');
$userHistoryUpgradeOrder = UserHistory::whereUserId($user->id)->whereAction('upgrade_order')->where('created_at', '>=', $payment_greaterThan)->get()->last();
}
$userHistoryDeleteMembership = UserHistory::whereUserId($user->id)->whereAction('delete_membership')->whereStatus(50)->get()->last();
$shipping_country_id = $this->checkShoppingCountry($user);
if(!$shipping_country_id){
abort(403, __('validation.custom.shipping_not_found'));
@ -60,6 +86,7 @@ class MembershipController extends Controller
'userHistoryUpgradeOrder' => $userHistoryUpgradeOrder,
'userHistoryDeleteMembership' => $userHistoryDeleteMembership,
'yard_info' => UserService::getYardInfo(),
'userShoppingOrders' => $userShoppingOrders,
];
return view('user.membership.index', $data);
@ -131,7 +158,7 @@ class MembershipController extends Controller
$image = $product->images->first()->slug;
}
$qty = Request::get('qty') ? Request::get('qty') : 1;
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), $qty, $product->getPriceWith(\App\Services\UserService::getTaxFree(), false, \App\Services\UserService::$user_country), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission]);
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), $qty, $product->getPriceWith(\App\Services\UserService::getTaxFree(), false, \App\Services\UserService::$user_country), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission, 'show_on' => $product->show_on]);
if(\App\Services\UserService::getTaxFree()){
Yard::setTax($cartItem->rowId, 0);
}else{

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,674 @@
<?php
namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use App\Mail\MailCustomPaymet;
use App\Models\Product;
use App\Models\ShippingCountry;
use App\Models\ShoppingInstance;
use App\Models\ShoppingOrder;
use App\Models\ShoppingUser;
use App\Models\UserHistory;
use App\Services\AboHelper;
use App\Services\OrderPaymentService;
use App\Services\Payment;
use App\Services\Shop;
use App\Services\UserService;
use App\Services\Util;
use App\User;
use Auth;
use Illuminate\Support\Facades\Mail;
use Request;
use Validator;
use Yard;
class OrderController extends Controller
{
public function __construct()
{
$this->middleware('active.account');
}
public function index()
{
$data = [
];
return view('user.order.index', $data);
}
public function detail($id)
{
$user = User::find(\Auth::user()->id);
$shopping_order = ShoppingOrder::findOrFail($id);
if($shopping_order->auth_user_id !== $user->id){
abort(404);
}
if( $shopping_order->payment_for === 6 || $shopping_order->payment_for === 7){
return redirect(route('user_shop_order_detail', [$shopping_order->id]));
abort(403, 'Kundenbestellung');
}
$shopping_order->getLastShoppingPayment();
$data = [
'shopping_order' => $shopping_order,
'isAdmin' => false,
];
return view('user.order.detail', $data);
}
public function ordersDatatable(){
$user = User::find(\Auth::user()->id);
$query = ShoppingOrder::with('shopping_user', 'shopping_payments')->select('shopping_orders.*')->where('auth_user_id', '=', $user->id)->where('txaction', '!=', NULL);
return \DataTables::eloquent($query)
->addColumn('id', function (ShoppingOrder $ShoppingOrder) {
return '<a href="'.route('user_order_detail', [$ShoppingOrder->id]).'" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
})
->addColumn('created_at', function (ShoppingOrder $ShoppingOrder) {
return $ShoppingOrder->created_at->format("d.m.Y");
})
->addColumn('txaction', function (ShoppingOrder $ShoppingOrder) {
return Payment::getShoppingOrderBadge($ShoppingOrder);
})
->addColumn('total_shipping', function (ShoppingOrder $ShoppingOrder) {
return '<span class="no-line-break">'.$ShoppingOrder->getFormattedTotalShipping()." €</span>";
})
->addColumn('payment', function (ShoppingOrder $ShoppingOrder) {
return $ShoppingOrder->getLastShoppingPayment('getPaymentType');
})
->addColumn('shipped', function (ShoppingOrder $ShoppingOrder) {
if($ShoppingOrder->payment_for === 8){
return '<button type="button" class="btn btn-xs btn-info btn-round" data-toggle="modal" data-target="#modals-load-content"
data-id="'.$ShoppingOrder->id.'"
data-action="shop-user-order-shipping-detail"
data-back=""
data-modal="modal-xl"
data-init_from="user"
data-route="'.route('modal_load').'"><span class="fa fa-eye"></span></button>';
}
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getShippedColor().'">'.$ShoppingOrder->getShippedType().'</span>';
})
->addColumn('payment_for', function (ShoppingOrder $ShoppingOrder) {
return Payment::getPaymentForBadge($ShoppingOrder);
})
->addColumn('invoice', function (ShoppingOrder $ShoppingOrder) {
return $ShoppingOrder->isInvoice() ? '<span class="no-line-break"><a href="'.route('storage_file', [$ShoppingOrder->id, 'invoice', 'download']).'" class="btn btn-primary btn-xs"><i class="fa fa-download"></i></a>
<a href="'.route('storage_file', [$ShoppingOrder->id, 'invoice', 'stream']).'" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a></span>' : '-';
})
->addColumn('reference', function (ShoppingOrder $ShoppingOrder) {
return $ShoppingOrder->getLastShoppingPayment('reference');
})
->orderColumn('id', 'id $1')
->orderColumn('txaction', 'txaction $1')
->orderColumn('shipped', 'shipped $1')
->orderColumn('total_shipping', 'total_shipping $1')
->orderColumn('payment_for', 'payment_for $1')
->rawColumns(['id', 'txaction', 'payment_for', 'total_shipping', 'invoice', 'shipped'])
->make(true);
}
/*
$for = me, ot-member, ot-customer, abo-ot-member, abo-ot-customer, abo-me
*/
public function delivery($for, $id=null)
{
$user = User::find(\Auth::user()->id);
$shopping_user = null;
$delivery_id = null;
if(strpos($for, 'ot') !== false){ //ot-member, ot-customer abo-ot-member, abo-ot-customer,
$shopping_user = Shop::checkShoppingUser($id, $user);
$delivery_id = $shopping_user->id;
if(!Shop::checkShoppingCountry($for, $delivery_id) && !\Session()->has('custom-error')){
$country = Shop::getDeliveryCountry($for, $delivery_id);
\Session()->flash('custom-error', $country.": ".__('validation.custom.shipping_not_found'));
return redirect(route('user_order_my_delivery', [$for, $delivery_id]));
}
if($for === 'abo-ot-customer'){
//check if user has an Abo
if(AboHelper::hasAboByEmail($shopping_user->billing_email) && !\Session()->has('custom-error')){
\Session()->flash('custom-error', __('abo.error_email_has_abo', ['email' => $shopping_user->billing_email]));
return redirect(route('user_order_my_delivery', [$for, $delivery_id]));
}
}
}
if(Request::get('action') === 'next'){
Yard::instance('shopping')->destroy();
if(strpos(Request::get('switchers-radio-is-for'), 'ot') !== false){
$delivery_id = $id;
}
return redirect(route('user_order_my_list', [Request::get('switchers-radio-is-for'), $delivery_id]));
}
$data = [
'shopping_user' => $shopping_user,
'isAdmin' => false,
'isView' => 'customer',
'for' => $for,
'delivery_id' => $delivery_id,
];
return view('user.order.delivery', $data);
}
public function list($for, $id=null)
{
$user = User::find(\Auth::user()->id);
if($for === 'abo-me' && AboHelper::userHasAbo($user)){
abort(403, 'User has an Abo. Cannot order.');
}
$shopping_user = null;
$delivery_id = null;
if(strpos($for, 'ot') !== false){ //ot-member, ot-customer abo-ot-member, abo-ot-customer,
$shopping_user = Shop::checkShoppingUser($id, $user);
$delivery_id = $shopping_user->id;
}
if($for === 'ot-customer' || $for === 'abo-ot-customer'){
//Liederung an (abo-) ot-customer (Kunden) Zahlung und Rechnung geht an Kunden
UserService::initCustomerYard($shopping_user, $for);
}else{
//Lieferung an user oder (abo-) ot-member (Kunden) rechnung geht an User
//lieferland und rechnungsland prüfen
$shipping_country_id = Shop::checkShoppingCountry($for, $id);
if(!$shipping_country_id){
$country = Shop::getDeliveryCountry($for, $id);
\Session()->flash('custom-error', $country.": ".__('validation.custom.shipping_not_found'));
return redirect(route('user_order_my_delivery', [$for, $delivery_id]));
}
UserService::initUserYard($user, $shipping_country_id, $for);
}
$data = [
'shopping_user' => $shopping_user,
'user' => $user,
'isAdmin' => false,
'isView' => 'customer',
'for' => $for,
'template' => str_replace('abo-', '', $for),
'delivery_id' => $delivery_id,
'is_abo' => strpos($for, 'abo') !== false,
'comp_products' => Shop::getCompProducts($for),
];
return view('user.order.list', $data);
}
public function payment($for, $id=null){
$data = Request::all();
$user = User::find(Auth::user()->id);
$rules = array(
'shipping_salutation' => 'required',
'shipping_firstname'=>'required',
'shipping_lastname'=>'required',
'shipping_address'=>'required',
'shipping_zipcode'=>'required',
'shipping_city' => 'required',
'shipping_state' => 'required',
);
$validator = Validator::make(Request::all(), $rules);
if ($validator->fails()) {
return back()->withErrors($validator)->withInput(Request::all());
}
//hier prüfen, ob versand etc richtig berechnet wurde
$this->checkSendYardForPayment($data, $id);
if(Yard::instance('shopping')->getNumComp() > 0){
if(!isset($data['switchers-comp-product'])){
$validator->errors()->add('switchers-comp-product', __('msg.please_select_compensation_product'));
}else{
if(!is_array($data['switchers-comp-product'])){
$validator->errors()->add('switchers-comp-product', __('msg.please_select_compensation_product'));
}else{
if(count($data['switchers-comp-product']) !== Yard::instance('shopping')->getNumComp()){
$validator->errors()->add('switchers-comp-product', __('mdg.please_select_count_compensation_products', ['count'=>Yard::instance('shopping')->getNumComp()]));
}
}
}
if ($validator->errors()->count()) {
return back()->withErrors($validator)->withInput(Request::all());
}
}
do {
$identifier = Util::getToken();
} while( ShoppingInstance::where('identifier', $identifier)->count() );
$data['is_from'] = 'user_order';
$data['is_for'] = $for;
$data['is_abo'] = $data['is_abo'] ?? 0;
$data['abo_interval'] = $data['abo_interval'] ?? 0;
$data['shopping_user_id'] = $id;
$data['user_price_infos'] = Yard::instance('shopping')->getUserPriceInfos();
unset($data['quantity']);
unset($data['_token']);
$data['mode'] = config('app.mode') === 'test' ? 'test' : 'live';
if($for === 'ot-customer' || $for === 'abo-ot-customer'){
$shopping_instance = ShoppingInstance::create([
'identifier' => $identifier,
'user_shop_id' => $user->shop->id,
'payment' => 6, //Berater Shop to Customer Shop
'subdomain' => $user->shop->getSubdomain(),
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
'language' => \App::getLocale(),
'amount' => Yard::instance('shopping')->totalWithShipping(2, '.', ''),
'status' => 0,
'shopping_user_id' => $id,
'shopping_data' => $data,
'back' => url()->previous(),
]);
Yard::instance('shopping')->store($identifier);
$yard_shopping_items = OrderPaymentService::getRestoredYardShoppingItems($shopping_instance);
// send Mail to Customer
$this->customPaymentSendMail($user, $identifier, $yard_shopping_items, $data);
UserHistory::create(['user_id' => $user->id, 'action'=>'user_order_customer', 'status'=>1, 'product_id'=>null, 'identifier'=>$identifier, 'is_abo'=>$data['is_abo']]);
//eine Abschließen bestellseite für den User + Link zum Kunden Shop + Mail an den Kunden / Berater
return redirect(route('user_order_my_custom_payment', ['identifier'=>$identifier]));
}else{
ShoppingInstance::create([
'identifier' => $identifier,
'user_shop_id' => 1, //is first faker shop for buy intern
'auth_user_id' => Auth::user()->id,
'payment' => 2, //Berater Shop
'subdomain' => url('/'),
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
'language' => \App::getLocale(),
'amount' => Yard::instance('shopping')->totalWithShipping(2, '.', ''),
'status' => 0,
'shopping_user_id' => $id,
'shopping_data' => $data,
'back' => url()->previous(),
]);
Yard::instance('shopping')->store($identifier);
$path = route('checkout.checkout_card', ['identifier'=>$identifier]);
UserHistory::create(['user_id' => $user->id, 'action'=>'user_order_payment', 'status'=>1, 'product_id'=>null, 'identifier'=>$identifier, 'is_abo'=>$data['is_abo']]);
//$path = str_replace('http', 'https', $path);
return redirect()->secure($path);
}
}
private function checkSendYardForPayment($data, $id){
$user = User::find(\Auth::user()->id);
$shopping_user = null;
if(strpos($data['shipping_is_for'], 'ot') !== false){
$shopping_user = Shop::checkShoppingUser($id, $user);
}
$shipping_country_id = Shop::checkShoppingCountry($data['shipping_is_for'], $id);
if(!$shipping_country_id){
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
Yard::instance('shopping')->store($identifier);
$data['user_id'] = Auth::user()->id;
$data['shopping_user_id'] = $id;
\App\Services\MyLog::writeLog('payment', 'error', 'no shipping_country_id found | Yard identifier: '.$identifier, $data);
abort(403, __('msg.shipping_country_was_not_found'));
}
//must be the same shipping country
if($shipping_country_id != Yard::instance('shopping')->getShippingCountryId()){
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
Yard::instance('shopping')->store($identifier);
$data['user_id'] = Auth::user()->id;
$data['shopping_user_id'] = $id;
\App\Services\MyLog::writeLog('payment', 'error', 'shipping_country_id is not the same from Yard | Yard identifier: '.$identifier, $data);
abort(403, __('msg.shipping_country_was_not_correctly'));
}
if($data['shipping_is_for'] !== 'ot-customer'){
if(Yard::instance('shopping')->shipping_free){
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
Yard::instance('shopping')->store($identifier);
$data['user_id'] = Auth::user()->id;
$data['shopping_user_id'] = $id;
\App\Services\MyLog::writeLog('payment', 'error', 'Yard can by not shipping_free | Yard identifier: '.$identifier, $data);
abort(403, __('msg.shopping_cart_was_shipping_free'));
}
}
if($data['shipping_is_for'] === 'ot-customer'){
if(!$user->shop){
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
Yard::instance('shopping')->store($identifier);
$data['user_id'] = Auth::user()->id;
$data['shopping_user_id'] = $id;
\App\Services\MyLog::writeLog('payment', 'error', 'User has no Shop for an User to Customer order| Yard identifier: '.$identifier, $data);
abort(403, __('msg.shopping_cart_was_not_user_shop'));
}
}
$shipping_price = Shop::getShippingPriceByShippingCountryId($shipping_country_id, Yard::instance('shopping')->weight());
dump($shipping_price);
//for other and has weight - check
if(strpos($data['shipping_is_for'], 'ot') !== false && $data['shipping_is_for'] !== 'ot-customer' && Yard::instance('shopping')->weight() > 0){
if(!Yard::instance('shopping')->getShippingPrice() || Yard::instance('shopping')->getShippingPrice() == 0){
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
Yard::instance('shopping')->store($identifier);
$data['user_id'] = Auth::user()->id;
$data['shopping_user_id'] = $id;
\App\Services\MyLog::writeLog('payment', 'error', 'Yard OT shipping_price is 0 or | Yard identifier: '.$identifier, $data);
abort(403, __('msg.shipping_cost_cannot_be_0'));
}
if(Yard::instance('shopping')->getShippingPrice() != $shipping_price->price){
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
Yard::instance('shopping')->store($identifier);
$data['user_id'] = Auth::user()->id;
$data['shopping_user_id'] = $id;
\App\Services\MyLog::writeLog('payment', 'error', 'Yard OT shipping_price is not the same from shipping_price | Yard identifier: '.$identifier, $data);
abort(403, __('msg.shipping_costs_were_not_calculated_correctly'));
}
}
if(($data['shipping_is_for'] == 'me' || $data['shipping_is_for'] == 'abo-me') && Yard::instance('shopping')->weight() > 0){
if(!Yard::instance('shopping')->getShippingPrice() || Yard::instance('shopping')->getShippingPrice() == 0){
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
Yard::instance('shopping')->store($identifier);
$data['user_id'] = Auth::user()->id;
$data['shopping_user_id'] = $id;
\App\Services\MyLog::writeLog('payment', 'error', 'Yard ME shipping_price is 0 or | Yard identifier: '.$identifier, $data);
abort(403, __('msg.shipping_cost_cannot_be_0'));
}
dump(Yard::instance('shopping')->getShippingPrice());
dump($shipping_price->price_comp);
dump(Yard::instance('shopping')->getNumComp());
dump($shipping_price->num_comp);
dd($data) ;
if(Yard::instance('shopping')->getShippingPrice() != $shipping_price->price_comp){
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
Yard::instance('shopping')->store($identifier);
$data['user_id'] = Auth::user()->id;
$data['shopping_user_id'] = $id;
\App\Services\MyLog::writeLog('payment', 'error', 'Yard ME shipping_price is not the same from shipping_price | Yard identifier: '.$identifier, $data);
abort(403, __('msg.shipping_costs_were_not_calculated_correctly'));
}
if(Yard::instance('shopping')->getNumComp() != $shipping_price->num_comp){
$identifier = 'error-'.time().mt_rand(1000000, 9999999);
Yard::instance('shopping')->store($identifier);
$data['user_id'] = Auth::user()->id;
$data['shopping_user_id'] = $id;
\App\Services\MyLog::writeLog('payment', 'error', 'Yard num_comp is 0 | Yard identifier: '.$identifier, $data);
abort(403, __('msg.compensation_products_cannot_be_0'));
}
}
}
public function datatable(){
if(Request::get('shipping_is_for') === 'me' || Request::get('shipping_is_for') === 'abo-me'){
$show_on_ids = Request::get('is_abo') ? ['12', '13'] : ['2'];
$query = Product::with('product_buyings')
->select('products.*')->where('products.active', true)
->where(function($q) use ($show_on_ids) {
foreach($show_on_ids as $id) {
$q->orWhereJsonContains('show_on', $id);
}
})
->orderByRaw("CASE
WHEN JSON_CONTAINS(show_on, ?, '$') THEN 1
WHEN JSON_CONTAINS(show_on, ?, '$') THEN 2
ELSE 3 END",
[$show_on_ids[0], isset($show_on_ids[1]) ? $show_on_ids[1] : $show_on_ids[0]]);
}else{
$show_on_ids = Request::get('is_abo') ? ['12', '13'] : ['3'];
$query = Product::select('products.*')
->where('active', true)
->where(function($q) use ($show_on_ids) {
foreach($show_on_ids as $id) {
$q->orWhereJsonContains('show_on', $id);
}
})
->orderByRaw("CASE
WHEN JSON_CONTAINS(show_on, ?, '$') THEN 1
WHEN JSON_CONTAINS(show_on, ?, '$') THEN 2
ELSE 3 END",
[$show_on_ids[0], isset($show_on_ids[1]) ? $show_on_ids[1] : $show_on_ids[0]]);
}
return \DataTables::eloquent($query)
->addColumn('product', function (Product $product) {
$cartItem = Yard::instance('shopping')->getCartItemByProduct($product->id);
$qty = isset($cartItem->qty) ? $cartItem->qty : 0;
$rowId = isset($cartItem->rowId) ? $cartItem->rowId : '';
return '<strong>'.$product->getLang('name').'</strong><br>
<div class="no-line-break input-group-min-w">
<div class="input-group d-inline-flex w-auto">
<span class="input-group-prepend">
<button type="button" class="btn btn-secondary icon-btn md-btn-extra remove-product-basket" data-row-id="'.$rowId.'" data-product-id="'.$product->id.'">-</button>
</span>
<input type="text" class="form-control text-center input-extra table-input-event-onchange" name="product_qty_'.$product->id.'" data-row-id="'.$rowId.'" data-product-id="'.$product->id.'" value="'.$qty.'">
<span class="input-group-append">
<button type="button" class="btn btn-secondary icon-btn md-btn-extra add-product-basket" data-row-id="'.$rowId.'" data-product-id="'.$product->id.'">+</button>
</span>
</div>
</div>';
})
->addColumn('abo', function (Product $product) {
return AboHelper::getAboTypeBadge(AboHelper::getAboShowOn($product));
})
/*
->addColumn('add_card', function (Product $product) {
return '<button type="button" class="btn btn-sm btn-md-extra btn-secondary add-product-basket" data-product-id="'.$product->id.'">
<strong>&euro; '.$product->getFormattedPriceWith().'</strong>&nbsp; +<span class="ion ion-md-cart"></span>
</button>';
})
->addColumn('quantity', function (Product $product) {
$cartItem = Yard::instance('shopping')->getCartItemByProduct($product->id);
$qty = isset($cartItem->qty) ? $cartItem->qty : 0;
$rowId = isset($cartItem->rowId) ? $cartItem->rowId : '';
return '<div class="no-line-break input-group-min-w">
<div class="input-group d-inline-flex w-auto">
<span class="input-group-prepend">
<button type="button" class="btn btn-secondary icon-btn md-btn-extra remove-product-basket" data-row-id="'.$rowId.'" data-product-id="'.$product->id.'">-</button>
</span>
<input type="text" class="form-control text-center input-extra table-input-event-onchange" name="product_qty_'.$product->id.'" data-row-id="'.$rowId.'" data-product-id="'.$product->id.'" value="'.$qty.'">
<span class="input-group-append">
<button type="button" class="btn btn-secondary icon-btn md-btn-extra add-product-basket" data-row-id="'.$rowId.'" data-product-id="'.$product->id.'">+</button>
</span>
</div>
</div>';
})*/
->addColumn('picture', function (Product $product) {
if(count($product->images)){
return '<img class="img-fluid img-extra" alt="" src="'.route('product_image', [$product->images->first()->slug]).'">';
}
return "";
})
->addColumn('price_net', function (Product $product) {
return '<span class="no-line-break">'.$product->getFormattedPriceWith(true, true, Yard::instance('shopping')->getUserCountry()). " €</span>".'<span class="no-line-break">'.$product->getFormattedPriceCurrencyWith(true, true, Yard::instance('shopping')->getUserCountry()).'</span>';
})
->addColumn('price_gross', function (Product $product) {
return '<span class="no-line-break">'.$product->getFormattedPriceWith(false, true, Yard::instance('shopping')->getUserCountry()). " €</span>".'<span class="no-line-break">'.$product->getFormattedPriceCurrencyWith(false, true, Yard::instance('shopping')->getUserCountry()).'</span>';
})
->addColumn('price_vk_gross', function (Product $product) {
return '<span class="no-line-break">'.$product->getFormattedPriceWith(false, false, Yard::instance('shopping')->getUserCountry()). " €</span>".'<span class="no-line-break">'.$product->getFormattedPriceCurrencyWith(false, false, Yard::instance('shopping')->getUserCountry()).'</span>';
})
->addColumn('customer_price_net', function (Product $product) {
return '<span class="no-line-break">'.$product->getFormattedPriceWith(true, false, Yard::instance('shopping')->getUserCountry()). " €</span>".'<span class="no-line-break">'.$product->getFormattedPriceCurrencyWith(true, false, Yard::instance('shopping')->getUserCountry()).'</span>';
})
->addColumn('customer_price_gross', function (Product $product) {
return '<span class="no-line-break">'.$product->getFormattedPriceWith(false, false, Yard::instance('shopping')->getUserCountry()). " €</span>".'<span class="no-line-break">'.$product->getFormattedPriceCurrencyWith(false, false, Yard::instance('shopping')->getUserCountry()).'</span>';
})
->addColumn('my_commission_net', function (Product $product) {
return '<span class="no-line-break">'.$product->getFormattedPriceWith(true, false, Yard::instance('shopping')->getUserCountry(), true). " €</span>".'<span class="no-line-break">'.$product->getFormattedPriceCurrencyWith(true, false, Yard::instance('shopping')->getUserCountry(), true).'</span>';
})
->addColumn('action', function (Product $product) {
return '<button class="btn btn-default btn-sm icon-btn md-btn-flat product-tooltip" title="details" data-modal="modal-lg"
data-toggle="modal" data-target="#modals-load-content" data-id="'.$product->id.'" data-route="'.route('modal_load').'"
data-action="user-order-show-product" data-view="customer"><i class="ion ion-md-eye"></i></button>';
})
->filterColumn('product', function($query, $keyword) {
if($keyword != ""){
$query->where('name', 'LIKE', '%'.$keyword.'%');
}
})
->orderColumn('name', 'name $1')
->orderColumn('product', 'name $1')
->orderColumn('number', 'number $1')
->orderColumn('points', 'points $1')
->orderColumn('price_net', 'price_net $1')
->orderColumn('price_gross', 'price_gross $1')
->orderColumn('price_vk_gross', 'price $1')
->orderColumn('customer_price_net', 'price $1')
->orderColumn('customer_price_gross', 'price $1')
->orderColumn('my_commission_net', 'price $1')
->orderColumn('contents_total', 'contents_total $1')
->orderColumn('weight', 'weight $1')
->orderColumn('abo', 'show_on $1')
->rawColumns(['add_card', 'price_net', 'price_gross', 'price_vk_gross', 'customer_price_net', 'customer_price_gross', 'my_commission_net', 'product', 'quantity', 'picture', 'abo', 'action'])
->make(true);
}
public function performRequest(){
if(Request::ajax()) {
$data = Request::all();
$is_for = isset($data['shipping_is_for']) ? $data['shipping_is_for'] : 'ot-member';
$data['for'] = $is_for;
$data['comp_products'] = Shop::getCompProducts($is_for);
if($data['action'] === 'updateCart' && isset($data['product_id'])){
if($product = Product::find($data['product_id'])){
$image = "";
if($product->images->count()){
$image = $product->images->first()->slug;
}
//get the card item
if($is_for === 'ot-customer' || $is_for === 'abo-ot-customer'){
$cartItem = Yard::instance('shopping')
->add($product->id, $product->getLang('name'), 1,
round($product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), false, Yard::instance('shopping')->getUserCountry()), 1), false, false,
['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission, 'show_on' => $product->show_on]);
}else{
$cartItem = Yard::instance('shopping')
->add($product->id, $product->getLang('name'), 1,
$product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), true, Yard::instance('shopping')->getUserCountry()), false, false,
['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission, 'show_on' => $product->show_on]);
}
if(Yard::instance('shopping')->getUserTaxFree()){
Yard::setTax($cartItem->rowId, 0);
}else{
Yard::setTax($cartItem->rowId, $product->getTaxWith(Yard::instance('shopping')->getUserCountry()));
}
if(isset($data['qty']) && $data['qty'] > 0){
Yard::instance('shopping')->update($cartItem->rowId, $data['qty']);
}else{
//if 0 get the item by qty:1 and remove it
Yard::instance('shopping')->remove($cartItem->rowId);
}
Yard::instance('shopping')->reCalculateShippingPrice();
$this->checkCompProduct(Yard::instance('shopping')->getNumComp());
$html_card = view("user.order.yard_view_form", $data)->render();
$html_comp = view("user.order.comp_product", $data)->render();
return response()->json(['response' => true, 'data'=>$data, 'html_card'=>$html_card, 'html_comp'=>$html_comp]);
}
}
if($data['action'] === 'clearCart') {
Yard::instance('shopping')->destroy();
return response()->json(['response' => true, 'data'=>Yard::instance('shopping')->count(), 'html_card'=>'', 'html_comp'=>'']);
}
if($data['action'] === 'updateShippingCountry') {
if(isset($data['shipping_country_id'])){
if($shipping_country = ShippingCountry::find($data['shipping_country_id'])){
Yard::instance('shopping')->setShippingCountryWithPrice($shipping_country->id, $is_for);
$this->checkCompProduct(Yard::instance('shopping')->getNumComp());
}
}
$html_card = view("user.order.yard_view_form", $data)->render();
$html_comp = view("user.order.comp_product", $data)->render();
return response()->json(['response' => true, 'data'=>$data, 'html_card'=>$html_card, 'html_comp'=>$html_comp]);
}
if($data['action'] === 'updateCompProduct'){
// $data['comp_product_id']
// $data['comp_num']
//count_comp_products
$this->updateCompProduct($data);
Yard::instance('shopping')->reCalculateShippingPrice();
$html_card = view("user.order.yard_view_form", $data)->render();
$html_comp = view("user.order.comp_product", $data)->render();
return response()->json(['response' => true, 'data'=>$data, 'html_card'=>$html_card, 'html_comp'=>$html_comp]);
}
return response()->json(['response' => false, 'data'=>$data]);
}
}
private function checkCompProduct($count_comp_products){
foreach (Yard::instance('shopping')->content() as $row) {
//wenn gleich löschen, da neue Versandkosten
if($row->options->comp > $count_comp_products) {
Yard::instance('shopping')->remove($row->rowId);
}
}
}
private function updateCompProduct($data){
//clear old
foreach (Yard::instance('shopping')->content() as $row) {
//wenn kleiner wurde ein produkt entfernt aufgrund der Anzahl
//wenn gleich löschen, da neue Versandkosten
if($row->options->comp === $data['comp_num'] || $row->options->comp > $data['count_comp_products']) {
Yard::instance('shopping')->remove($row->rowId);
}
}
if(isset($data['comp_product_id'])) {
if ($product = Product::find($data['comp_product_id'])) {
$image = "";
if ($product->images->count()) {
$image = $product->images->first()->slug;
}
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, 0, false, false,
['image' => $image, 'slug' => $product->slug, 'weight' => 0, 'points' => 0,
'comp' => $data['comp_num'], 'product_id' => $product->id]);
Yard::setTax($cartItem->rowId, 0);
}
}
}
public function customPayment($identifier){
$data = OrderPaymentService::getCustomPayment($identifier);
return view('user.order.payment.custom_payment', $data);
}
private static function customPaymentSendMail($user, $identifier, $yard_shopping_items, $data){
$bcc = [];
$shopping_instance = ShoppingInstance::where('identifier', $identifier)->first();
if(!$shopping_instance){
abort(403, __('msg.shopping_instance_not_found'));
}
$shopping_user = $data['shopping_user_id'] ? ShoppingUser::find($data['shopping_user_id']) : null;
if(!$shopping_user){
abort(403, __('msg.shopping_user_not_found'));
}
$route = route('checkout.checkout_card', ['identifier'=>$identifier]);
$billing_email = $shopping_user->billing_email;
if(!$billing_email){
$billing_email = $data['mode'] === 'test' ? config('app.checkout_test_mail') : config('app.checkout_mail');
}
$bcc[] = $data['mode'] === 'test' ? config('app.checkout_test_mail') : config('app.checkout_mail');
$bcc[] = $shopping_user->member ? $shopping_user->member->email : $user->email;
Mail::to($billing_email)->bcc($bcc)->locale(\App::getLocale())
->send(new MailCustomPaymet($route, $shopping_user, $shopping_instance, $yard_shopping_items, $data['mode']));
}
}

View file

@ -0,0 +1,97 @@
<?php
namespace App\Http\Controllers\User;
use Request;
use App\User;
use App\Models\ShoppingInstance;
use App\Http\Controllers\Controller;
use App\Services\OrderPaymentService;
class OrderPaymentController extends Controller
{
public function __construct()
{
$this->middleware('active.account');
}
public function index()
{
$data = [
];
return view('user.order.payment.index', $data);
}
public function detail($identifier)
{
$data = OrderPaymentService::getCustomPayment($identifier);
$data['backlink'] = route('user_order_payment_links');
return view('user.order.payment.custom_payment', $data);
}
public function delete($identifier){
OrderPaymentService::deleteInstance($identifier);
return redirect(route('user_order_payment_links'));
}
public function datatable(){
$user = User::find(\Auth::user()->id);
$user_shop_id = $user->shop ? $user->shop->id : null;
$query = ShoppingInstance::select('*')
->where('user_shop_id', '=', $user_shop_id)
->where('payment', 6);
return \DataTables::eloquent($query)
->addColumn('id', function (ShoppingInstance $shoppingInstance) {
return '<a href="'.route('user_order_payment_links_detail', [$shoppingInstance->identifier]).'" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
})
->addColumn('created_at', function (ShoppingInstance $shoppingInstance) {
return $shoppingInstance->created_at->format("d.m.Y");
})
->addColumn('status', function (ShoppingInstance $shoppingInstance) {
return OrderPaymentService::getStatusBadge($shoppingInstance);
})
->addColumn('payment_method', function (ShoppingInstance $shoppingInstance) {
return $shoppingInstance->payment_method ? $shoppingInstance->payment_method->name : '-';
})
->addColumn('total', function (ShoppingInstance $shoppingInstance) {
if($shoppingInstance->amount > 0){
return '<span class="no-line-break">'.$shoppingInstance->getAmountFormatted()." €</span>";
}else{
return '-';
}
})
->addColumn('type', function (ShoppingInstance $shoppingInstance) {
return OrderPaymentService::getTypeBadge($shoppingInstance);
})
->addColumn('billing_firstname', function (ShoppingInstance $shoppingInstance) {
return $shoppingInstance->shopping_data['billing_firstname'] ?? '-';
})
->addColumn('billing_lastname', function (ShoppingInstance $shoppingInstance) {
return $shoppingInstance->shopping_data['billing_lastname'] ?? '-';
})
->addColumn('billing_email', function (ShoppingInstance $shoppingInstance) {
return $shoppingInstance->shopping_data['billing_email'] ?? '-';
})
->addColumn('delete', function (ShoppingInstance $shoppingInstance) {
return '<a onclick="return confirm(\''.__('confirm_delete').'\');" href="'.route('user_order_payment_links_delete', [$shoppingInstance->identifier]).'" class="btn icon-btn btn-sm btn-danger"><span class="fa fa-trash"></span></a>';
})
->orderColumn('id', 'identifier $1')
->orderColumn('created_at', 'created_at $1')
->orderColumn('status', 'status $1')
->orderColumn('total', 'total $1')
->orderColumn('type', 'type $1')
->orderColumn('billing_firstname', 'billing_firstname $1')
->orderColumn('billing_lastname', 'billing_lastname $1')
->orderColumn('billing_email', 'billing_email $1')
->rawColumns(['id', 'status', 'type', 'total', 'invoice', 'delete'])
->make(true);
}
}

View file

@ -50,10 +50,9 @@ class PaymentController extends Controller
if(Credit::isCredit($UserCredit)){
$ret .= '<a href="'.route('storage_file', [$UserCredit->id, 'credit', 'download']).'" class="btn btn-primary btn-xs"><i class="fa fa-download"></i></a> ';
$ret .= '<a href="'.route('storage_file', [$UserCredit->id, 'credit', 'stream']).'" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a><br>';
if(Auth::user()->isVIP()){
$ret .= '<a href="'.route('storage_file', [$UserCredit->id, 'credit_detail', 'html']).'" target="_blank" class="btn btn-secondary btn-xs mt-2"><i class="fa fa-eye"></i></a> ';
$ret .= '<a href="'.route('storage_file', [$UserCredit->id, 'credit_detail', 'pdf']).'" target="_blank" class="btn btn-secondary btn-xs mt-2"><i class="fa fa-file-pdf" style="min-width:13.5px"></i></a> ';
}
$ret .= '<a href="'.route('storage_file', [$UserCredit->id, 'credit_detail', 'html']).'" target="_blank" class="btn btn-secondary btn-xs mt-2"><i class="fa fa-eye"></i></a> ';
$ret .= '<a href="'.route('storage_file', [$UserCredit->id, 'credit_detail', 'pdf']).'" target="_blank" class="btn btn-secondary btn-xs mt-2"><i class="fa fa-file-pdf" style="min-width:13.5px"></i></a> ';
}else{
$ret = "-";
}

View file

@ -146,7 +146,7 @@ class ShopApiController extends Controller
return $ShoppingOrder->user_shop ? '<a href="'.$ShoppingOrder->user_shop->getSubdomain(false).'" target="_blank">'.$ShoppingOrder->user_shop->getSubdomain(false).'</span>' : '';
})
->addColumn('payment_for', function (ShoppingOrder $ShoppingOrder) {
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getPaymentForColor().'">'.$ShoppingOrder->getPaymentForType().'</span>';
return Payment::getPaymentForBadge($ShoppingOrder);
})
->addColumn('shipped', function (ShoppingOrder $ShoppingOrder) {
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getShippedColor().'">'.$ShoppingOrder->getShippedType().'</span>

View file

@ -28,7 +28,7 @@ class ShopSalesController extends Controller
$user = User::find(\Auth::user()->id);
$shopping_order = ShoppingOrder::findOrFail($id);
if($shopping_order->member_id !== $user->id){
abort(404);
abort(403, 'Unauthorized action. User ID does not match.');
}
if( $shopping_order->payment_for !== 6 && $shopping_order->payment_for !== 7){
return redirect(route('user_order_detail', [$shopping_order->id]));
@ -67,7 +67,7 @@ class ShopSalesController extends Controller
return $ShoppingOrder->user_shop ? '<a href="'.$ShoppingOrder->user_shop->getSubdomain(false).'" target="_blank">'.$ShoppingOrder->user_shop->getSubdomain(false).'</span>' : '';
})
->addColumn('payment_for', function (ShoppingOrder $ShoppingOrder) {
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getPaymentForColor().'">'.$ShoppingOrder->getPaymentForType().'</span>';
return Payment::getPaymentForBadge($ShoppingOrder);
})
->addColumn('shipped', function (ShoppingOrder $ShoppingOrder) {
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getShippedColor().'">'.$ShoppingOrder->getShippedType().'</span>

View file

@ -2,6 +2,7 @@
namespace App\Http\Controllers\User;
use Auth;
use Request;
use App\User;
@ -26,11 +27,11 @@ class TeamController extends Controller
public function members()
{
$user = User::find(\Auth::user()->id);
if($user->isActiveShop() && $user->shop){
$shop_register_link = $user->shop->getSubdomain(false)."/reg";
}else{
$member_id = 'm'.($user->id + config('mivita.add_number_id'));
$shop_register_link = config('app.protocol').config('app.domain').config('app.tld_care').'/reg/'.$member_id;
if ($user->isActiveShop() && $user->shop) {
$shop_register_link = $user->shop->getSubdomain(false) . "/reg";
} else {
$member_id = 'm' . ($user->id + config('mivita.add_number_id'));
$shop_register_link = config('app.protocol') . config('app.domain') . config('app.tld_care') . '/reg/' . $member_id;
}
$data = [
'shop_register_link' => $shop_register_link
@ -71,7 +72,7 @@ class TeamController extends Controller
{
$user = User::find(\Auth::user()->id);
if(!$user->isVIP()){
if (!$user->isVIP()) {
abort(404);
}
$ExportBot = new ExportBot('member');
@ -82,14 +83,15 @@ class TeamController extends Controller
return view('user.team.export', $data);
}
public function userTeamExport(){
public function userTeamExport()
{
if(Request::get('action') === "export"){
if (Request::get('action') === "export") {
$user = User::find(\Auth::user()->id);
$ExportBot = new ExportBot('member');
$ExportBot->initStructureUser($user, 'list'); //tree or list
$columns = [];
$filename = __('team.filename_export').date('Y-m-d-H-i-s');
$filename = __('team.filename_export') . date('Y-m-d-H-i-s');
$headers = array(
__('tables.line'),
__('tables.level'),
@ -104,12 +106,13 @@ class TeamController extends Controller
__('tables.phone'),
__('tables.mobil'),
__('tables.birthday'),
__('tables.partner_since'),
__('tables.account'),
__('tables.account_to'),
__('tables.sponsor'),
);
if(isset($ExportBot->user_list->childs)){
foreach ($ExportBot->user_list->childs as $child){
if (isset($ExportBot->user_list->childs)) {
foreach ($ExportBot->user_list->childs as $child) {
$columns[] = array(
__('tables.line') => $child->line,
__('tables.level') => $child->level_name,
@ -124,42 +127,44 @@ class TeamController extends Controller
__('tables.phone') => $child->phone,
__('tables.mobil') => $child->mobil,
__('tables.birthday') => $child->birthday,
__('tables.partner_since') => $child->partner_since,
__('tables.account') => ($child->active_account == 1 ? __('yes') : __('no')),
__('tables.account_to') => $child->payment_account_date,
__('tables.sponsor') => $child->sponsor_name,
);
}
}
return Excel::download(new UserTeamExport($columns, $headers), $filename.'.xls');
return Excel::download(new UserTeamExport($columns, $headers), $filename . '.xls');
}
}
private function setFilterVars(){
private function setFilterVars()
{
if(!session('team_user_filter_month')){
if (!session('team_user_filter_month')) {
session(['team_user_filter_month' => intval(date('m'))]);
}
if(!session('team_user_filter_year')){
if (!session('team_user_filter_year')) {
session(['team_user_filter_year' => intval(date('Y'))]);
}
if(!session('team_user_points_filter_month')){
if (!session('team_user_points_filter_month')) {
session(['team_user_points_filter_month' => intval(date('m'))]);
}
if(!session('team_user_points_filter_year')){
if (!session('team_user_points_filter_year')) {
session(['team_user_points_filter_year' => intval(date('Y'))]);
}
if(Request::get('team_user_filter_month')){
if (Request::get('team_user_filter_month')) {
session(['team_user_filter_month' => Request::get('team_user_filter_month')]);
}
if(Request::get('team_user_filter_year')){
if (Request::get('team_user_filter_year')) {
session(['team_user_filter_year' => Request::get('team_user_filter_year')]);
}
if(Request::get('team_user_points_filter_month')){
if (Request::get('team_user_points_filter_month')) {
session(['team_user_points_filter_month' => Request::get('team_user_points_filter_month')]);
}
if(Request::get('team_user_points_filter_year')){
if (Request::get('team_user_points_filter_year')) {
session(['team_user_points_filter_year' => Request::get('team_user_points_filter_year')]);
}
}
@ -170,46 +175,47 @@ class TeamController extends Controller
$user_id = \Auth::user()->id;
$query = UserSalesVolume::with('user', 'user.account')->with('shopping_order')->select('user_sales_volumes.*')
->where('user_sales_volumes.user_id', '=', $user_id)
->where('user_sales_volumes.month', '=', Request::get('team_user_points_filter_month'))
->where('user_sales_volumes.year', '=', Request::get('team_user_points_filter_year'));
->where('user_sales_volumes.user_id', '=', $user_id)
->where('user_sales_volumes.month', '=', Request::get('team_user_points_filter_month'))
->where('user_sales_volumes.year', '=', Request::get('team_user_points_filter_year'));
return $query;
}
public function datatablePoints(){
public function datatablePoints()
{
$query = $this->initSearchPoints();
return \DataTables::eloquent($query)
->addColumn('order', function (UserSalesVolume $UserSalesVolume) {
if($UserSalesVolume->shopping_order){
if($UserSalesVolume->status === 1 && $UserSalesVolume->shopping_order->auth_user_id === $UserSalesVolume->user_id){
return '<a href="' . route('user_order_detail', [$UserSalesVolume->shopping_order->id]) . '" class="btn btn-xs btn-primary">'.$UserSalesVolume->shopping_order->id.'</a>';
if ($UserSalesVolume->shopping_order) {
if ($UserSalesVolume->status === 1 && $UserSalesVolume->shopping_order->auth_user_id === $UserSalesVolume->user_id) {
return '<a href="' . route('user_order_detail', [$UserSalesVolume->shopping_order->id]) . '" class="btn btn-xs btn-primary">' . $UserSalesVolume->shopping_order->id . '</a>';
}
if(($UserSalesVolume->status === 2 || $UserSalesVolume->status === 3) && $UserSalesVolume->shopping_order->member_id === $UserSalesVolume->user_id){
return '<a href="' . route('user_shop_order_detail', [$UserSalesVolume->shopping_order->id]) . '" class="btn btn-xs btn-secondary">'.$UserSalesVolume->shopping_order->id.'</a>';
if (($UserSalesVolume->status === 2 || $UserSalesVolume->status === 3) && $UserSalesVolume->shopping_order->member_id === $UserSalesVolume->user_id) {
return '<a href="' . route('user_shop_order_detail', [$UserSalesVolume->shopping_order->id]) . '" class="btn btn-xs btn-secondary">' . $UserSalesVolume->shopping_order->id . '</a>';
}
}
return '';
})
->addColumn('total_net', function (UserSalesVolume $UserSalesVolume) {
return formatNumber($UserSalesVolume->total_net).' &euro;';
return formatNumber($UserSalesVolume->total_net) . ' &euro;';
})
->addColumn('status_turnover', function (UserSalesVolume $UserSalesVolume) {
return '<span class="badge badge-pill badge-'.$UserSalesVolume->getStatusTurnoverColor().'">'.$UserSalesVolume->getStatusTurnoverType().'</span>';
return '<span class="badge badge-pill badge-' . $UserSalesVolume->getStatusTurnoverColor() . '">' . $UserSalesVolume->getStatusTurnoverType() . '</span>';
})
->addColumn('status', function (UserSalesVolume $UserSalesVolume) {
return '<span class="badge badge-pill badge-'.$UserSalesVolume->getStatusColor().'">'.$UserSalesVolume->getStatusType().'</span>';
return '<span class="badge badge-pill badge-' . $UserSalesVolume->getStatusColor() . '">' . $UserSalesVolume->getStatusType() . '</span>';
})
->addColumn('message', function (UserSalesVolume $UserSalesVolume) {
return '<span class="no-line-break">'.$UserSalesVolume->message.'</span>';
return '<span class="no-line-break">' . $UserSalesVolume->message . '</span>';
})
->addColumn('info', function (UserSalesVolume $UserSalesVolume) {
return '<span class="no-line-break">'.$UserSalesVolume->info.'</span>';
return '<span class="no-line-break">' . $UserSalesVolume->info . '</span>';
})
->orderColumn('id', 'id $1')
->orderColumn('order', 'order $1')
->orderColumn('status', 'status $1')
@ -220,7 +226,8 @@ class TeamController extends Controller
->make(true);
}
public function load(){
public function load()
{
$user = User::find(\Auth::user()->id);
$userSalesVolume = $user->getUserSalesVolume(intval(session('team_user_points_filter_month')), intval(session('team_user_points_filter_year')), 'first');
@ -229,9 +236,6 @@ class TeamController extends Controller
'userSalesVolume' => $userSalesVolume,
];
$html = view('user.team._points_sum', $data)->render();
return response()->json(['response' => true, 'data'=>$data, 'html'=>$html]);
return response()->json(['response' => true, 'data' => $data, 'html' => $html]);
}
}
}

View file

@ -64,6 +64,9 @@ class UserDataController extends Controller
'city' => 'required',
'email' => 'required|string|email|max:255|exists:users,email',
'email-confirm' => 'required|same:email',
'bank_owner' => 'required',
'bank_iban' => 'required',
'bank_bic' => 'required',
);
if(!Request::get('same_as_billing')){
$rules = array_merge($rules, [

View file

@ -36,7 +36,7 @@ class CardController extends Controller
$cartItem = Yard::instance('shopping')
->add($product->id, $product->getLang('name'), $quantity,
$product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), false, Yard::instance('shopping')->getUserCountry()), false, false,
['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission, 'no_free_shipping' => $product->no_free_shipping]);
['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission, 'no_free_shipping' => $product->no_free_shipping, 'show_on' => $product->show_on]);
if(Yard::instance('shopping')->getUserTaxFree()){
Yard::setTax($cartItem->rowId, 0);
}else{
@ -65,7 +65,7 @@ class CardController extends Controller
$cartItem = Yard::instance('shopping')
->add($product->id, $product->getLang('name'), $quantity,
$product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), false, Yard::instance('shopping')->getUserCountry()), false, false,
['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission, 'no_free_shipping' => $product->no_free_shipping]);
['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission, 'no_free_shipping' => $product->no_free_shipping, 'show_on' => $product->show_on]);
if(Yard::instance('shopping')->getUserTaxFree()){
Yard::setTax($cartItem->rowId, 0);
}else{

File diff suppressed because it is too large Load diff

View file

@ -252,6 +252,9 @@ class WizardController extends Controller
'mobil' => 'required_without:phone',
'country_id' => 'required|integer|min:1',
'birthday' => 'required',
'bank_owner' => 'required',
'bank_iban' => 'required',
'bank_bic' => 'required',
);
if (!Request::get('same_as_billing')) {
@ -572,7 +575,7 @@ class WizardController extends Controller
if($product->images->count()){
$image = $product->images->first()->slug;
}
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->getPriceWith(\App\Services\UserService::getTaxFree(), false, \App\Services\UserService::$user_country), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission]);
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->getPriceWith(\App\Services\UserService::getTaxFree(), false, \App\Services\UserService::$user_country), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission, 'show_on' => $product->show_on]);
if(\App\Services\UserService::getTaxFree()){
Yard::setTax($cartItem->rowId, 0);
}else{
@ -587,7 +590,7 @@ class WizardController extends Controller
if($product_on_board->images->count()){
$image = $product_on_board->images->first()->slug;
}
$cartItem = Yard::instance('shopping')->add($product_on_board->id, $product_on_board->getLang('name'), 1, $product_on_board->getPriceWith(\App\Services\UserService::getTaxFree(), false, \App\Services\UserService::$user_country), false, false, ['image' => $image, 'slug' => $product_on_board->slug, 'weight' => $product_on_board->weight, 'points' => $product_on_board->points, 'no_commission' => $product_on_board->no_commission]);
$cartItem = Yard::instance('shopping')->add($product_on_board->id, $product_on_board->getLang('name'), 1, $product_on_board->getPriceWith(\App\Services\UserService::getTaxFree(), false, \App\Services\UserService::$user_country), false, false, ['image' => $image, 'slug' => $product_on_board->slug, 'weight' => $product_on_board->weight, 'points' => $product_on_board->points, 'no_commission' => $product_on_board->no_commission, 'show_on' => $product_on_board->show_on]);
if(\App\Services\UserService::getTaxFree()){
Yard::setTax($cartItem->rowId, 0);
}else{

View file

@ -61,7 +61,7 @@ class Checkout
Yard::instance('shopping')->setShippingCountryWithPrice($shopping_instance->country_id, $is_for);
if($shopping_instance->payment !== 6){
//delete shopping instance
//delete shopping instance is not save for restore, payment link
ShoppingInstance::where('identifier', $request->route('identifier'))->delete();
}

View file

@ -17,18 +17,20 @@ class MailCheckout extends Mailable
protected $shopping_payment;
protected $send_link;
protected $mode;
protected $payment_error;
public $subject;
public $data;
public function __construct($txaction, $shopping_order, $shopping_payment, $send_link, $mode)
public function __construct($txaction, $shopping_order, $shopping_payment, $send_link, $mode, $payment_error = false)
{
$this->txaction = $txaction;
$this->shopping_order = $shopping_order;
$this->shopping_payment = $shopping_payment;
$this->send_link = $send_link;
$this->mode = $mode;
$this->payment_error = $payment_error;
if($this->txaction === 'paid'){
$this->subject = __('email.checkout_subject_paid')." ";
@ -77,6 +79,7 @@ class MailCheckout extends Mailable
'txaction' => $this->txaction,
'shopping_order' => $this->shopping_order,
'shopping_payment' => $this->shopping_payment,
'payment_error' => $this->payment_error,
'copy3line' => __('email.checkout_copy3line'),
'greetings' => __('email.greetings'),
'sender' => __('email.sender'),

View file

@ -18,6 +18,8 @@ class MailCustomPaymet extends Mailable
protected $mode;
protected $name;
protected $yard_shopping_items;
protected $is_abo;
protected $is_for;
public $subject;
@ -31,9 +33,10 @@ class MailCustomPaymet extends Mailable
$this->shopping_instance = $shopping_instance;
$this->mode = $mode;
$this->yard_shopping_items = $yard_shopping_items;
$this->is_abo = isset($shopping_instance->shopping_data['is_abo']) ? $shopping_instance->shopping_data['is_abo'] : 0;
$this->is_for = isset($shopping_instance->shopping_data['is_for']) ? $shopping_instance->shopping_data['is_for'] : 0;
$this->name = $shopping_user->member->account->first_name." ".$shopping_user->member->account->last_name." - ";
$this->subject = __('email.subject_custom_payout', ['name' => $this->name]);
$this->subject =$this->is_abo ? __('email.subject_custom_abo_payout', ['name' => $this->name]) : __('email.subject_custom_payout', ['name' => $this->name]);
}
@ -43,10 +46,12 @@ class MailCustomPaymet extends Mailable
return $this->view('emails.custom_payment')->with([
'salutation' => $salutation,
'copy1line' => __('email.your_custom_payout', ['name' => $this->name]),
'copy1line' => $this->is_abo ? __('email.your_custom_abo_payout', ['name' => $this->name]) : __('email.your_custom_payout', ['name' => $this->name]),
'shopping_user' => $this->shopping_user,
'shopping_instance' => $this->shopping_instance,
'yard_shopping_items' => $this->yard_shopping_items,
'is_abo' => $this->is_abo,
'is_for' => $this->is_for,
'copy3line' => __('email.checkout_copy3line'),
'greetings' => __('email.greetings'),
'route' => $this->route,

View file

@ -60,7 +60,7 @@ class Category extends Model
'parent_id', 'name', 'headline', 'pos', 'active',
];
public function sluggable()
public function sluggable() : array
{
return [
'slug' => [

View file

@ -10,13 +10,20 @@ use Illuminate\Database\Eloquent\Model;
/**
* Class DbipLookup
*
*
* @property string $addr_type
* @property string $ip_start
* @property string $ip_end
* @property string $country
*
* @package App\Models
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup query()
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup whereAddrType($value)
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup whereCountry($value)
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup whereIpEnd($value)
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup whereIpStart($value)
* @mixin \Eloquent
*/
class DbipLookup extends Model
{

View file

@ -10,13 +10,20 @@ use Illuminate\Database\Eloquent\Model;
/**
* Class DbipLookup
*
*
* @property string $addr_type
* @property string $ip_start
* @property string $ip_end
* @property string $country
*
* @package App\Models
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup2 newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup2 newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup2 query()
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup2 whereAddrType($value)
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup2 whereCountry($value)
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup2 whereIpEnd($value)
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup2 whereIpStart($value)
* @mixin \Eloquent
*/
class DbipLookup2 extends Model
{

View file

@ -10,13 +10,20 @@ use Illuminate\Database\Eloquent\Model;
/**
* Class DbipLookup
*
*
* @property string $addr_type
* @property string $ip_start
* @property string $ip_end
* @property string $country
*
* @package App\Models
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup3 newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup3 newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup3 query()
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup3 whereAddrType($value)
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup3 whereCountry($value)
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup3 whereIpEnd($value)
* @method static \Illuminate\Database\Eloquent\Builder|DbipLookup3 whereIpStart($value)
* @mixin \Eloquent
*/
class DbipLookup3 extends Model
{

View file

@ -13,15 +13,28 @@ use Cviebrock\EloquentSluggable\Sluggable;
/**
* Class DcCategory
*
*
* @property int $id
* @property string $name
* @property int $pos
* @property string $slug
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*
* @package App\Models
* @property bool $active
* @method static \Illuminate\Database\Eloquent\Builder|DcCategory findSimilarSlugs(string $attribute, array $config, string $slug)
* @method static \Illuminate\Database\Eloquent\Builder|DcCategory newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|DcCategory newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|DcCategory query()
* @method static \Illuminate\Database\Eloquent\Builder|DcCategory whereActive($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcCategory whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcCategory whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcCategory whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcCategory wherePos($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcCategory whereSlug($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcCategory whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcCategory withUniqueSlugConstraints(\Illuminate\Database\Eloquent\Model $model, string $attribute, array $config, string $slug)
* @mixin \Eloquent
*/
class DcCategory extends Model
{
@ -41,7 +54,7 @@ class DcCategory extends Model
'active'
];
public function sluggable()
public function sluggable() : array
{
return [
'slug' => [

View file

@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\Model;
/**
* Class DcFile
*
*
* @property int $id
* @property string $filename
* @property string $original_name
@ -22,10 +22,26 @@ use Illuminate\Database\Eloquent\Model;
* @property int|null $active
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*
* @property Collection|DcFileTag[] $dc_file_tags
*
* @package App\Models
* @property-read int|null $dc_file_tags_count
* @property-read Collection<int, \App\Models\DcFileTag> $fileTag
* @property-read int|null $file_tag_count
* @property-read Collection<int, \App\Models\DcTag> $tags
* @property-read int|null $tags_count
* @method static \Illuminate\Database\Eloquent\Builder|DcFile newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|DcFile newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|DcFile query()
* @method static \Illuminate\Database\Eloquent\Builder|DcFile whereActive($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcFile whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcFile whereExt($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcFile whereFilename($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcFile whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcFile whereMine($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcFile whereOriginalName($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcFile whereSize($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcFile whereUpdatedAt($value)
* @mixin \Eloquent
*/
class DcFile extends Model
{

View file

@ -11,17 +11,24 @@ use Illuminate\Database\Eloquent\Model;
/**
* Class DcFileTag
*
*
* @property int $id
* @property int $file_id
* @property int $tag_id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*
* @property DcFile $dc_file
* @property DcTag $dc_tag
*
* @package App\Models
* @method static \Illuminate\Database\Eloquent\Builder|DcFileTag newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|DcFileTag newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|DcFileTag query()
* @method static \Illuminate\Database\Eloquent\Builder|DcFileTag whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcFileTag whereFileId($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcFileTag whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcFileTag whereTagId($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcFileTag whereUpdatedAt($value)
* @mixin \Eloquent
*/
class DcFileTag extends Model
{

View file

@ -14,7 +14,7 @@ use Cviebrock\EloquentSluggable\Sluggable;
/**
* Class DcTag
*
*
* @property int $id
* @property int|null $category_id
* @property string $name
@ -22,10 +22,24 @@ use Cviebrock\EloquentSluggable\Sluggable;
* @property string $slug
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*
* @property Collection|DcFileTag[] $dc_file_tags
*
* @package App\Models
* @property bool $active
* @property-read int|null $dc_file_tags_count
* @method static \Illuminate\Database\Eloquent\Builder|DcTag findSimilarSlugs(string $attribute, array $config, string $slug)
* @method static \Illuminate\Database\Eloquent\Builder|DcTag newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|DcTag newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|DcTag query()
* @method static \Illuminate\Database\Eloquent\Builder|DcTag whereActive($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcTag whereCategoryId($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcTag whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcTag whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcTag whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcTag wherePos($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcTag whereSlug($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcTag whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|DcTag withUniqueSlugConstraints(\Illuminate\Database\Eloquent\Model $model, string $attribute, array $config, string $slug)
* @mixin \Eloquent
*/
class DcTag extends Model
{
@ -47,7 +61,7 @@ class DcTag extends Model
'active'
];
public function sluggable()
public function sluggable() : array
{
return [
'slug' => [

View file

@ -71,6 +71,8 @@ use Illuminate\Database\Eloquent\Collection;
* @method static \Illuminate\Database\Eloquent\Builder|Homeparty whereOrder($value)
* @method static \Illuminate\Database\Eloquent\Builder|Homeparty whereSettings($value)
* @method static \Illuminate\Database\Eloquent\Builder|Homeparty whereStep($value)
* @property array|null $trans_description
* @method static \Illuminate\Database\Eloquent\Builder|Homeparty whereTransDescription($value)
* @mixin \Eloquent
*/
class Homeparty extends Model

View file

@ -51,7 +51,7 @@ class IqImage extends Model
'filename', 'original_name', 'ext', 'mine', 'size'
];
public function sluggable()
public function sluggable() : array
{
return [
'slug' => [

View file

@ -75,7 +75,11 @@ class IqSite extends Model
public function getProductModels(){
$ret = [];
foreach($this->products as $product_id){
$ret[] = Product::findOrFail($product_id);
$product = Product::findOrFail($product_id);
if($product->active){
$ret[] = $product;
}
}
return $ret;
@ -84,7 +88,10 @@ class IqSite extends Model
public function getProductSetModels(){
$ret = [];
foreach($this->set_products as $product_id){
$ret[] = Product::findOrFail($product_id);
$product = Product::findOrFail($product_id);
if($product->active){
$ret[] = $product;
}
}
return $ret;

View file

@ -36,6 +36,8 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentMethod whereUpdatedAt($value)
* @property array|null $show_on
* @method static \Illuminate\Database\Eloquent\Builder|PaymentMethod whereShowOn($value)
* @property bool $is_abo
* @method static \Illuminate\Database\Eloquent\Builder|PaymentMethod whereIsAbo($value)
* @mixin \Eloquent
*/
class PaymentMethod extends Model

View file

@ -249,9 +249,8 @@ class Product extends Model
8 => 'Mitgliedschaft Berater',
9 => 'Onboarding Berater',
10 => 'zur internen Berechnung',
12 => 'Abo-ShopBerater',
13 => 'Abo-ShopBeraterKunden',
12 => 'Abo-BasisProdukt',
13 => 'Abo-AddonProdukt',
];
public $actions = [
@ -270,7 +269,18 @@ class Product extends Model
];
public function sluggable()
/************* ✨ Codeium Command ⭐ *************/
/**
* Configure the model for auto-generating a slug.
*
* This method returns an array defining the attributes used
* to generate the slug for the model. In this case, the 'name'
* attribute is used as the source for generating the slug.
*
* @return array Configuration for slug generation.
*/
/****** e935bd41-f49b-4736-9603-2da86dc27f25 *******/ public function sluggable() : array
{
return [
'slug' => [
@ -393,23 +403,25 @@ class Product extends Model
}
/*price by user Factor*/
private function calcPriceUserFactor($price){
private function calcPriceUserFactor($price, $user=null){
if($this->no_commission){
return $price;
}
if(\Auth::user() && \Auth::user()->user_level){
$margin = ((\Auth::user()->user_level->margin -100)*-1) / 100;
$user = $user ? $user : \Auth::user();
if($user && $user->user_level){
$margin = (($user->user_level->margin -100)*-1) / 100;
$price = $price * $margin;
}
return $price;
}
private function calcPriceUserCommission($price){
private function calcPriceUserCommission($price, $user){
if($this->no_commission){
return $price;
}
if(\Auth::user() && \Auth::user()->user_level){
$margin = \Auth::user()->user_level->margin;
$user = $user ? $user : \Auth::user();
if($user && $user->user_level){
$margin = $user->user_level->margin;
$price = $price / 100 * $margin;
}
return $price;
@ -423,13 +435,13 @@ class Product extends Model
return $price / $tax_rate;
}
//price calu with
public function getPriceWith(Bool $net = true, Bool $ufactor = true, $country = null, $commission=false){
public function getPriceWith(Bool $net = true, Bool $ufactor = true, $country = null, $commission=false, $user = null){
$price = isset($this->attributes['price']) ? $this->attributes['price'] : null;
$cprice = $country ? $this->getCPrice($country) : null;
$price = $cprice ? $cprice : $price;
$price = $net ? $this->calcPriceNet($price, $country) : $price;
$price = $ufactor ? $this->calcPriceUserFactor($price) : $price;
$price = $commission ? $this->calcPriceUserCommission($price) : $price;
$price = $ufactor ? $this->calcPriceUserFactor($price, $user) : $price;
$price = $commission ? $this->calcPriceUserCommission($price, $user) : $price;
return round($price, 2);
}

View file

@ -51,7 +51,7 @@ class ProductImage extends Model
'product_id', 'filename', 'original_name', 'ext', 'mine', 'size'
];
public function sluggable()
public function sluggable() : array
{
return [
'slug' => [

View file

@ -78,7 +78,7 @@ class Setting extends Model
];
public function sluggable()
public function sluggable() : array
{
return [
'slug' => [

View file

@ -121,7 +121,7 @@ class ShoppingCollectOrder extends Model
$add_tax = round($add_tax, 2);
$tax_split[$tax_rate] = isset($tax_split[$tax_rate]) ? round($tax_split[$tax_rate] += $add_tax, 2) : $add_tax;
foreach($tax_split as $key=>$value){
foreach((array)$tax_split as $key=>$value){
$tax_split[$key] = number_format($value, 2);
}
$this->tax_split = $tax_split;
@ -141,13 +141,31 @@ class ShoppingCollectOrder extends Model
public function addShopItem($shop_item_id, $shop_item)
{
$shop_item->user_price_net = number_format($shop_item->user_price_net, 2);
$shop_item->user_price_total_net = number_format($shop_item->user_price_total_net, 2);
$shop_item->user_tax = number_format($shop_item->user_tax, 2);
$shop_item->user_tax_total = number_format($shop_item->user_tax_total, 2);
$numberFields = [
'user_price_net',
'user_price_total_net',
'user_tax',
'user_tax_total'
];
$intFields = [
'points_total',
'points'
];
foreach ($numberFields as $field) {
if (isset($shop_item->$field)) {
$shop_item->$field = number_format($shop_item->$field, 2);
}
}
foreach ($intFields as $field) {
if (isset($shop_item->$field)) {
$shop_item->$field = intval($shop_item->$field);
}
}
$this->shop_items[$shop_item_id] = $shop_item;
}
public function addOrder($order)

View file

@ -35,6 +35,12 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingInstance whereShoppingData($value)
* @property string|null $language
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingInstance whereLanguage($value)
* @property int|null $status
* @property float|null $amount
* @property int|null $shopping_user_id
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingInstance whereAmount($value)
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingInstance whereShoppingUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingInstance whereStatus($value)
* @mixin \Eloquent
*/
class ShoppingInstance extends Model
@ -50,14 +56,29 @@ class ShoppingInstance extends Model
];
public $statuses = [
0 => 'link_sent',
1 => 'link_openly',
2 => 'link_check',
3 => 'link_pending',
4 => 'link_appointed',
5 => 'link_failed',
6 => 'link_canceled',
10 => 'link_paid',
];
protected $table = 'shopping_instances';
protected $casts = ['shopping_data' => 'array'];
protected $casts = ['shopping_data' => 'array', 'amount' => 'float'];
protected $fillable = [
'identifier', 'user_shop_id', 'auth_user_id', 'payment', 'subdomain', 'language', 'country_id', 'shopping_data', 'back'
'identifier', 'user_shop_id', 'auth_user_id', 'status', 'payment', 'subdomain', 'language', 'country_id', 'amount', 'shopping_user_id', 'shopping_data', 'back'
];
public function getStatus(){
return isset($this->statuses[$this->status]) ? $this->statuses[$this->status] : 'link_sent';
}
public function getLocale(){
return $this->language ? $this->language : \App::getLocale();
}
@ -78,5 +99,11 @@ class ShoppingInstance extends Model
return $this->belongsTo('App\User','auth_user_id');
}
public function getAmountFormatted(){
return formatNumber($this->amount);
}
}

View file

@ -97,6 +97,10 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereNetSplit($value)
* @property string|null $language
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereLanguage($value)
* @property bool|null $is_abo
* @property int|null $abo_interval
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereAboInterval($value)
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereIsAbo($value)
* @mixin \Eloquent
*/
class ShoppingOrder extends Model
@ -281,6 +285,13 @@ class ShoppingOrder extends Model
}
public function getUserAbo(){
$UserAboOrder = UserAboOrder::where('shopping_order_id', $this->id)->first();
if($UserAboOrder && $UserAboOrder->user_abo){
return $UserAboOrder->user_abo;
}
return null;
}
public function getLocale(){
return $this->language ? $this->language : \App::getLocale();

View file

@ -83,6 +83,16 @@ class ShoppingOrderItem extends Model
'points',
'slug',
];
protected $casts = [
'qty' => 'int',
'price' => 'float',
'price_net' => 'float',
'tax_rate' => 'float',
'tax' => 'float',
'price_vk_net' => 'float',
'discount' => 'float',
'points' => 'int',
];
public function shopping_order()
{

View file

@ -40,23 +40,35 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingPayment whereWallettype($value)
* @property string|null $mode
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingPayment whereMode($value)
* @property array|null $carddata
* @property int|null $is_abo
* @property int|null $abo_interval
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingPayment whereAboInterval($value)
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingPayment whereCarddata($value)
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingPayment whereIsAbo($value)
* @mixin \Eloquent
*/
class ShoppingPayment extends Model
{
protected $table = 'shopping_payments';
protected $casts = [
'carddata' => 'array',
];
protected $fillable = [
'shopping_order_id',
'clearingtype',
'wallettype',
'onlinebanktransfertype',
'carddata',
'reference',
'amount',
'currency',
'mode',
'is_abo',
'abo_interval',
'identifier',
];
@ -69,7 +81,7 @@ class ShoppingPayment extends Model
{
return $this->hasMany('App\Models\PaymentTransaction','shopping_payment_id');
}
public function getPaymentType(){
if($this->clearingtype === 'wlt') {

View file

@ -2,6 +2,7 @@
namespace App\Models;
use App\Services\ShoppingUserService;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
@ -312,4 +313,8 @@ class ShoppingUser extends Model
];
}
}
public function getAllOrdersByMember(){
return ShoppingUserService::getAllOrdersByMember($this);
}
}

View file

@ -63,7 +63,7 @@ class SySetting extends Model
1 => 'default',
];
public function sluggable()
public function sluggable() : array
{
return [
'slug' => [

View file

@ -8,20 +8,20 @@ namespace App\Models;
use App\User;
use Carbon\Carbon;
use App\Services\Util;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class UserAbo
*
*
* @property int $id
* @property int $user_id
* @property int $payone_userid
* @property string $clearingtype
* @property string|null $wallettype
* @property int $amount
* @property string $currency
* @property bool $active
* @property int $status
* @property int $abo_interval
@ -32,11 +32,51 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property Carbon|null $updated_at
* @property string|null $deleted_at
* @property Carbon|null $user_deleted_at
*
* @property User $user
* @property Collection|UserAboOrder[] $user_abo_orders
*
* @package App\Models
* @property int|null $member_id
* @property int $shopping_user_id
* @property string|null $email
* @property string|null $is_for
* @property array|null $carddata
* @property \Illuminate\Support\Carbon|null $start_date
* @property \Illuminate\Support\Carbon|null $last_date
* @property \Illuminate\Support\Carbon|null $next_date
* @property-read User|null $member
* @property-read \App\Models\ShoppingUser $shopping_user
* @property-read Collection<int, \App\Models\UserAboItem> $user_abo_items
* @property-read int|null $user_abo_items_count
* @property-read int|null $user_abo_orders_count
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo onlyTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo query()
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereAboInterval($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereActive($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereAmount($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereCancelDate($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereCarddata($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereClearingtype($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereDeletedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereEmail($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereIsFor($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereLastDate($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereMemberId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereNextDate($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo wherePayoneUserid($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereShoppingUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereStartDate($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereStatus($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereUserDeletedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo whereWallettype($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|UserAbo withoutTrashed()
* @mixin \Eloquent
*/
class UserAbo extends Model
{
@ -45,29 +85,33 @@ class UserAbo extends Model
protected $casts = [
'user_id' => 'int',
'member_id' => 'int',
'shopping_user_id' => 'int',
'payone_userid' => 'int',
'amount' => 'int',
'active' => 'bool',
'status' => 'int',
'abo_interval' => 'int',
'amount' => 'int',
'start_date' => 'datetime',
'last_date' => 'datetime',
'next_date' => 'datetime',
'cancel_date' => 'datetime',
'count' => 'int',
'user_deleted_at' => 'datetime'
'user_deleted_at' => 'datetime',
'carddata' => 'array'
];
protected $fillable = [
'user_id',
'member_id',
'shopping_user_id',
'is_for',
'email',
'payone_userid',
'clearingtype',
'wallettype',
'carddata',
'amount',
'currency',
'active',
'status',
'abo_interval',
@ -75,13 +119,43 @@ class UserAbo extends Model
'last_date',
'next_date',
'cancel_date',
'count',
'user_deleted_at'
];
public static $aboDeliveryDays = [5, 10, 20, 25];
public static $statusTypes = [
0 => 'abo_new',
1 => 'abo_new',
2 => 'abo_okay',
3 => 'abo_hold',
4 => 'abo_cancel',
5 => 'abo_finish',
6 => 'abo_inactive',
7 => 'abo_grace'
];
public static $statusColors = [
0 => 'success',
1 => 'success',
2 => 'secondary',
3 => 'warning',
4 => 'danger',
5 => 'info',
6 => 'warning',
7 => 'danger'
];
public function user()
{
return $this->belongsTo(User::class);
return $this->belongsTo(User::class, 'user_id');
}
public function member()
{
return $this->belongsTo(User::class, 'member_id');
}
public function shopping_user()
@ -89,12 +163,21 @@ class UserAbo extends Model
return $this->belongsTo('App\Models\ShoppingUser','shopping_user_id');
}
public function user_abo_orders()
{
return $this->hasMany(UserAboOrder::class);
}
public function user_abo_items()
{
return $this->hasMany(UserAboItem::class);
}
public function getCountOrders(){
//sind bezahlte Bestellungen
return $this->user_abo_orders->where('status', '>=', 2)->count();
}
public function setStartDateAttribute( $value ) {
$this->attributes['start_date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
}
@ -127,5 +210,29 @@ class UserAbo extends Model
return $this->attributes['cancel_date'] ? Carbon::parse($this->attributes['cancel_date'])->format(\Util::formatDateDB()) : '';
}
public function getFormattedAmount()
{
return isset($this->attributes['amount']) ? Util::formatNumber($this->attributes['amount']/100) : "";
}
public function getIsForFormated()
{
return $this->attributes['is_for'] === 'me' ? '<span class="badge badge-outline-warning-dark">'.__('tables.adviser').'</span>' : '<span class="badge badge-outline-info">'.__('tables.customer').'</span>';
}
public function getStatusFormated(){
return '<span class="badge badge-pill badge-'.$this->getStatusColor().'">'.$this->getStatusType().'</span>';
}
public function getStatusType(){
return isset(self::$statusTypes[$this->status]) ? __('abo.'.self::$statusTypes[$this->status]) : "";
}
public function getStatusColor(){
return isset(self::$statusColors[$this->status]) ? self::$statusColors[$this->status] : "default";
}
public function getPaymentType(){
return $this->clearingtype === 'wlt' ? __('payment.paypal') : __('payment.credit_card');
}
}

View file

@ -0,0 +1,90 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use App\Services\Util;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Yard;
/**
* Class UserAboItem
*
* @property int $id
* @property int $user_abo_id
* @property int $product_id
* @property int|null $comp
* @property int $qty
* @property int $status
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Product $product
* @property UserAbo $user_abo
* @package App\Models
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem query()
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem whereComp($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem whereProductId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem whereQty($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem whereStatus($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAboItem whereUserAboId($value)
* @mixin \Eloquent
*/
class UserAboItem extends Model
{
protected $table = 'user_abo_items';
protected $casts = [
'user_abo_id' => 'int',
'product_id' => 'int',
'comp' => 'int',
'qty' => 'int',
'status' => 'int'
];
protected $fillable = [
'user_abo_id',
'product_id',
'comp',
'qty',
'status'
];
public function product()
{
return $this->belongsTo(Product::class);
}
public function user_abo()
{
return $this->belongsTo(UserAbo::class);
}
public function getPrice()
{
$ufactor = $this->user_abo->is_for === 'me' ? true : false;
$tax_free = $ufactor ? true : Yard::instance('shopping')->getUserTaxFree();
$userCountry = Yard::instance('shopping')->getUserCountry();
return $this->product->getPriceWith($tax_free, $ufactor, $userCountry);
}
public function getFormattedPrice(){
/** der Preis wird für den User berechnet */
return Util::formatNumber($this->getPrice());
}
public function getFormattedTotalPrice(){
/** der Preis wird für den User berechnet */
return Util::formatNumber($this->getPrice() * $this->qty);
}
}

View file

@ -12,18 +12,26 @@ use Illuminate\Database\Eloquent\Model;
/**
* Class UserAboOrder
*
*
* @property int $id
* @property int $user_abo_id
* @property int $shopping_order_id
* @property int $status
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*
* @property ShoppingOrder $shopping_order
* @property UserAbo $user_abo
*
* @package App\Models
* @method static \Illuminate\Database\Eloquent\Builder|UserAboOrder newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|UserAboOrder newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|UserAboOrder query()
* @method static \Illuminate\Database\Eloquent\Builder|UserAboOrder whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAboOrder whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAboOrder whereShoppingOrderId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAboOrder whereStatus($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAboOrder whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAboOrder whereUserAboId($value)
* @mixin \Eloquent
*/
class UserAboOrder extends Model
{
@ -42,6 +50,30 @@ class UserAboOrder extends Model
'status'
];
public static $statusTypes = [
0 => 'abo_new',
1 => 'abo_new',
2 => 'abo_okay',
3 => 'abo_hold',
4 => 'abo_cancel',
5 => 'abo_finish',
6 => 'abo_inactive',
7 => 'abo_grace'
];
public static $statusColors = [
0 => 'success',
1 => 'success',
2 => 'secondary',
3 => 'warning',
4 => 'danger',
5 => 'info',
6 => 'warning',
7 => 'danger'
];
public function shopping_order()
{
return $this->belongsTo(ShoppingOrder::class);
@ -51,4 +83,17 @@ class UserAboOrder extends Model
{
return $this->belongsTo(UserAbo::class);
}
public function getStatusFormated(){
return '<span class="badge badge-pill badge-'.$this->getStatusColor().'">'.$this->getStatusType().'</span>';
}
public function getStatusType(){
return isset(self::$statusTypes[$this->status]) ? __('abo.'.self::$statusTypes[$this->status]) : "";
}
public function getStatusColor(){
return isset(self::$statusColors[$this->status]) ? self::$statusColors[$this->status] : "default";
}
}

View file

@ -119,6 +119,10 @@ use Illuminate\Database\Eloquent\Casts\AsArrayObject;
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereSalesVolumePointsTPSum($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereSalesVolumeTPPoints($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereVersion($value)
* @property string|null $user_birthday
* @property string|null $user_phone
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereUserBirthday($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereUserPhone($value)
* @mixin \Eloquent
*/
class UserBusiness extends Model

View file

@ -40,6 +40,10 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem whereUserBusinessId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem whereUserCreditId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem whereUserId($value)
* @property int|null $from_month
* @property int|null $from_year
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem whereFromMonth($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem whereFromYear($value)
* @mixin \Eloquent
*/
class UserCreditItem extends Model

View file

@ -42,6 +42,8 @@ use App\User;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserHistory whereIdentifier($value)
* @property int|null $abo_options
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserHistory whereAboOptions($value)
* @property int|null $is_abo
* @method static \Illuminate\Database\Eloquent\Builder|UserHistory whereIsAbo($value)
* @mixin \Eloquent
*/
class UserHistory extends Model

View file

@ -65,6 +65,8 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Query\Builder|\App\Models\UserShop withTrashed()
* @method static \Illuminate\Database\Query\Builder|\App\Models\UserShop withoutTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|UserShop withUniqueSlugConstraints(\Illuminate\Database\Eloquent\Model $model, string $attribute, array $config, string $slug)
* @property array|null $trans
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereTrans($value)
* @mixin \Eloquent
*/
class UserShop extends Model
@ -87,7 +89,7 @@ class UserShop extends Model
protected $dates = ['deleted_at'];
use Sluggable;
public function sluggable()
public function sluggable() : array
{
return [
'slug' => [

View file

@ -46,7 +46,7 @@ class UserShopOnSite extends Model
'user_shop_id', 'filename', 'original_name', 'ext', 'mine', 'size'
];
public function sluggable()
public function sluggable() : array
{
return [
'slug' => [

View file

@ -1,72 +0,0 @@
<?php
namespace App\Policies;
use App\User;
use Illuminate\Auth\Access\HandlesAuthorization;
use Illuminate\Database\Eloquent\Model;
abstract class ModelPolicy
{
use HandlesAuthorization;
abstract protected function getModelClass(): string;
public function viewAny(User $user)
{
return $user->can('view-any-' . $this->getModelClass());
}
public function view(User $user, Model $model)
{
if ($user->can('view-' . $this->getModelClass())) {
return true;
}
if ($user->can('view-self-' . $this->getModelClass())) {
return $this->isOwner($user, $model);
}
return false;
}
public function create(User $user)
{
return $user->can('create-' . $this->getModelClass());
}
public function update(User $user, Model $model)
{
if ($user->can('update-' . $this->getModelClass())) {
return true;
}
if ($user->can('update-self-' . $this->getModelClass())) {
return $this->isOwner($user, $model);
}
return false;
}
public function delete(User $user, Model $model)
{
if ($user->can('delete-' . $this->getModelClass())) {
return true;
}
if ($user->can('delete-self-' . $this->getModelClass())) {
return $this->isOwner($user, $model);
}
return false;
}
private function isOwner(User $user, Model $model): bool
{
if (!empty($user) && method_exists($model, 'user')) {
return $user->getKey() === $model->getRelation('user')->getKey();
}
return false;
}
}

View file

@ -0,0 +1,89 @@
<?php
namespace App\Repositories;
use Carbon;
use App\Models\UserAbo;
use App\Services\AboHelper;
class AboRepository extends BaseRepository {
public function __construct()
{
//$this->model = $model;
}
public function setModel(UserAbo $model){
$this->model = $model;
}
public function update($data)
{
if(isset($data['action'])){
if($data['action'] === 'abo_update_settings'){
if($this->validate($data)){
$this->updateStatus($data);
$this->model->abo_interval = $data['abo_interval'];
$this->model->next_date = AboHelper::setNextDate(now(), $data['abo_interval']);
$this->model ->save();
\Session()->flash('alert-success', 'Einstellungen gespeichert');
return true;
}
return false;
}
}
return false;
}
public function create($data){
}
private function updateStatus($data){
$active = (isset($data['abo_is_active']) && $data['abo_is_active']) ? true : false;
//if status is active and active is false, set status to inactive
if($this->model->active && !$active){
if($this->model->status = 2){ //okay
$this->model->status = 6; //
}
}
if(!$this->model->active && $active){
if($this->model->status = 6){ //inactive
$this->model->status = 2; //okay
}
}
$this->model->active = $active;
return;
}
private function validate($data){
if($data['view'] !== 'admin'){
if($this->model->is_for === 'me' && $this->model->user_id !== \Auth::user()->id){
\Session()->flash('alert-error', 'Unauthorized action. User ID does not match.');
return false;
}
if($this->model->is_for === 'ot' && $this->model->member_id !== \Auth::user()->id){
\Session()->flash('alert-error', 'Unauthorized action. User ID does not match.');
return false;
}
if($data['view'] === 'me' && $this->model->is_for !== 'me'){
\Session()->flash('alert-error', 'Unauthorized action. Is not for me');
return false;
}
if($data['view'] === 'ot' && $this->model->is_for !== 'ot'){
\Session()->flash('alert-error', 'Unauthorized action. Is not your customer');
return false;
}
}
if(!in_array($data['abo_interval'], \App\Models\UserAbo::$aboDeliveryDays)){
//to check if user is not admin
\Session()->flash('alert-error', __('abo.error_abo_interval'));
return false;
}
return true;
}
}

View file

@ -0,0 +1,376 @@
<?php
namespace App\Repositories;
use Yard;
use App\Services\Util;
use App\Models\ShoppingUser;
use App\Models\Homeparty;
use App\Models\ShoppingCollectOrder;
use App\Models\PaymentMethod;
use App\Models\ShoppingOrder;
use Illuminate\Session\SessionManager;
use App\Models\ShoppingOrderItem;
use Illuminate\Support\Collection;
class CheckoutRepository extends BaseRepository {
private $session;
private $instance;
public function __construct(SessionManager $session)
{
$this->session = $session;
$this->instance = sprintf('%s.%s', 'cart', 'payments');
}
public function makeShoppingOrder($shopping_user, $data){
$user_shop = Util::getUserShop();
if($shopping_user->is_from === 'homeparty'){
//get data
$homeparty = Homeparty::find($shopping_user->homeparty_id);
//set Data!
$total = Yard::instance('shopping')->total(2, '.', ''); //ek_price
$data = [
'shopping_user_id' => $shopping_user->id,
'auth_user_id' => $shopping_user->auth_user_id,
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
'language' => \App::getLocale(),
'user_shop_id' => $user_shop->id,
'payment_for' => $shopping_user->getOrderPaymentFor(),
'homeparty_id' => $shopping_user->homeparty_id,
'total' => $total,
'subtotal' => $homeparty->order['ek_price_net'],
'shipping' => $homeparty->order['shipping_price'],
'shipping_net' => $homeparty->order['shipping_price_net'],
'subtotal_ws' => 0,
'tax' => $total - $homeparty->order['ek_price_net'],
'total_shipping' => Yard::instance('shopping')->totalWithShipping(2, '.', ''),
'points' => $homeparty->order['points'] - $homeparty->order['bonus_points_diff'],
'weight' => 0,
'txaction' => 'prev',
'mode' => Util::getUserShoppingMode(),
];
}elseif($shopping_user->is_from === 'collection'){
//get data
$ShoppingCollectOrder = ShoppingCollectOrder::find($shopping_user->shopping_collect_order_id);
//set Data!
$total = Yard::instance('shopping')->total(2, '.', ''); //ek_price
$data = [
'shopping_user_id' => $shopping_user->id,
'auth_user_id' => $shopping_user->auth_user_id,
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
'language' => \App::getLocale(),
'user_shop_id' => $user_shop->id,
'payment_for' => $shopping_user->getOrderPaymentFor(),
'total' => $total,
'subtotal' => $ShoppingCollectOrder->price_total_net,
'shipping' => 0,
'shipping_net' => 0,
'subtotal_ws' => $ShoppingCollectOrder->price_total_net,
'tax' => $ShoppingCollectOrder->tax_total,
'tax_split' => $ShoppingCollectOrder->tax_split,
'total_shipping' => Yard::instance('shopping')->totalWithShipping(2, '.', ''),
'points' => $ShoppingCollectOrder->points,
'weight' => 0,
'txaction' => 'prev',
'mode' => Util::getUserShoppingMode(),
];
}else{
$data = [
'shopping_user_id' => $shopping_user->id,
'auth_user_id' => $shopping_user->auth_user_id,
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
'language' => \App::getLocale(),
'user_shop_id' => $user_shop->id,
'payment_for' => $shopping_user->getOrderPaymentFor(),
'total' => Yard::instance('shopping')->total(2, '.', ''),
'subtotal' => Yard::instance('shopping')->subtotal(2, '.', ''),
'shipping' => Yard::instance('shopping')->shipping(2, '.', ','),
'shipping_net' => Yard::instance('shopping')->shippingNet(2, '.', ''),
'subtotal_ws' => Yard::instance('shopping')->subtotalWithShipping(2, '.', ''),
'tax' => Yard::instance('shopping')->taxWithShipping(2, '.', ''),
'total_shipping' => Yard::instance('shopping')->totalWithShipping(2, '.', ''),
'points' => Yard::instance('shopping')->points(),
'weight' => Yard::instance('shopping')->weight(),
'is_abo' => isset($data['is_abo']) ? $data['is_abo'] : false,
'abo_interval' => isset($data['abo_interval']) ? $data['abo_interval'] : null,
'txaction' => 'prev',
'mode' => Util::getUserShoppingMode(),
];
}
$shopping_order= false;
if($this->getSessionPayments('shopping_order_id')){
$shopping_order = ShoppingOrder::find($this->getSessionPayments('shopping_order_id'));
if($shopping_order){
$shopping_order->fill($data);
$shopping_order->save();
}
}
if(!$shopping_order){
$shopping_order = ShoppingOrder::create($data);
if($shopping_user->is_from === 'collection' && $ShoppingCollectOrder){
$ShoppingCollectOrder->shopping_order_id = $shopping_order->id;
$ShoppingCollectOrder->save();
}
}
$this->putSessionPayments('shopping_order_id', $shopping_order->id);
$items = Yard::instance('shopping')->getContentByOrder();
$shopping_order->shopping_order_items()->each(function($model) use ($items, $shopping_order, $shopping_user) {
foreach ($items as $item) {
if ($model->row_id === $item->rowId) {
$price_net = Yard::instance('shopping')->rowPriceNet($item, 2, '.', '');
$tax = $item->price - $price_net;
$data = [
'shopping_order_id' => $shopping_order->id,
'row_id' => $item->rowId,
'product_id' => $item->id,
'comp' => $item->options->comp,
'qty' => $item->qty,
'price' => $item->price,
'price_net' => $price_net,
'tax_rate' => $item->taxRate,
'tax' => $tax,
'price_vk_net' => $shopping_order->getPriceVkNetBy($item->id),
'discount' => $item->options->no_commission ? 0 : $shopping_order->getUserDiscount(),
'points' => $item->options->points,
'slug' => $item->options->slug,
];
if($shopping_user->is_from === 'homeparty'){
$data['homeparty_id'] = (int) $shopping_user->homeparty_id;
$data['product_id'] = null;
}
if($shopping_user->is_from === 'collection'){
$data['shopping_collect_order_id'] = (int) $shopping_user->shopping_collect_order_id;
$data['product_id'] = null;
}
$model->fill($data)->save();
return false;
}
}
return $model->delete();
});
foreach ($items as $item) {
if (!ShoppingOrderItem::where('shopping_order_id', $shopping_order->id)->where('row_id', $item->rowId)->count()){
$price_net = Yard::instance('shopping')->rowPriceNet($item, 2, '.', '');
$tax = $item->price - $price_net;
$data = [
'shopping_order_id' => $shopping_order->id,
'row_id' => $item->rowId,
'product_id' => $item->id,
'comp' => $item->options->comp,
'qty' => $item->qty,
'price' => $item->price,
'price_net' => $price_net,
'tax_rate' => $item->taxRate,
'tax' => $tax,
'price_vk_net' => $shopping_order->getPriceVkNetBy($item->id),
'discount' => $item->options->no_commission ? 0 : $shopping_order->getUserDiscount(),
'points' => $item->options->points,
'slug' => $item->options->slug
];
if($shopping_user->is_from === 'homeparty'){
$data['homeparty_id'] = (int) $shopping_user->homeparty_id;
$data['price_vk_net'] = 0;
$data['product_id'] = null;
}
if($shopping_user->is_from === 'collection'){
$data['price_vk_net'] = 0;
$data['shopping_collect_order_id'] = (int) $shopping_user->shopping_collect_order_id;
$data['product_id'] = null;
}
$shopping_order_item = ShoppingOrderItem::create($data);
}
}
if($shopping_user->is_from === 'homeparty'){
$shopping_order->makeHomepartyTaxSplit();
}elseif($shopping_user->is_from === 'collection'){
//is set on create / filll.
}else{
$shopping_order->makeTaxSplit();
}
return $shopping_order;
}
public function makeShoppingUser($data){
$data['same_as_billing'] = isset($data['same_as_billing']) ? false : true; //reinvert
$data['accepted_data_checkbox'] = isset($data['accepted_data_checkbox']) ? true : false;
$shopping_user = false;
if($this->getSessionPayments('shopping_user_id')){
$shopping_user = ShoppingUser::find($this->getSessionPayments('shopping_user_id'));
if($shopping_user){
$shopping_user->fill($data);
$shopping_user->mode = null;
$shopping_user->save();
}
}
if(!$shopping_user){
$shopping_user = ShoppingUser::create($data);
}
$this->putSessionPayments('shopping_user_id', $shopping_user->id);
return $shopping_user;
}
public function getPaymentsMethods($is_from, $is_abo = false){
$payment_methods = [];
if($is_from !== 'shopping' && Util::getAuthUser()){
$user = Util::getAuthUser();
$payment_methods['default'] = $user->payment_methods;
$payment_methods['data'] = $user->account->payment_data;
}else{
$payment_methods['default'] = PaymentMethod::getDefaultAsArray($is_abo)->toArray();
$payment_methods['data'] = false;
}
if($is_abo){
$payment_methods['active'] = \App\Models\PaymentMethod::where('active', true)->where('is_abo', true)->get()->pluck( 'id', 'short')->toArray();
}else{
$payment_methods['active'] = \App\Models\PaymentMethod::where('active', true)->get()->pluck( 'id', 'short')->toArray();
}
return $payment_methods;
}
public function isPaymentsMethodsActive($payment_method, $is_from, $is_abo = false){
$payment_names = ['wlt#PPE' => 'PP', 'cc' => 'CC', 'sb#PNT' => 'SB', 'elv' => 'SEPA', 'vor' => 'VOR', 'fnc#MIV' => 'FNC'];
$payment_methods = $this->getPaymentsMethods($is_from, $is_abo);
if(isset($payment_names[$payment_method])){
$payment_with = $payment_names[$payment_method];
if(array_key_exists($payment_with, $payment_methods['active']) && in_array($payment_methods['active'][$payment_with], $payment_methods['default'])){
return true;
}
}
abort(404);
}
public function makeCustomerShoppingUser($shopping_data){
// $shopping_user = ShoppingUser::findOrFail($shopping_data['shopping_user_id']);
$shopping_user = new ShoppingUser();
$shopping_user->fill($shopping_data);
$shopping_user->faker_mail = false;
$shopping_user->auth_user_id = null;
$shopping_user->homeparty_id = null;
$shopping_user->same_as_billing = $shopping_user->same_as_billing ? false : true; //reinvert
// $shopping_user->id = null;
$shopping_user->accepted_data_checkbox = 1;
return $shopping_user;
}
public function shoppingUserAuthData($is_from, $is_for, $data = []){
$user = Util::getAuthUser();
$shopping_user = new ShoppingUser();
$shopping_user->auth_user_id = $user->id;
$shopping_user->mode = 'prev';
$shopping_user->language = \App::getLocale();
$shopping_user->billing_salutation = $user->account->salutation;
$shopping_user->billing_company = $user->account->company;
$shopping_user->billing_firstname = $user->account->first_name;
$shopping_user->billing_lastname = $user->account->last_name;
$shopping_user->billing_address = $user->account->address;
$shopping_user->billing_address_2 = $user->account->address_2;
$shopping_user->billing_zipcode = $user->account->zipcode;
$shopping_user->billing_city = $user->account->city;
$shopping_user->billing_country_id = $user->account->country_id;
$shopping_user->billing_phone = $user->account->phone;
$shopping_user->billing_email = $user->email;
$shopping_user->faker_mail = false;
$shopping_user->shipping_email = $user->email;
$shopping_user->accepted_data_checkbox = 1;
$shopping_user->is_for = $is_for;
$shopping_user->is_from = $is_from;
$shopping_user->homeparty_id = isset($data['homeparty_id']) ? $data['homeparty_id'] : null;
$shopping_user->shopping_collect_order_id = isset($data['shopping_collect_order_id']) ? $data['shopping_collect_order_id'] : null;
//Lieferadresse
if($is_from === 'user_order'){
if(isset($data['shopping_user_id']) && strpos($data['is_for'], 'ot') !== false){
$s_user = ShoppingUser::findOrFail($data['shopping_user_id']);
/* $shopping_user->billing_salutation = $s_user->billing_salutation;
$shopping_user->billing_company = $s_user->billing_company;
$shopping_user->billing_firstname = $s_user->billing_firstname;
$shopping_user->billing_lastname = $s_user->billing_lastname;
$shopping_user->billing_address = $s_user->billing_address;
$shopping_user->billing_address_2 = $s_user->billing_address_2;
$shopping_user->billing_zipcode = $s_user->billing_zipcode;
$shopping_user->billing_city = $s_user->billing_city;
$shopping_user->billing_country_id = $s_user->billing_country_id;
$shopping_user->billing_phone = $s_user->billing_phone;
$shopping_user->billing_email = $s_user->billing_email;
;*/
$shopping_user->faker_mail = $s_user->faker_mail;
if(!$s_user->faker_mail){
$shopping_user->shipping_email = $s_user->billing_email;
}
$shopping_user->shopping_user_id = $data['shopping_user_id'];
$shopping_user->member_id = $s_user->member_id;
}
$shopping_user->same_as_billing = true;
$shopping_user->shipping_salutation = isset($data['shipping_salutation']) ? $data['shipping_salutation'] : '';
$shopping_user->shipping_company = isset($data['shipping_company']) ? $data['shipping_company'] : '';
$shopping_user->shipping_firstname = isset($data['shipping_firstname']) ? $data['shipping_firstname'] : '';
$shopping_user->shipping_lastname = isset($data['shipping_lastname']) ? $data['shipping_lastname'] : '';
$shopping_user->shipping_address = isset($data['shipping_address']) ? $data['shipping_address'] : '';
$shopping_user->shipping_address_2 = isset($data['shipping_address_2']) ? $data['shipping_address_2'] : '';
$shopping_user->shipping_zipcode = isset($data['shipping_zipcode']) ? $data['shipping_zipcode'] : '';
$shopping_user->shipping_city = isset($data['shipping_city']) ? $data['shipping_city'] : '';
$shopping_user->shipping_country_id = Yard::instance('shopping')->getShippingCountryCountryId();
$shopping_user->shipping_phone = isset($data['shipping_phone']) ? $data['shipping_phone'] : '';
}else{
$shopping_user->same_as_billing = $user->account->same_as_billing ? false : true;
$shopping_user->shipping_salutation = $user->account->shipping_salutation;
$shopping_user->shipping_company = $user->account->shipping_company;
$shopping_user->shipping_firstname = $user->account->shipping_firstname;
$shopping_user->shipping_lastname = $user->account->shipping_lastname;
$shopping_user->shipping_address = $user->account->shipping_address;
$shopping_user->shipping_address_2 = $user->account->shipping_address_2;
$shopping_user->shipping_zipcode = $user->account->shipping_zipcode;
$shopping_user->shipping_city = $user->account->shipping_city;
$shopping_user->shipping_country_id = $user->account->shipping_country_id;
$shopping_user->shipping_phone = $user->account->shipping_phone;
}
return $shopping_user;
}
public function putSessionPayments($key, $value){
$content = $this->getContent();
$content->put($key, $value);
$this->session->put($this->instance, $content);
}
public function getSessionPayments($key){
$content = $this->getContent();
if ($content->has($key)){
return $content->get($key);
}
return false;
}
public function sessionDestroy()
{
$this->session->remove($this->instance);
}
private function getContent()
{
if (is_null($this->session->get($this->instance))) {
return new Collection([]);
}
return $this->session->get($this->instance);
}
}

View file

@ -2,24 +2,36 @@
namespace App\Repositories\DC;
use Imagick;
use Request;
use App\Models\DcFile;
use App\Services\Util;
use App\Models\DcFileTag;
use App\Repositories\BaseRepository;
use Intervention\Image\Facades\Image;
use Imagick;
class FileRepository extends BaseRepository {
private const ALLOWED_IMAGE_TYPES = [
'image/jpeg',
'image/gif',
'image/png'
];
private const ALLOWED_PDF_TYPES = [
'application/pdf'
];
public function __construct()
{
}
private const THUMB_WIDTH = 542;
private const THUMB_HEIGHT = 360;
private const BIG_WIDTH = 1600;
private const BIG_HEIGHT = 900;
public function uploadFile( $form_data )
public function uploadFile(array $form_data): DcFile
{
if (!isset($form_data['file']) || !$form_data['file']->isValid()) {
throw new \InvalidArgumentException('Invalid file provided');
}
$file = $form_data['file'];
$originalName = $file->getClientOriginalName();
$extension = $file->getClientOriginalExtension();
@ -43,109 +55,163 @@ class FileRepository extends BaseRepository {
return $dc_file;
}
public function makeThumb($id){
public function makeThumb(int $id): bool
{
$file = DcFile::findOrFail($id);
$this->makeThumbFromFile($file);
return true;
}
public function makeThumbFromFile($file)
public function makeThumbFromFile(DcFile $file): bool
{
$path = $file->getFile(true);
$filename = $file->filename;
$mine = \File::mimeType($path);
//make thumb
$allowedMimeTypes = ['image/jpeg','image/gif','image/png'];
if (in_array($mine, $allowedMimeTypes)) {
$img = Image::make($path);
$img->resize(542, 360, function ($c) {
$c->aspectRatio();
$c->upsize();
});
\Storage::disk('public')->put('dc/thumb/'.basename($filename), (string) $img->encode());
$img = Image::make($path);
$img->resize(1600, 900, function ($c) {
$c->aspectRatio();
$c->upsize();
});
\Storage::disk('public')->put('dc/big/'.basename($filename), (string) $img->encode());
}
$allowedMimeTypes = ['application/pdf'];
if (in_array($mine, $allowedMimeTypes)) {
$imagick = new \Imagick ($path.'[0]'); // 0 specifies the first page of the pdf
$imagick->setImageBackgroundColor('#ffffff');
$imagick = $imagick->mergeImageLayers( Imagick::LAYERMETHOD_FLATTEN );
$imagick->setImageFormat('jpg'); // set the format of the output image
$imagick->setImageCompression(\Imagick::COMPRESSION_JPEG);
$imagick->setImageCompressionQuality(60);
$imagick->resizeImage(1600, 900, \Imagick::FILTER_LANCZOS, 1,1);
$filestore = \Storage::disk('public')->path('dc/big/').basename($filename).".jpg";
$imagick->writeImage($filestore);
$imagick->resizeImage(542, 360, \Imagick::FILTER_LANCZOS, 1,1);
$filestore = \Storage::disk('public')->path('dc/thumb/').basename($filename).".jpg";
$imagick->writeImage($filestore);
}
return true;
}
public function tagsUpdate($id, $tags){
$file = DcFile::findOrFail($id);
$file_tags = DcFileTag::where('file_id', $file->id)->get();
//remove Tags
foreach ($file_tags as $file_tag) {
if(is_array($tags) && ($pos = array_search($file_tag->tag_id, $tags)) !== FALSE){
unset($tags[$pos]);
}else{
$file_tag->delete();
try {
$path = $file->getFile(true);
if (!file_exists($path)) {
throw new \Exception('File not found');
}
}
//set taTagsgs
if(is_array($tags)){
foreach ($tags as $key => $tag_id) {
DcFileTag::create([
'file_id' => $file->id,
'tag_id' => $tag_id
]);
}
}
$filename = $file->filename;
$mime = \File::mimeType($path);
if (in_array($mime, self::ALLOWED_IMAGE_TYPES)) {
$this->processImage($path, $filename);
} elseif (in_array($mime, self::ALLOWED_PDF_TYPES)) {
$this->processPdf($path, $filename);
}
return true;
} catch (\Exception $e) {
\Log::error('Thumbnail creation failed: ' . $e->getMessage());
return false;
}
}
private function processImage(string $path, string $filename): void
{
// Thumbnail
$img = Image::make($path);
$img->resize(542, 360, function ($c) {
$c->aspectRatio();
$c->upsize();
});
\Storage::disk('public')->put('dc/thumb/'.basename($filename), (string) $img->encode());
// Big image
$img = Image::make($path);
$img->resize(1600, 900, function ($c) {
$c->aspectRatio();
$c->upsize();
});
\Storage::disk('public')->put('dc/big/'.basename($filename), (string) $img->encode());
}
private function processPdf(string $path, string $filename): void
{
try {
// PDF mit höherer Auflösung rendern
$imagick = new \Imagick();
$imagick->setResolution(300, 300);
$imagick->readImage($path.'[0]');
// Grundlegende Bildoptimierungen
$imagick->setImageBackgroundColor('#ffffff');
$imagick->mergeImageLayers(\Imagick::LAYERMETHOD_FLATTEN);
$imagick->setImageFormat('jpg');
$imagick->setImageCompression(\Imagick::COMPRESSION_JPEG);
$imagick->setImageCompressionQuality(80);
// Große Version erstellen
$bigImage = clone $imagick;
$bigImage->resizeImage(self::BIG_WIDTH, self::BIG_HEIGHT, \Imagick::FILTER_LANCZOS, 1, true);
$bigImage->writeImage(\Storage::disk('public')->path('dc/big/').basename($filename).'.jpg');
$bigImage->clear();
// Thumbnail erstellen
$imagick->resizeImage(self::THUMB_WIDTH, self::THUMB_HEIGHT, \Imagick::FILTER_LANCZOS, 1, true);
$imagick->writeImage(\Storage::disk('public')->path('dc/thumb/').basename($filename).'.jpg');
// Ressourcen freigeben
$imagick->clear();
} catch (\ImagickException $e) {
\Log::error('PDF Verarbeitung fehlgeschlagen: ' . $e->getMessage());
throw new \RuntimeException('PDF Verarbeitung fehlgeschlagen: ' . $e->getMessage());
} finally {
if (isset($bigImage)) {
$bigImage->destroy();
}
if (isset($imagick)) {
$imagick->destroy();
}
}
}
public function tagsUpdate($id, array $tags = []): bool
{
$file = DcFile::findOrFail($id);
// Get existing tags
$existingTags = DcFileTag::where('file_id', $file->id)
->pluck('tag_id')
->toArray();
// Delete removed tags
$tagsToDelete = array_diff($existingTags, $tags);
if (!empty($tagsToDelete)) {
DcFileTag::where('file_id', $file->id)
->whereIn('tag_id', $tagsToDelete)
->delete();
}
// Add new tags
$tagsToAdd = array_diff($tags, $existingTags);
$newTags = [];
foreach ($tagsToAdd as $tagId) {
$newTags[] = [
'file_id' => $file->id,
'tag_id' => $tagId
];
}
if (!empty($newTags)) {
DcFileTag::insert($newTags);
}
return true;
}
public function deleteThumb($id){
$file = DcFile::findOrFail($id);
$path_thumb = $file->getThumb(true);
if (file_exists($path_thumb)) {
unlink($path_thumb);
}
$path_big = $file->getBig(true);
if (file_exists($path_big)) {
unlink($path_big);
}
return true;
}
public function deleteFile($id){
$file = DcFile::findOrFail($id);
$path_thumb = $file->getThumb(true);
if (file_exists($path_thumb)) {
unlink($path_thumb);
}
$path_big = $file->getBig(true);
if (file_exists($path_big)) {
unlink($path_big);
}
$path = $file->getFile(true);
private function deleteFileIfExists(string $path): void
{
if (file_exists($path)) {
unlink($path);
}
$file->delete();
return true;
}
public function deleteThumb($id): bool
{
try {
$file = DcFile::findOrFail($id);
$this->deleteFileIfExists($file->getThumb(true));
$this->deleteFileIfExists($file->getBig(true));
return true;
} catch (\Exception $e) {
\Log::error('Thumbnail deletion failed: ' . $e->getMessage());
return false;
}
}
public function deleteFile(int $id): bool
{
try {
$file = DcFile::findOrFail($id);
$this->deleteFileIfExists($file->getThumb(true));
$this->deleteFileIfExists($file->getBig(true));
$this->deleteFileIfExists($file->getFile(true));
$file->delete();
return true;
} catch (\Exception $e) {
\Log::error('File deletion failed: ' . $e->getMessage());
return false;
}
}
}

View file

@ -89,47 +89,5 @@ class FileRepository extends BaseRepository {
], 200);
}
/* public function createFile(Request $request)
{
$locale = \App::getLocale();
$data = [
'step' => 2,
'locale' => $locale,
];
$rules = array(
'network_name' => 'required|max:255',
'input_file_now' => 'required|mimes:png,pdf,jpg,jpeg|max:30000'
);
$validator = Validator::make(Request::all(), $rules);
if ($validator->fails()) {
// get the error messages from the validator
$messages = $validator->messages();
// redirect our user back to the form with the errors from the validator
return view('user.register_complete', $data)->withErrors($validator);
} else {
$user = \Auth::user();
if(!$user->account->network_name){
$file = request()->file('input_file_now');
//$ext = $file->guessClientExtension();
//$file->storeAs('user/' . $user->id .'/verification');
$data = $file->store('user/' . $user->id .'/verification');
$account = $user->account;
$account->network_name = Input::get('network_name');
$account->network_verification = basename($data);
$account->save();
$user->role_id = 2; //set as User by default!
$user->save();
}
return redirect('complete_register');
//return view('user.register_complete', $data);
}
}*/
}

View file

@ -34,12 +34,12 @@ class ProductRepository extends BaseRepository {
$data['sponsor_buying_points'] = isset($data['sponsor_buying_points']) ? 1 : 0;
$data['show_on'] = isset($data['show_on']) ? $data['show_on'] : null;
if($data['id'] === "new"){
$this->model = Product::create($data);
}
else{
$this->model = $this->getById($data['id']);
$this->model->slug = null;
$this->model->fill($data);
$this->model->save();
}

Some files were not shown because too many files have changed in this diff Show more