Updates to 03-2025
This commit is contained in:
parent
6167273a48
commit
9b54eb0512
348 changed files with 34535 additions and 5774 deletions
27
.env
27
.env
|
|
@ -5,17 +5,24 @@ APP_DEBUG=true
|
|||
APP_URL=https://partner.gruene-seele.test
|
||||
APP_API_DOMAIN=partner.gruene-seele.test
|
||||
APP_DOMAIN=partner.gruene-seele.test
|
||||
|
||||
APP_PROMO_URL=https://testemich.test
|
||||
APP_PROMO_DOMAIN=testemich.test
|
||||
|
||||
APP_SHOP_URL=https://grueneseele.test
|
||||
APP_SHOP_DOMAIN=grueneseele.test
|
||||
|
||||
APP_CHECKOUT_MAIL=register@adametz.media
|
||||
APP_CHECKOUT_TEST_MAIL=register@adametz.media
|
||||
APP_INFO_MAIL=register@adametz.media
|
||||
APP_INFO_TEST_MAIL=register@adametz.media
|
||||
EXCEPTION_MAIL=exception@adametz.media
|
||||
|
||||
APP_MAIN_TAX = 1.19
|
||||
APP_MAIN_TAX_RATE = 19
|
||||
|
||||
APP_MAIN_USER_ID = 2
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_LEVEL=debug
|
||||
|
||||
|
|
@ -46,15 +53,25 @@ REDIS_HOST=127.0.0.1
|
|||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=smtp
|
||||
MAIL_HOST=s182.goserver.host
|
||||
MAIL_DRIVER=smtp
|
||||
MAIL_HOST=w017f6e4.kasserver.com
|
||||
MAIL_PORT=587
|
||||
MAIL_USERNAME=web28p3
|
||||
MAIL_PASSWORD=WeE2bmI9GjB7pDgi
|
||||
MAIL_ENCRYPTION=""
|
||||
MAIL_USERNAME=m04a9fbc
|
||||
MAIL_PASSWORD=3tQ72oCHZgncCTpK
|
||||
MAIL_ENCRYPTION=null
|
||||
|
||||
#MAIL_MAILER=smtp
|
||||
#MAIL_HOST=s182.goserver.host
|
||||
#MAIL_PORT=587
|
||||
#MAIL_USERNAME=web28p3
|
||||
#MAIL_PASSWORD=WeE2bmI9GjB7pDgi
|
||||
#MAIL_ENCRYPTION=""
|
||||
MAIL_FROM_ADDRESS=partner@gruene-seele.bio
|
||||
MAIL_FROM_NAME="GRÜNE SEELE Naturkosmetik"
|
||||
|
||||
RECAPTCHA_SITE_KEY="6LcGr_kqAAAAAOnz-L6IIBC_fTzJ7siTheZgFVMY"
|
||||
RECAPTCHA_SECRET_KEY="6LcGr_kqAAAAAKBZVoy37ski0Gl54jenWOlrbc9z"
|
||||
|
||||
PAYPAL_MODE=sandbox
|
||||
PAYPAL_SANDBOX_CLIENT_ID=AWMeW59cMOHaMWfv44kIMnzaR81Qo4yNVzEC5LyWl7x5RjkJZOJmvbvljqWPNEw7GihF3FLRL_tEJPHo
|
||||
PAYPAL_SANDBOX_CLIENT_SECRET=EFOuvQJpx3lM2HjLjPURgcxKuGLtKxNHKZqx65uQpQ8WNLDvijHhb79X5oE22LKIwW5V0GdX09jI24bF
|
||||
|
|
|
|||
39
.php-cs-fixer.php
Normal file
39
.php-cs-fixer.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
$finder = PhpCsFixer\Finder::create()
|
||||
->in([
|
||||
__DIR__ . '/app',
|
||||
__DIR__ . '/config',
|
||||
__DIR__ . '/database',
|
||||
__DIR__ . '/resources',
|
||||
__DIR__ . '/routes',
|
||||
__DIR__ . '/tests',
|
||||
])
|
||||
->name('*.php')
|
||||
->notName('*.blade.php')
|
||||
->ignoreDotFiles(true)
|
||||
->ignoreVCS(true);
|
||||
|
||||
return (new PhpCsFixer\Config())
|
||||
->setRules([
|
||||
'@PSR2' => true,
|
||||
'array_syntax' => ['syntax' => 'short'],
|
||||
'ordered_imports' => ['sort_algorithm' => 'alpha'],
|
||||
'no_unused_imports' => true,
|
||||
'not_operator_with_successor_space' => true,
|
||||
'trailing_comma_in_multiline' => true,
|
||||
'phpdoc_scalar' => true,
|
||||
'unary_operator_spaces' => true,
|
||||
'binary_operator_spaces' => true,
|
||||
'blank_line_before_statement' => [
|
||||
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
|
||||
],
|
||||
'phpdoc_single_line_var_spacing' => true,
|
||||
'phpdoc_var_without_name' => true,
|
||||
'method_argument_space' => [
|
||||
'on_multiline' => 'ensure_fully_multiline',
|
||||
'keep_multiple_spaces_after_comma' => true,
|
||||
],
|
||||
'single_trait_insert_per_statement' => true,
|
||||
])
|
||||
->setFinder($finder);
|
||||
|
|
@ -20,8 +20,10 @@ namespace PHPSTORM_META {
|
|||
'Facade\Ignition\DumpRecorder\MultiDumpHandler' => \Facade\Ignition\DumpRecorder\MultiDumpHandler::class,
|
||||
'Facade\Ignition\ErrorPage\Renderer' => \Facade\Ignition\ErrorPage\Renderer::class,
|
||||
'Facade\Ignition\IgnitionConfig' => \Facade\Ignition\IgnitionConfig::class,
|
||||
'Facade\Ignition\JobRecorder\JobRecorder' => \Facade\Ignition\JobRecorder\JobRecorder::class,
|
||||
'Facade\Ignition\LogRecorder\LogRecorder' => \Facade\Ignition\LogRecorder\LogRecorder::class,
|
||||
'Facade\Ignition\QueryRecorder\QueryRecorder' => \Facade\Ignition\QueryRecorder\QueryRecorder::class,
|
||||
'Facade\Ignition\Support\SentReports' => \Facade\Ignition\Support\SentReports::class,
|
||||
'Illuminate\Auth\Middleware\RequirePassword' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'Illuminate\Broadcasting\BroadcastManager' => \Illuminate\Broadcasting\BroadcastManager::class,
|
||||
'Illuminate\Bus\BatchRepository' => \Illuminate\Bus\DatabaseBatchRepository::class,
|
||||
|
|
@ -29,6 +31,7 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Bus\Dispatcher' => \Illuminate\Bus\Dispatcher::class,
|
||||
'Illuminate\Cache\RateLimiter' => \Illuminate\Cache\RateLimiter::class,
|
||||
'Illuminate\Console\Scheduling\Schedule' => \Illuminate\Console\Scheduling\Schedule::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleClearCacheCommand' => \Illuminate\Console\Scheduling\ScheduleClearCacheCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleFinishCommand' => \Illuminate\Console\Scheduling\ScheduleFinishCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleListCommand' => \Illuminate\Console\Scheduling\ScheduleListCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleRunCommand' => \Illuminate\Console\Scheduling\ScheduleRunCommand::class,
|
||||
|
|
@ -42,6 +45,7 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Contracts\Pipeline\Hub' => \Illuminate\Pipeline\Hub::class,
|
||||
'Illuminate\Contracts\Queue\EntityResolver' => \Illuminate\Database\Eloquent\QueueEntityResolver::class,
|
||||
'Illuminate\Contracts\Routing\ResponseFactory' => \Illuminate\Routing\ResponseFactory::class,
|
||||
'Illuminate\Contracts\Validation\UncompromisedVerifier' => \Illuminate\Validation\NotPwnedVerifier::class,
|
||||
'Illuminate\Database\Console\DbCommand' => \Illuminate\Database\Console\DbCommand::class,
|
||||
'Illuminate\Foundation\Mix' => \Illuminate\Foundation\Mix::class,
|
||||
'Illuminate\Foundation\PackageManifest' => \Illuminate\Foundation\PackageManifest::class,
|
||||
|
|
@ -49,9 +53,17 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Notifications\ChannelManager' => \Illuminate\Notifications\ChannelManager::class,
|
||||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class,
|
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class,
|
||||
'Illuminate\Testing\ParallelTesting' => \Illuminate\Testing\ParallelTesting::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,
|
||||
'Maatwebsite\Excel\Files\Filesystem' => \Maatwebsite\Excel\Files\Filesystem::class,
|
||||
'Maatwebsite\Excel\Files\TemporaryFileFactory' => \Maatwebsite\Excel\Files\TemporaryFileFactory::class,
|
||||
'Maatwebsite\Excel\Transactions\TransactionHandler' => \Maatwebsite\Excel\Transactions\DbTransactionHandler::class,
|
||||
'Maatwebsite\Excel\Transactions\TransactionManager' => \Maatwebsite\Excel\Transactions\TransactionManager::class,
|
||||
'NunoMaduro\Collision\Contracts\Provider' => \NunoMaduro\Collision\Provider::class,
|
||||
'Psr\Http\Message\ResponseInterface' => \Nyholm\Psr7\Response::class,
|
||||
'Psr\Http\Message\ServerRequestInterface' => \Nyholm\Psr7\ServerRequest::class,
|
||||
|
|
@ -64,7 +76,6 @@ namespace PHPSTORM_META {
|
|||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class,
|
||||
'cache' => \Illuminate\Cache\CacheManager::class,
|
||||
'cache.store' => \Illuminate\Cache\Repository::class,
|
||||
'cart' => \Gloudemans\Shoppingcart\Cart::class,
|
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class,
|
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class,
|
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class,
|
||||
|
|
@ -77,6 +88,7 @@ namespace PHPSTORM_META {
|
|||
'command.config.clear' => \Illuminate\Foundation\Console\ConfigClearCommand::class,
|
||||
'command.console.make' => \Illuminate\Foundation\Console\ConsoleMakeCommand::class,
|
||||
'command.controller.make' => \Illuminate\Routing\Console\ControllerMakeCommand::class,
|
||||
'command.db.prune' => \Illuminate\Database\Console\PruneCommand::class,
|
||||
'command.db.wipe' => \Illuminate\Database\Console\WipeCommand::class,
|
||||
'command.debugbar.clear' => \Barryvdh\Debugbar\Console\ClearCommand::class,
|
||||
'command.down' => \Illuminate\Foundation\Console\DownCommand::class,
|
||||
|
|
@ -124,7 +136,9 @@ namespace PHPSTORM_META {
|
|||
'command.queue.flush' => \Illuminate\Queue\Console\FlushFailedCommand::class,
|
||||
'command.queue.forget' => \Illuminate\Queue\Console\ForgetFailedCommand::class,
|
||||
'command.queue.listen' => \Illuminate\Queue\Console\ListenCommand::class,
|
||||
'command.queue.monitor' => \Illuminate\Queue\Console\MonitorCommand::class,
|
||||
'command.queue.prune-batches' => \Illuminate\Queue\Console\PruneBatchesCommand::class,
|
||||
'command.queue.prune-failed-jobs' => \Illuminate\Queue\Console\PruneFailedJobsCommand::class,
|
||||
'command.queue.restart' => \Illuminate\Queue\Console\RestartCommand::class,
|
||||
'command.queue.retry' => \Illuminate\Queue\Console\RetryCommand::class,
|
||||
'command.queue.retry-batch' => \Illuminate\Queue\Console\RetryBatchCommand::class,
|
||||
|
|
@ -162,6 +176,7 @@ namespace PHPSTORM_META {
|
|||
'dompdf.wrapper' => \Barryvdh\DomPDF\PDF::class,
|
||||
'encrypter' => \Illuminate\Encryption\Encrypter::class,
|
||||
'events' => \Illuminate\Events\Dispatcher::class,
|
||||
'excel' => \Maatwebsite\Excel\Excel::class,
|
||||
'files' => \Illuminate\Filesystem\Filesystem::class,
|
||||
'filesystem' => \Illuminate\Filesystem\FilesystemManager::class,
|
||||
'filesystem.disk' => \Illuminate\Filesystem\FilesystemAdapter::class,
|
||||
|
|
@ -180,6 +195,7 @@ namespace PHPSTORM_META {
|
|||
'migration.creator' => \Illuminate\Database\Migrations\MigrationCreator::class,
|
||||
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class,
|
||||
'migrator' => \Illuminate\Database\Migrations\Migrator::class,
|
||||
'paypal_client' => \Srmklive\PayPal\Services\PayPal::class,
|
||||
'profanityFilter' => \Askedio\Laravel5ProfanityFilter\ProfanityFilter::class,
|
||||
'queue' => \Illuminate\Queue\QueueManager::class,
|
||||
'queue.connection' => \Illuminate\Queue\SyncQueue::class,
|
||||
|
|
@ -210,8 +226,10 @@ namespace PHPSTORM_META {
|
|||
'Facade\Ignition\DumpRecorder\MultiDumpHandler' => \Facade\Ignition\DumpRecorder\MultiDumpHandler::class,
|
||||
'Facade\Ignition\ErrorPage\Renderer' => \Facade\Ignition\ErrorPage\Renderer::class,
|
||||
'Facade\Ignition\IgnitionConfig' => \Facade\Ignition\IgnitionConfig::class,
|
||||
'Facade\Ignition\JobRecorder\JobRecorder' => \Facade\Ignition\JobRecorder\JobRecorder::class,
|
||||
'Facade\Ignition\LogRecorder\LogRecorder' => \Facade\Ignition\LogRecorder\LogRecorder::class,
|
||||
'Facade\Ignition\QueryRecorder\QueryRecorder' => \Facade\Ignition\QueryRecorder\QueryRecorder::class,
|
||||
'Facade\Ignition\Support\SentReports' => \Facade\Ignition\Support\SentReports::class,
|
||||
'Illuminate\Auth\Middleware\RequirePassword' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'Illuminate\Broadcasting\BroadcastManager' => \Illuminate\Broadcasting\BroadcastManager::class,
|
||||
'Illuminate\Bus\BatchRepository' => \Illuminate\Bus\DatabaseBatchRepository::class,
|
||||
|
|
@ -219,6 +237,7 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Bus\Dispatcher' => \Illuminate\Bus\Dispatcher::class,
|
||||
'Illuminate\Cache\RateLimiter' => \Illuminate\Cache\RateLimiter::class,
|
||||
'Illuminate\Console\Scheduling\Schedule' => \Illuminate\Console\Scheduling\Schedule::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleClearCacheCommand' => \Illuminate\Console\Scheduling\ScheduleClearCacheCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleFinishCommand' => \Illuminate\Console\Scheduling\ScheduleFinishCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleListCommand' => \Illuminate\Console\Scheduling\ScheduleListCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleRunCommand' => \Illuminate\Console\Scheduling\ScheduleRunCommand::class,
|
||||
|
|
@ -232,6 +251,7 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Contracts\Pipeline\Hub' => \Illuminate\Pipeline\Hub::class,
|
||||
'Illuminate\Contracts\Queue\EntityResolver' => \Illuminate\Database\Eloquent\QueueEntityResolver::class,
|
||||
'Illuminate\Contracts\Routing\ResponseFactory' => \Illuminate\Routing\ResponseFactory::class,
|
||||
'Illuminate\Contracts\Validation\UncompromisedVerifier' => \Illuminate\Validation\NotPwnedVerifier::class,
|
||||
'Illuminate\Database\Console\DbCommand' => \Illuminate\Database\Console\DbCommand::class,
|
||||
'Illuminate\Foundation\Mix' => \Illuminate\Foundation\Mix::class,
|
||||
'Illuminate\Foundation\PackageManifest' => \Illuminate\Foundation\PackageManifest::class,
|
||||
|
|
@ -239,9 +259,17 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Notifications\ChannelManager' => \Illuminate\Notifications\ChannelManager::class,
|
||||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class,
|
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class,
|
||||
'Illuminate\Testing\ParallelTesting' => \Illuminate\Testing\ParallelTesting::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,
|
||||
'Maatwebsite\Excel\Files\Filesystem' => \Maatwebsite\Excel\Files\Filesystem::class,
|
||||
'Maatwebsite\Excel\Files\TemporaryFileFactory' => \Maatwebsite\Excel\Files\TemporaryFileFactory::class,
|
||||
'Maatwebsite\Excel\Transactions\TransactionHandler' => \Maatwebsite\Excel\Transactions\DbTransactionHandler::class,
|
||||
'Maatwebsite\Excel\Transactions\TransactionManager' => \Maatwebsite\Excel\Transactions\TransactionManager::class,
|
||||
'NunoMaduro\Collision\Contracts\Provider' => \NunoMaduro\Collision\Provider::class,
|
||||
'Psr\Http\Message\ResponseInterface' => \Nyholm\Psr7\Response::class,
|
||||
'Psr\Http\Message\ServerRequestInterface' => \Nyholm\Psr7\ServerRequest::class,
|
||||
|
|
@ -254,7 +282,6 @@ namespace PHPSTORM_META {
|
|||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class,
|
||||
'cache' => \Illuminate\Cache\CacheManager::class,
|
||||
'cache.store' => \Illuminate\Cache\Repository::class,
|
||||
'cart' => \Gloudemans\Shoppingcart\Cart::class,
|
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class,
|
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class,
|
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class,
|
||||
|
|
@ -267,6 +294,7 @@ namespace PHPSTORM_META {
|
|||
'command.config.clear' => \Illuminate\Foundation\Console\ConfigClearCommand::class,
|
||||
'command.console.make' => \Illuminate\Foundation\Console\ConsoleMakeCommand::class,
|
||||
'command.controller.make' => \Illuminate\Routing\Console\ControllerMakeCommand::class,
|
||||
'command.db.prune' => \Illuminate\Database\Console\PruneCommand::class,
|
||||
'command.db.wipe' => \Illuminate\Database\Console\WipeCommand::class,
|
||||
'command.debugbar.clear' => \Barryvdh\Debugbar\Console\ClearCommand::class,
|
||||
'command.down' => \Illuminate\Foundation\Console\DownCommand::class,
|
||||
|
|
@ -314,7 +342,9 @@ namespace PHPSTORM_META {
|
|||
'command.queue.flush' => \Illuminate\Queue\Console\FlushFailedCommand::class,
|
||||
'command.queue.forget' => \Illuminate\Queue\Console\ForgetFailedCommand::class,
|
||||
'command.queue.listen' => \Illuminate\Queue\Console\ListenCommand::class,
|
||||
'command.queue.monitor' => \Illuminate\Queue\Console\MonitorCommand::class,
|
||||
'command.queue.prune-batches' => \Illuminate\Queue\Console\PruneBatchesCommand::class,
|
||||
'command.queue.prune-failed-jobs' => \Illuminate\Queue\Console\PruneFailedJobsCommand::class,
|
||||
'command.queue.restart' => \Illuminate\Queue\Console\RestartCommand::class,
|
||||
'command.queue.retry' => \Illuminate\Queue\Console\RetryCommand::class,
|
||||
'command.queue.retry-batch' => \Illuminate\Queue\Console\RetryBatchCommand::class,
|
||||
|
|
@ -352,6 +382,7 @@ namespace PHPSTORM_META {
|
|||
'dompdf.wrapper' => \Barryvdh\DomPDF\PDF::class,
|
||||
'encrypter' => \Illuminate\Encryption\Encrypter::class,
|
||||
'events' => \Illuminate\Events\Dispatcher::class,
|
||||
'excel' => \Maatwebsite\Excel\Excel::class,
|
||||
'files' => \Illuminate\Filesystem\Filesystem::class,
|
||||
'filesystem' => \Illuminate\Filesystem\FilesystemManager::class,
|
||||
'filesystem.disk' => \Illuminate\Filesystem\FilesystemAdapter::class,
|
||||
|
|
@ -370,6 +401,7 @@ namespace PHPSTORM_META {
|
|||
'migration.creator' => \Illuminate\Database\Migrations\MigrationCreator::class,
|
||||
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class,
|
||||
'migrator' => \Illuminate\Database\Migrations\Migrator::class,
|
||||
'paypal_client' => \Srmklive\PayPal\Services\PayPal::class,
|
||||
'profanityFilter' => \Askedio\Laravel5ProfanityFilter\ProfanityFilter::class,
|
||||
'queue' => \Illuminate\Queue\QueueManager::class,
|
||||
'queue.connection' => \Illuminate\Queue\SyncQueue::class,
|
||||
|
|
@ -400,8 +432,10 @@ namespace PHPSTORM_META {
|
|||
'Facade\Ignition\DumpRecorder\MultiDumpHandler' => \Facade\Ignition\DumpRecorder\MultiDumpHandler::class,
|
||||
'Facade\Ignition\ErrorPage\Renderer' => \Facade\Ignition\ErrorPage\Renderer::class,
|
||||
'Facade\Ignition\IgnitionConfig' => \Facade\Ignition\IgnitionConfig::class,
|
||||
'Facade\Ignition\JobRecorder\JobRecorder' => \Facade\Ignition\JobRecorder\JobRecorder::class,
|
||||
'Facade\Ignition\LogRecorder\LogRecorder' => \Facade\Ignition\LogRecorder\LogRecorder::class,
|
||||
'Facade\Ignition\QueryRecorder\QueryRecorder' => \Facade\Ignition\QueryRecorder\QueryRecorder::class,
|
||||
'Facade\Ignition\Support\SentReports' => \Facade\Ignition\Support\SentReports::class,
|
||||
'Illuminate\Auth\Middleware\RequirePassword' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'Illuminate\Broadcasting\BroadcastManager' => \Illuminate\Broadcasting\BroadcastManager::class,
|
||||
'Illuminate\Bus\BatchRepository' => \Illuminate\Bus\DatabaseBatchRepository::class,
|
||||
|
|
@ -409,6 +443,7 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Bus\Dispatcher' => \Illuminate\Bus\Dispatcher::class,
|
||||
'Illuminate\Cache\RateLimiter' => \Illuminate\Cache\RateLimiter::class,
|
||||
'Illuminate\Console\Scheduling\Schedule' => \Illuminate\Console\Scheduling\Schedule::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleClearCacheCommand' => \Illuminate\Console\Scheduling\ScheduleClearCacheCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleFinishCommand' => \Illuminate\Console\Scheduling\ScheduleFinishCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleListCommand' => \Illuminate\Console\Scheduling\ScheduleListCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleRunCommand' => \Illuminate\Console\Scheduling\ScheduleRunCommand::class,
|
||||
|
|
@ -422,6 +457,7 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Contracts\Pipeline\Hub' => \Illuminate\Pipeline\Hub::class,
|
||||
'Illuminate\Contracts\Queue\EntityResolver' => \Illuminate\Database\Eloquent\QueueEntityResolver::class,
|
||||
'Illuminate\Contracts\Routing\ResponseFactory' => \Illuminate\Routing\ResponseFactory::class,
|
||||
'Illuminate\Contracts\Validation\UncompromisedVerifier' => \Illuminate\Validation\NotPwnedVerifier::class,
|
||||
'Illuminate\Database\Console\DbCommand' => \Illuminate\Database\Console\DbCommand::class,
|
||||
'Illuminate\Foundation\Mix' => \Illuminate\Foundation\Mix::class,
|
||||
'Illuminate\Foundation\PackageManifest' => \Illuminate\Foundation\PackageManifest::class,
|
||||
|
|
@ -429,9 +465,17 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Notifications\ChannelManager' => \Illuminate\Notifications\ChannelManager::class,
|
||||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class,
|
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class,
|
||||
'Illuminate\Testing\ParallelTesting' => \Illuminate\Testing\ParallelTesting::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,
|
||||
'Maatwebsite\Excel\Files\Filesystem' => \Maatwebsite\Excel\Files\Filesystem::class,
|
||||
'Maatwebsite\Excel\Files\TemporaryFileFactory' => \Maatwebsite\Excel\Files\TemporaryFileFactory::class,
|
||||
'Maatwebsite\Excel\Transactions\TransactionHandler' => \Maatwebsite\Excel\Transactions\DbTransactionHandler::class,
|
||||
'Maatwebsite\Excel\Transactions\TransactionManager' => \Maatwebsite\Excel\Transactions\TransactionManager::class,
|
||||
'NunoMaduro\Collision\Contracts\Provider' => \NunoMaduro\Collision\Provider::class,
|
||||
'Psr\Http\Message\ResponseInterface' => \Nyholm\Psr7\Response::class,
|
||||
'Psr\Http\Message\ServerRequestInterface' => \Nyholm\Psr7\ServerRequest::class,
|
||||
|
|
@ -444,7 +488,6 @@ namespace PHPSTORM_META {
|
|||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class,
|
||||
'cache' => \Illuminate\Cache\CacheManager::class,
|
||||
'cache.store' => \Illuminate\Cache\Repository::class,
|
||||
'cart' => \Gloudemans\Shoppingcart\Cart::class,
|
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class,
|
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class,
|
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class,
|
||||
|
|
@ -457,6 +500,7 @@ namespace PHPSTORM_META {
|
|||
'command.config.clear' => \Illuminate\Foundation\Console\ConfigClearCommand::class,
|
||||
'command.console.make' => \Illuminate\Foundation\Console\ConsoleMakeCommand::class,
|
||||
'command.controller.make' => \Illuminate\Routing\Console\ControllerMakeCommand::class,
|
||||
'command.db.prune' => \Illuminate\Database\Console\PruneCommand::class,
|
||||
'command.db.wipe' => \Illuminate\Database\Console\WipeCommand::class,
|
||||
'command.debugbar.clear' => \Barryvdh\Debugbar\Console\ClearCommand::class,
|
||||
'command.down' => \Illuminate\Foundation\Console\DownCommand::class,
|
||||
|
|
@ -504,7 +548,9 @@ namespace PHPSTORM_META {
|
|||
'command.queue.flush' => \Illuminate\Queue\Console\FlushFailedCommand::class,
|
||||
'command.queue.forget' => \Illuminate\Queue\Console\ForgetFailedCommand::class,
|
||||
'command.queue.listen' => \Illuminate\Queue\Console\ListenCommand::class,
|
||||
'command.queue.monitor' => \Illuminate\Queue\Console\MonitorCommand::class,
|
||||
'command.queue.prune-batches' => \Illuminate\Queue\Console\PruneBatchesCommand::class,
|
||||
'command.queue.prune-failed-jobs' => \Illuminate\Queue\Console\PruneFailedJobsCommand::class,
|
||||
'command.queue.restart' => \Illuminate\Queue\Console\RestartCommand::class,
|
||||
'command.queue.retry' => \Illuminate\Queue\Console\RetryCommand::class,
|
||||
'command.queue.retry-batch' => \Illuminate\Queue\Console\RetryBatchCommand::class,
|
||||
|
|
@ -542,6 +588,7 @@ namespace PHPSTORM_META {
|
|||
'dompdf.wrapper' => \Barryvdh\DomPDF\PDF::class,
|
||||
'encrypter' => \Illuminate\Encryption\Encrypter::class,
|
||||
'events' => \Illuminate\Events\Dispatcher::class,
|
||||
'excel' => \Maatwebsite\Excel\Excel::class,
|
||||
'files' => \Illuminate\Filesystem\Filesystem::class,
|
||||
'filesystem' => \Illuminate\Filesystem\FilesystemManager::class,
|
||||
'filesystem.disk' => \Illuminate\Filesystem\FilesystemAdapter::class,
|
||||
|
|
@ -560,6 +607,7 @@ namespace PHPSTORM_META {
|
|||
'migration.creator' => \Illuminate\Database\Migrations\MigrationCreator::class,
|
||||
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class,
|
||||
'migrator' => \Illuminate\Database\Migrations\Migrator::class,
|
||||
'paypal_client' => \Srmklive\PayPal\Services\PayPal::class,
|
||||
'profanityFilter' => \Askedio\Laravel5ProfanityFilter\ProfanityFilter::class,
|
||||
'queue' => \Illuminate\Queue\QueueManager::class,
|
||||
'queue.connection' => \Illuminate\Queue\SyncQueue::class,
|
||||
|
|
@ -590,8 +638,10 @@ namespace PHPSTORM_META {
|
|||
'Facade\Ignition\DumpRecorder\MultiDumpHandler' => \Facade\Ignition\DumpRecorder\MultiDumpHandler::class,
|
||||
'Facade\Ignition\ErrorPage\Renderer' => \Facade\Ignition\ErrorPage\Renderer::class,
|
||||
'Facade\Ignition\IgnitionConfig' => \Facade\Ignition\IgnitionConfig::class,
|
||||
'Facade\Ignition\JobRecorder\JobRecorder' => \Facade\Ignition\JobRecorder\JobRecorder::class,
|
||||
'Facade\Ignition\LogRecorder\LogRecorder' => \Facade\Ignition\LogRecorder\LogRecorder::class,
|
||||
'Facade\Ignition\QueryRecorder\QueryRecorder' => \Facade\Ignition\QueryRecorder\QueryRecorder::class,
|
||||
'Facade\Ignition\Support\SentReports' => \Facade\Ignition\Support\SentReports::class,
|
||||
'Illuminate\Auth\Middleware\RequirePassword' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'Illuminate\Broadcasting\BroadcastManager' => \Illuminate\Broadcasting\BroadcastManager::class,
|
||||
'Illuminate\Bus\BatchRepository' => \Illuminate\Bus\DatabaseBatchRepository::class,
|
||||
|
|
@ -599,6 +649,7 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Bus\Dispatcher' => \Illuminate\Bus\Dispatcher::class,
|
||||
'Illuminate\Cache\RateLimiter' => \Illuminate\Cache\RateLimiter::class,
|
||||
'Illuminate\Console\Scheduling\Schedule' => \Illuminate\Console\Scheduling\Schedule::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleClearCacheCommand' => \Illuminate\Console\Scheduling\ScheduleClearCacheCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleFinishCommand' => \Illuminate\Console\Scheduling\ScheduleFinishCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleListCommand' => \Illuminate\Console\Scheduling\ScheduleListCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleRunCommand' => \Illuminate\Console\Scheduling\ScheduleRunCommand::class,
|
||||
|
|
@ -612,6 +663,7 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Contracts\Pipeline\Hub' => \Illuminate\Pipeline\Hub::class,
|
||||
'Illuminate\Contracts\Queue\EntityResolver' => \Illuminate\Database\Eloquent\QueueEntityResolver::class,
|
||||
'Illuminate\Contracts\Routing\ResponseFactory' => \Illuminate\Routing\ResponseFactory::class,
|
||||
'Illuminate\Contracts\Validation\UncompromisedVerifier' => \Illuminate\Validation\NotPwnedVerifier::class,
|
||||
'Illuminate\Database\Console\DbCommand' => \Illuminate\Database\Console\DbCommand::class,
|
||||
'Illuminate\Foundation\Mix' => \Illuminate\Foundation\Mix::class,
|
||||
'Illuminate\Foundation\PackageManifest' => \Illuminate\Foundation\PackageManifest::class,
|
||||
|
|
@ -619,9 +671,17 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Notifications\ChannelManager' => \Illuminate\Notifications\ChannelManager::class,
|
||||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class,
|
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class,
|
||||
'Illuminate\Testing\ParallelTesting' => \Illuminate\Testing\ParallelTesting::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,
|
||||
'Maatwebsite\Excel\Files\Filesystem' => \Maatwebsite\Excel\Files\Filesystem::class,
|
||||
'Maatwebsite\Excel\Files\TemporaryFileFactory' => \Maatwebsite\Excel\Files\TemporaryFileFactory::class,
|
||||
'Maatwebsite\Excel\Transactions\TransactionHandler' => \Maatwebsite\Excel\Transactions\DbTransactionHandler::class,
|
||||
'Maatwebsite\Excel\Transactions\TransactionManager' => \Maatwebsite\Excel\Transactions\TransactionManager::class,
|
||||
'NunoMaduro\Collision\Contracts\Provider' => \NunoMaduro\Collision\Provider::class,
|
||||
'Psr\Http\Message\ResponseInterface' => \Nyholm\Psr7\Response::class,
|
||||
'Psr\Http\Message\ServerRequestInterface' => \Nyholm\Psr7\ServerRequest::class,
|
||||
|
|
@ -634,7 +694,6 @@ namespace PHPSTORM_META {
|
|||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class,
|
||||
'cache' => \Illuminate\Cache\CacheManager::class,
|
||||
'cache.store' => \Illuminate\Cache\Repository::class,
|
||||
'cart' => \Gloudemans\Shoppingcart\Cart::class,
|
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class,
|
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class,
|
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class,
|
||||
|
|
@ -647,6 +706,7 @@ namespace PHPSTORM_META {
|
|||
'command.config.clear' => \Illuminate\Foundation\Console\ConfigClearCommand::class,
|
||||
'command.console.make' => \Illuminate\Foundation\Console\ConsoleMakeCommand::class,
|
||||
'command.controller.make' => \Illuminate\Routing\Console\ControllerMakeCommand::class,
|
||||
'command.db.prune' => \Illuminate\Database\Console\PruneCommand::class,
|
||||
'command.db.wipe' => \Illuminate\Database\Console\WipeCommand::class,
|
||||
'command.debugbar.clear' => \Barryvdh\Debugbar\Console\ClearCommand::class,
|
||||
'command.down' => \Illuminate\Foundation\Console\DownCommand::class,
|
||||
|
|
@ -694,7 +754,9 @@ namespace PHPSTORM_META {
|
|||
'command.queue.flush' => \Illuminate\Queue\Console\FlushFailedCommand::class,
|
||||
'command.queue.forget' => \Illuminate\Queue\Console\ForgetFailedCommand::class,
|
||||
'command.queue.listen' => \Illuminate\Queue\Console\ListenCommand::class,
|
||||
'command.queue.monitor' => \Illuminate\Queue\Console\MonitorCommand::class,
|
||||
'command.queue.prune-batches' => \Illuminate\Queue\Console\PruneBatchesCommand::class,
|
||||
'command.queue.prune-failed-jobs' => \Illuminate\Queue\Console\PruneFailedJobsCommand::class,
|
||||
'command.queue.restart' => \Illuminate\Queue\Console\RestartCommand::class,
|
||||
'command.queue.retry' => \Illuminate\Queue\Console\RetryCommand::class,
|
||||
'command.queue.retry-batch' => \Illuminate\Queue\Console\RetryBatchCommand::class,
|
||||
|
|
@ -732,6 +794,7 @@ namespace PHPSTORM_META {
|
|||
'dompdf.wrapper' => \Barryvdh\DomPDF\PDF::class,
|
||||
'encrypter' => \Illuminate\Encryption\Encrypter::class,
|
||||
'events' => \Illuminate\Events\Dispatcher::class,
|
||||
'excel' => \Maatwebsite\Excel\Excel::class,
|
||||
'files' => \Illuminate\Filesystem\Filesystem::class,
|
||||
'filesystem' => \Illuminate\Filesystem\FilesystemManager::class,
|
||||
'filesystem.disk' => \Illuminate\Filesystem\FilesystemAdapter::class,
|
||||
|
|
@ -750,6 +813,7 @@ namespace PHPSTORM_META {
|
|||
'migration.creator' => \Illuminate\Database\Migrations\MigrationCreator::class,
|
||||
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class,
|
||||
'migrator' => \Illuminate\Database\Migrations\Migrator::class,
|
||||
'paypal_client' => \Srmklive\PayPal\Services\PayPal::class,
|
||||
'profanityFilter' => \Askedio\Laravel5ProfanityFilter\ProfanityFilter::class,
|
||||
'queue' => \Illuminate\Queue\QueueManager::class,
|
||||
'queue.connection' => \Illuminate\Queue\SyncQueue::class,
|
||||
|
|
@ -780,8 +844,10 @@ namespace PHPSTORM_META {
|
|||
'Facade\Ignition\DumpRecorder\MultiDumpHandler' => \Facade\Ignition\DumpRecorder\MultiDumpHandler::class,
|
||||
'Facade\Ignition\ErrorPage\Renderer' => \Facade\Ignition\ErrorPage\Renderer::class,
|
||||
'Facade\Ignition\IgnitionConfig' => \Facade\Ignition\IgnitionConfig::class,
|
||||
'Facade\Ignition\JobRecorder\JobRecorder' => \Facade\Ignition\JobRecorder\JobRecorder::class,
|
||||
'Facade\Ignition\LogRecorder\LogRecorder' => \Facade\Ignition\LogRecorder\LogRecorder::class,
|
||||
'Facade\Ignition\QueryRecorder\QueryRecorder' => \Facade\Ignition\QueryRecorder\QueryRecorder::class,
|
||||
'Facade\Ignition\Support\SentReports' => \Facade\Ignition\Support\SentReports::class,
|
||||
'Illuminate\Auth\Middleware\RequirePassword' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'Illuminate\Broadcasting\BroadcastManager' => \Illuminate\Broadcasting\BroadcastManager::class,
|
||||
'Illuminate\Bus\BatchRepository' => \Illuminate\Bus\DatabaseBatchRepository::class,
|
||||
|
|
@ -789,6 +855,7 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Bus\Dispatcher' => \Illuminate\Bus\Dispatcher::class,
|
||||
'Illuminate\Cache\RateLimiter' => \Illuminate\Cache\RateLimiter::class,
|
||||
'Illuminate\Console\Scheduling\Schedule' => \Illuminate\Console\Scheduling\Schedule::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleClearCacheCommand' => \Illuminate\Console\Scheduling\ScheduleClearCacheCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleFinishCommand' => \Illuminate\Console\Scheduling\ScheduleFinishCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleListCommand' => \Illuminate\Console\Scheduling\ScheduleListCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleRunCommand' => \Illuminate\Console\Scheduling\ScheduleRunCommand::class,
|
||||
|
|
@ -802,6 +869,7 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Contracts\Pipeline\Hub' => \Illuminate\Pipeline\Hub::class,
|
||||
'Illuminate\Contracts\Queue\EntityResolver' => \Illuminate\Database\Eloquent\QueueEntityResolver::class,
|
||||
'Illuminate\Contracts\Routing\ResponseFactory' => \Illuminate\Routing\ResponseFactory::class,
|
||||
'Illuminate\Contracts\Validation\UncompromisedVerifier' => \Illuminate\Validation\NotPwnedVerifier::class,
|
||||
'Illuminate\Database\Console\DbCommand' => \Illuminate\Database\Console\DbCommand::class,
|
||||
'Illuminate\Foundation\Mix' => \Illuminate\Foundation\Mix::class,
|
||||
'Illuminate\Foundation\PackageManifest' => \Illuminate\Foundation\PackageManifest::class,
|
||||
|
|
@ -809,9 +877,17 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Notifications\ChannelManager' => \Illuminate\Notifications\ChannelManager::class,
|
||||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class,
|
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class,
|
||||
'Illuminate\Testing\ParallelTesting' => \Illuminate\Testing\ParallelTesting::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,
|
||||
'Maatwebsite\Excel\Files\Filesystem' => \Maatwebsite\Excel\Files\Filesystem::class,
|
||||
'Maatwebsite\Excel\Files\TemporaryFileFactory' => \Maatwebsite\Excel\Files\TemporaryFileFactory::class,
|
||||
'Maatwebsite\Excel\Transactions\TransactionHandler' => \Maatwebsite\Excel\Transactions\DbTransactionHandler::class,
|
||||
'Maatwebsite\Excel\Transactions\TransactionManager' => \Maatwebsite\Excel\Transactions\TransactionManager::class,
|
||||
'NunoMaduro\Collision\Contracts\Provider' => \NunoMaduro\Collision\Provider::class,
|
||||
'Psr\Http\Message\ResponseInterface' => \Nyholm\Psr7\Response::class,
|
||||
'Psr\Http\Message\ServerRequestInterface' => \Nyholm\Psr7\ServerRequest::class,
|
||||
|
|
@ -824,7 +900,6 @@ namespace PHPSTORM_META {
|
|||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class,
|
||||
'cache' => \Illuminate\Cache\CacheManager::class,
|
||||
'cache.store' => \Illuminate\Cache\Repository::class,
|
||||
'cart' => \Gloudemans\Shoppingcart\Cart::class,
|
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class,
|
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class,
|
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class,
|
||||
|
|
@ -837,6 +912,7 @@ namespace PHPSTORM_META {
|
|||
'command.config.clear' => \Illuminate\Foundation\Console\ConfigClearCommand::class,
|
||||
'command.console.make' => \Illuminate\Foundation\Console\ConsoleMakeCommand::class,
|
||||
'command.controller.make' => \Illuminate\Routing\Console\ControllerMakeCommand::class,
|
||||
'command.db.prune' => \Illuminate\Database\Console\PruneCommand::class,
|
||||
'command.db.wipe' => \Illuminate\Database\Console\WipeCommand::class,
|
||||
'command.debugbar.clear' => \Barryvdh\Debugbar\Console\ClearCommand::class,
|
||||
'command.down' => \Illuminate\Foundation\Console\DownCommand::class,
|
||||
|
|
@ -884,7 +960,9 @@ namespace PHPSTORM_META {
|
|||
'command.queue.flush' => \Illuminate\Queue\Console\FlushFailedCommand::class,
|
||||
'command.queue.forget' => \Illuminate\Queue\Console\ForgetFailedCommand::class,
|
||||
'command.queue.listen' => \Illuminate\Queue\Console\ListenCommand::class,
|
||||
'command.queue.monitor' => \Illuminate\Queue\Console\MonitorCommand::class,
|
||||
'command.queue.prune-batches' => \Illuminate\Queue\Console\PruneBatchesCommand::class,
|
||||
'command.queue.prune-failed-jobs' => \Illuminate\Queue\Console\PruneFailedJobsCommand::class,
|
||||
'command.queue.restart' => \Illuminate\Queue\Console\RestartCommand::class,
|
||||
'command.queue.retry' => \Illuminate\Queue\Console\RetryCommand::class,
|
||||
'command.queue.retry-batch' => \Illuminate\Queue\Console\RetryBatchCommand::class,
|
||||
|
|
@ -922,6 +1000,7 @@ namespace PHPSTORM_META {
|
|||
'dompdf.wrapper' => \Barryvdh\DomPDF\PDF::class,
|
||||
'encrypter' => \Illuminate\Encryption\Encrypter::class,
|
||||
'events' => \Illuminate\Events\Dispatcher::class,
|
||||
'excel' => \Maatwebsite\Excel\Excel::class,
|
||||
'files' => \Illuminate\Filesystem\Filesystem::class,
|
||||
'filesystem' => \Illuminate\Filesystem\FilesystemManager::class,
|
||||
'filesystem.disk' => \Illuminate\Filesystem\FilesystemAdapter::class,
|
||||
|
|
@ -940,6 +1019,7 @@ namespace PHPSTORM_META {
|
|||
'migration.creator' => \Illuminate\Database\Migrations\MigrationCreator::class,
|
||||
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class,
|
||||
'migrator' => \Illuminate\Database\Migrations\Migrator::class,
|
||||
'paypal_client' => \Srmklive\PayPal\Services\PayPal::class,
|
||||
'profanityFilter' => \Askedio\Laravel5ProfanityFilter\ProfanityFilter::class,
|
||||
'queue' => \Illuminate\Queue\QueueManager::class,
|
||||
'queue.connection' => \Illuminate\Queue\SyncQueue::class,
|
||||
|
|
@ -970,8 +1050,10 @@ namespace PHPSTORM_META {
|
|||
'Facade\Ignition\DumpRecorder\MultiDumpHandler' => \Facade\Ignition\DumpRecorder\MultiDumpHandler::class,
|
||||
'Facade\Ignition\ErrorPage\Renderer' => \Facade\Ignition\ErrorPage\Renderer::class,
|
||||
'Facade\Ignition\IgnitionConfig' => \Facade\Ignition\IgnitionConfig::class,
|
||||
'Facade\Ignition\JobRecorder\JobRecorder' => \Facade\Ignition\JobRecorder\JobRecorder::class,
|
||||
'Facade\Ignition\LogRecorder\LogRecorder' => \Facade\Ignition\LogRecorder\LogRecorder::class,
|
||||
'Facade\Ignition\QueryRecorder\QueryRecorder' => \Facade\Ignition\QueryRecorder\QueryRecorder::class,
|
||||
'Facade\Ignition\Support\SentReports' => \Facade\Ignition\Support\SentReports::class,
|
||||
'Illuminate\Auth\Middleware\RequirePassword' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'Illuminate\Broadcasting\BroadcastManager' => \Illuminate\Broadcasting\BroadcastManager::class,
|
||||
'Illuminate\Bus\BatchRepository' => \Illuminate\Bus\DatabaseBatchRepository::class,
|
||||
|
|
@ -979,6 +1061,7 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Bus\Dispatcher' => \Illuminate\Bus\Dispatcher::class,
|
||||
'Illuminate\Cache\RateLimiter' => \Illuminate\Cache\RateLimiter::class,
|
||||
'Illuminate\Console\Scheduling\Schedule' => \Illuminate\Console\Scheduling\Schedule::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleClearCacheCommand' => \Illuminate\Console\Scheduling\ScheduleClearCacheCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleFinishCommand' => \Illuminate\Console\Scheduling\ScheduleFinishCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleListCommand' => \Illuminate\Console\Scheduling\ScheduleListCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleRunCommand' => \Illuminate\Console\Scheduling\ScheduleRunCommand::class,
|
||||
|
|
@ -992,6 +1075,7 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Contracts\Pipeline\Hub' => \Illuminate\Pipeline\Hub::class,
|
||||
'Illuminate\Contracts\Queue\EntityResolver' => \Illuminate\Database\Eloquent\QueueEntityResolver::class,
|
||||
'Illuminate\Contracts\Routing\ResponseFactory' => \Illuminate\Routing\ResponseFactory::class,
|
||||
'Illuminate\Contracts\Validation\UncompromisedVerifier' => \Illuminate\Validation\NotPwnedVerifier::class,
|
||||
'Illuminate\Database\Console\DbCommand' => \Illuminate\Database\Console\DbCommand::class,
|
||||
'Illuminate\Foundation\Mix' => \Illuminate\Foundation\Mix::class,
|
||||
'Illuminate\Foundation\PackageManifest' => \Illuminate\Foundation\PackageManifest::class,
|
||||
|
|
@ -999,9 +1083,17 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Notifications\ChannelManager' => \Illuminate\Notifications\ChannelManager::class,
|
||||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class,
|
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class,
|
||||
'Illuminate\Testing\ParallelTesting' => \Illuminate\Testing\ParallelTesting::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,
|
||||
'Maatwebsite\Excel\Files\Filesystem' => \Maatwebsite\Excel\Files\Filesystem::class,
|
||||
'Maatwebsite\Excel\Files\TemporaryFileFactory' => \Maatwebsite\Excel\Files\TemporaryFileFactory::class,
|
||||
'Maatwebsite\Excel\Transactions\TransactionHandler' => \Maatwebsite\Excel\Transactions\DbTransactionHandler::class,
|
||||
'Maatwebsite\Excel\Transactions\TransactionManager' => \Maatwebsite\Excel\Transactions\TransactionManager::class,
|
||||
'NunoMaduro\Collision\Contracts\Provider' => \NunoMaduro\Collision\Provider::class,
|
||||
'Psr\Http\Message\ResponseInterface' => \Nyholm\Psr7\Response::class,
|
||||
'Psr\Http\Message\ServerRequestInterface' => \Nyholm\Psr7\ServerRequest::class,
|
||||
|
|
@ -1014,7 +1106,6 @@ namespace PHPSTORM_META {
|
|||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class,
|
||||
'cache' => \Illuminate\Cache\CacheManager::class,
|
||||
'cache.store' => \Illuminate\Cache\Repository::class,
|
||||
'cart' => \Gloudemans\Shoppingcart\Cart::class,
|
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class,
|
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class,
|
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class,
|
||||
|
|
@ -1027,6 +1118,7 @@ namespace PHPSTORM_META {
|
|||
'command.config.clear' => \Illuminate\Foundation\Console\ConfigClearCommand::class,
|
||||
'command.console.make' => \Illuminate\Foundation\Console\ConsoleMakeCommand::class,
|
||||
'command.controller.make' => \Illuminate\Routing\Console\ControllerMakeCommand::class,
|
||||
'command.db.prune' => \Illuminate\Database\Console\PruneCommand::class,
|
||||
'command.db.wipe' => \Illuminate\Database\Console\WipeCommand::class,
|
||||
'command.debugbar.clear' => \Barryvdh\Debugbar\Console\ClearCommand::class,
|
||||
'command.down' => \Illuminate\Foundation\Console\DownCommand::class,
|
||||
|
|
@ -1074,7 +1166,9 @@ namespace PHPSTORM_META {
|
|||
'command.queue.flush' => \Illuminate\Queue\Console\FlushFailedCommand::class,
|
||||
'command.queue.forget' => \Illuminate\Queue\Console\ForgetFailedCommand::class,
|
||||
'command.queue.listen' => \Illuminate\Queue\Console\ListenCommand::class,
|
||||
'command.queue.monitor' => \Illuminate\Queue\Console\MonitorCommand::class,
|
||||
'command.queue.prune-batches' => \Illuminate\Queue\Console\PruneBatchesCommand::class,
|
||||
'command.queue.prune-failed-jobs' => \Illuminate\Queue\Console\PruneFailedJobsCommand::class,
|
||||
'command.queue.restart' => \Illuminate\Queue\Console\RestartCommand::class,
|
||||
'command.queue.retry' => \Illuminate\Queue\Console\RetryCommand::class,
|
||||
'command.queue.retry-batch' => \Illuminate\Queue\Console\RetryBatchCommand::class,
|
||||
|
|
@ -1112,6 +1206,7 @@ namespace PHPSTORM_META {
|
|||
'dompdf.wrapper' => \Barryvdh\DomPDF\PDF::class,
|
||||
'encrypter' => \Illuminate\Encryption\Encrypter::class,
|
||||
'events' => \Illuminate\Events\Dispatcher::class,
|
||||
'excel' => \Maatwebsite\Excel\Excel::class,
|
||||
'files' => \Illuminate\Filesystem\Filesystem::class,
|
||||
'filesystem' => \Illuminate\Filesystem\FilesystemManager::class,
|
||||
'filesystem.disk' => \Illuminate\Filesystem\FilesystemAdapter::class,
|
||||
|
|
@ -1130,6 +1225,7 @@ namespace PHPSTORM_META {
|
|||
'migration.creator' => \Illuminate\Database\Migrations\MigrationCreator::class,
|
||||
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class,
|
||||
'migrator' => \Illuminate\Database\Migrations\Migrator::class,
|
||||
'paypal_client' => \Srmklive\PayPal\Services\PayPal::class,
|
||||
'profanityFilter' => \Askedio\Laravel5ProfanityFilter\ProfanityFilter::class,
|
||||
'queue' => \Illuminate\Queue\QueueManager::class,
|
||||
'queue.connection' => \Illuminate\Queue\SyncQueue::class,
|
||||
|
|
@ -1160,8 +1256,10 @@ namespace PHPSTORM_META {
|
|||
'Facade\Ignition\DumpRecorder\MultiDumpHandler' => \Facade\Ignition\DumpRecorder\MultiDumpHandler::class,
|
||||
'Facade\Ignition\ErrorPage\Renderer' => \Facade\Ignition\ErrorPage\Renderer::class,
|
||||
'Facade\Ignition\IgnitionConfig' => \Facade\Ignition\IgnitionConfig::class,
|
||||
'Facade\Ignition\JobRecorder\JobRecorder' => \Facade\Ignition\JobRecorder\JobRecorder::class,
|
||||
'Facade\Ignition\LogRecorder\LogRecorder' => \Facade\Ignition\LogRecorder\LogRecorder::class,
|
||||
'Facade\Ignition\QueryRecorder\QueryRecorder' => \Facade\Ignition\QueryRecorder\QueryRecorder::class,
|
||||
'Facade\Ignition\Support\SentReports' => \Facade\Ignition\Support\SentReports::class,
|
||||
'Illuminate\Auth\Middleware\RequirePassword' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'Illuminate\Broadcasting\BroadcastManager' => \Illuminate\Broadcasting\BroadcastManager::class,
|
||||
'Illuminate\Bus\BatchRepository' => \Illuminate\Bus\DatabaseBatchRepository::class,
|
||||
|
|
@ -1169,6 +1267,7 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Bus\Dispatcher' => \Illuminate\Bus\Dispatcher::class,
|
||||
'Illuminate\Cache\RateLimiter' => \Illuminate\Cache\RateLimiter::class,
|
||||
'Illuminate\Console\Scheduling\Schedule' => \Illuminate\Console\Scheduling\Schedule::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleClearCacheCommand' => \Illuminate\Console\Scheduling\ScheduleClearCacheCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleFinishCommand' => \Illuminate\Console\Scheduling\ScheduleFinishCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleListCommand' => \Illuminate\Console\Scheduling\ScheduleListCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleRunCommand' => \Illuminate\Console\Scheduling\ScheduleRunCommand::class,
|
||||
|
|
@ -1182,6 +1281,7 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Contracts\Pipeline\Hub' => \Illuminate\Pipeline\Hub::class,
|
||||
'Illuminate\Contracts\Queue\EntityResolver' => \Illuminate\Database\Eloquent\QueueEntityResolver::class,
|
||||
'Illuminate\Contracts\Routing\ResponseFactory' => \Illuminate\Routing\ResponseFactory::class,
|
||||
'Illuminate\Contracts\Validation\UncompromisedVerifier' => \Illuminate\Validation\NotPwnedVerifier::class,
|
||||
'Illuminate\Database\Console\DbCommand' => \Illuminate\Database\Console\DbCommand::class,
|
||||
'Illuminate\Foundation\Mix' => \Illuminate\Foundation\Mix::class,
|
||||
'Illuminate\Foundation\PackageManifest' => \Illuminate\Foundation\PackageManifest::class,
|
||||
|
|
@ -1189,9 +1289,17 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Notifications\ChannelManager' => \Illuminate\Notifications\ChannelManager::class,
|
||||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class,
|
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class,
|
||||
'Illuminate\Testing\ParallelTesting' => \Illuminate\Testing\ParallelTesting::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,
|
||||
'Maatwebsite\Excel\Files\Filesystem' => \Maatwebsite\Excel\Files\Filesystem::class,
|
||||
'Maatwebsite\Excel\Files\TemporaryFileFactory' => \Maatwebsite\Excel\Files\TemporaryFileFactory::class,
|
||||
'Maatwebsite\Excel\Transactions\TransactionHandler' => \Maatwebsite\Excel\Transactions\DbTransactionHandler::class,
|
||||
'Maatwebsite\Excel\Transactions\TransactionManager' => \Maatwebsite\Excel\Transactions\TransactionManager::class,
|
||||
'NunoMaduro\Collision\Contracts\Provider' => \NunoMaduro\Collision\Provider::class,
|
||||
'Psr\Http\Message\ResponseInterface' => \Nyholm\Psr7\Response::class,
|
||||
'Psr\Http\Message\ServerRequestInterface' => \Nyholm\Psr7\ServerRequest::class,
|
||||
|
|
@ -1204,7 +1312,6 @@ namespace PHPSTORM_META {
|
|||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class,
|
||||
'cache' => \Illuminate\Cache\CacheManager::class,
|
||||
'cache.store' => \Illuminate\Cache\Repository::class,
|
||||
'cart' => \Gloudemans\Shoppingcart\Cart::class,
|
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class,
|
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class,
|
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class,
|
||||
|
|
@ -1217,6 +1324,7 @@ namespace PHPSTORM_META {
|
|||
'command.config.clear' => \Illuminate\Foundation\Console\ConfigClearCommand::class,
|
||||
'command.console.make' => \Illuminate\Foundation\Console\ConsoleMakeCommand::class,
|
||||
'command.controller.make' => \Illuminate\Routing\Console\ControllerMakeCommand::class,
|
||||
'command.db.prune' => \Illuminate\Database\Console\PruneCommand::class,
|
||||
'command.db.wipe' => \Illuminate\Database\Console\WipeCommand::class,
|
||||
'command.debugbar.clear' => \Barryvdh\Debugbar\Console\ClearCommand::class,
|
||||
'command.down' => \Illuminate\Foundation\Console\DownCommand::class,
|
||||
|
|
@ -1264,7 +1372,9 @@ namespace PHPSTORM_META {
|
|||
'command.queue.flush' => \Illuminate\Queue\Console\FlushFailedCommand::class,
|
||||
'command.queue.forget' => \Illuminate\Queue\Console\ForgetFailedCommand::class,
|
||||
'command.queue.listen' => \Illuminate\Queue\Console\ListenCommand::class,
|
||||
'command.queue.monitor' => \Illuminate\Queue\Console\MonitorCommand::class,
|
||||
'command.queue.prune-batches' => \Illuminate\Queue\Console\PruneBatchesCommand::class,
|
||||
'command.queue.prune-failed-jobs' => \Illuminate\Queue\Console\PruneFailedJobsCommand::class,
|
||||
'command.queue.restart' => \Illuminate\Queue\Console\RestartCommand::class,
|
||||
'command.queue.retry' => \Illuminate\Queue\Console\RetryCommand::class,
|
||||
'command.queue.retry-batch' => \Illuminate\Queue\Console\RetryBatchCommand::class,
|
||||
|
|
@ -1302,6 +1412,7 @@ namespace PHPSTORM_META {
|
|||
'dompdf.wrapper' => \Barryvdh\DomPDF\PDF::class,
|
||||
'encrypter' => \Illuminate\Encryption\Encrypter::class,
|
||||
'events' => \Illuminate\Events\Dispatcher::class,
|
||||
'excel' => \Maatwebsite\Excel\Excel::class,
|
||||
'files' => \Illuminate\Filesystem\Filesystem::class,
|
||||
'filesystem' => \Illuminate\Filesystem\FilesystemManager::class,
|
||||
'filesystem.disk' => \Illuminate\Filesystem\FilesystemAdapter::class,
|
||||
|
|
@ -1320,6 +1431,7 @@ namespace PHPSTORM_META {
|
|||
'migration.creator' => \Illuminate\Database\Migrations\MigrationCreator::class,
|
||||
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class,
|
||||
'migrator' => \Illuminate\Database\Migrations\Migrator::class,
|
||||
'paypal_client' => \Srmklive\PayPal\Services\PayPal::class,
|
||||
'profanityFilter' => \Askedio\Laravel5ProfanityFilter\ProfanityFilter::class,
|
||||
'queue' => \Illuminate\Queue\QueueManager::class,
|
||||
'queue.connection' => \Illuminate\Queue\SyncQueue::class,
|
||||
|
|
@ -1350,8 +1462,10 @@ namespace PHPSTORM_META {
|
|||
'Facade\Ignition\DumpRecorder\MultiDumpHandler' => \Facade\Ignition\DumpRecorder\MultiDumpHandler::class,
|
||||
'Facade\Ignition\ErrorPage\Renderer' => \Facade\Ignition\ErrorPage\Renderer::class,
|
||||
'Facade\Ignition\IgnitionConfig' => \Facade\Ignition\IgnitionConfig::class,
|
||||
'Facade\Ignition\JobRecorder\JobRecorder' => \Facade\Ignition\JobRecorder\JobRecorder::class,
|
||||
'Facade\Ignition\LogRecorder\LogRecorder' => \Facade\Ignition\LogRecorder\LogRecorder::class,
|
||||
'Facade\Ignition\QueryRecorder\QueryRecorder' => \Facade\Ignition\QueryRecorder\QueryRecorder::class,
|
||||
'Facade\Ignition\Support\SentReports' => \Facade\Ignition\Support\SentReports::class,
|
||||
'Illuminate\Auth\Middleware\RequirePassword' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'Illuminate\Broadcasting\BroadcastManager' => \Illuminate\Broadcasting\BroadcastManager::class,
|
||||
'Illuminate\Bus\BatchRepository' => \Illuminate\Bus\DatabaseBatchRepository::class,
|
||||
|
|
@ -1359,6 +1473,7 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Bus\Dispatcher' => \Illuminate\Bus\Dispatcher::class,
|
||||
'Illuminate\Cache\RateLimiter' => \Illuminate\Cache\RateLimiter::class,
|
||||
'Illuminate\Console\Scheduling\Schedule' => \Illuminate\Console\Scheduling\Schedule::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleClearCacheCommand' => \Illuminate\Console\Scheduling\ScheduleClearCacheCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleFinishCommand' => \Illuminate\Console\Scheduling\ScheduleFinishCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleListCommand' => \Illuminate\Console\Scheduling\ScheduleListCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleRunCommand' => \Illuminate\Console\Scheduling\ScheduleRunCommand::class,
|
||||
|
|
@ -1372,6 +1487,7 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Contracts\Pipeline\Hub' => \Illuminate\Pipeline\Hub::class,
|
||||
'Illuminate\Contracts\Queue\EntityResolver' => \Illuminate\Database\Eloquent\QueueEntityResolver::class,
|
||||
'Illuminate\Contracts\Routing\ResponseFactory' => \Illuminate\Routing\ResponseFactory::class,
|
||||
'Illuminate\Contracts\Validation\UncompromisedVerifier' => \Illuminate\Validation\NotPwnedVerifier::class,
|
||||
'Illuminate\Database\Console\DbCommand' => \Illuminate\Database\Console\DbCommand::class,
|
||||
'Illuminate\Foundation\Mix' => \Illuminate\Foundation\Mix::class,
|
||||
'Illuminate\Foundation\PackageManifest' => \Illuminate\Foundation\PackageManifest::class,
|
||||
|
|
@ -1379,9 +1495,17 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Notifications\ChannelManager' => \Illuminate\Notifications\ChannelManager::class,
|
||||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class,
|
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class,
|
||||
'Illuminate\Testing\ParallelTesting' => \Illuminate\Testing\ParallelTesting::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,
|
||||
'Maatwebsite\Excel\Files\Filesystem' => \Maatwebsite\Excel\Files\Filesystem::class,
|
||||
'Maatwebsite\Excel\Files\TemporaryFileFactory' => \Maatwebsite\Excel\Files\TemporaryFileFactory::class,
|
||||
'Maatwebsite\Excel\Transactions\TransactionHandler' => \Maatwebsite\Excel\Transactions\DbTransactionHandler::class,
|
||||
'Maatwebsite\Excel\Transactions\TransactionManager' => \Maatwebsite\Excel\Transactions\TransactionManager::class,
|
||||
'NunoMaduro\Collision\Contracts\Provider' => \NunoMaduro\Collision\Provider::class,
|
||||
'Psr\Http\Message\ResponseInterface' => \Nyholm\Psr7\Response::class,
|
||||
'Psr\Http\Message\ServerRequestInterface' => \Nyholm\Psr7\ServerRequest::class,
|
||||
|
|
@ -1394,7 +1518,6 @@ namespace PHPSTORM_META {
|
|||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class,
|
||||
'cache' => \Illuminate\Cache\CacheManager::class,
|
||||
'cache.store' => \Illuminate\Cache\Repository::class,
|
||||
'cart' => \Gloudemans\Shoppingcart\Cart::class,
|
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class,
|
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class,
|
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class,
|
||||
|
|
@ -1407,6 +1530,7 @@ namespace PHPSTORM_META {
|
|||
'command.config.clear' => \Illuminate\Foundation\Console\ConfigClearCommand::class,
|
||||
'command.console.make' => \Illuminate\Foundation\Console\ConsoleMakeCommand::class,
|
||||
'command.controller.make' => \Illuminate\Routing\Console\ControllerMakeCommand::class,
|
||||
'command.db.prune' => \Illuminate\Database\Console\PruneCommand::class,
|
||||
'command.db.wipe' => \Illuminate\Database\Console\WipeCommand::class,
|
||||
'command.debugbar.clear' => \Barryvdh\Debugbar\Console\ClearCommand::class,
|
||||
'command.down' => \Illuminate\Foundation\Console\DownCommand::class,
|
||||
|
|
@ -1454,7 +1578,9 @@ namespace PHPSTORM_META {
|
|||
'command.queue.flush' => \Illuminate\Queue\Console\FlushFailedCommand::class,
|
||||
'command.queue.forget' => \Illuminate\Queue\Console\ForgetFailedCommand::class,
|
||||
'command.queue.listen' => \Illuminate\Queue\Console\ListenCommand::class,
|
||||
'command.queue.monitor' => \Illuminate\Queue\Console\MonitorCommand::class,
|
||||
'command.queue.prune-batches' => \Illuminate\Queue\Console\PruneBatchesCommand::class,
|
||||
'command.queue.prune-failed-jobs' => \Illuminate\Queue\Console\PruneFailedJobsCommand::class,
|
||||
'command.queue.restart' => \Illuminate\Queue\Console\RestartCommand::class,
|
||||
'command.queue.retry' => \Illuminate\Queue\Console\RetryCommand::class,
|
||||
'command.queue.retry-batch' => \Illuminate\Queue\Console\RetryBatchCommand::class,
|
||||
|
|
@ -1492,6 +1618,7 @@ namespace PHPSTORM_META {
|
|||
'dompdf.wrapper' => \Barryvdh\DomPDF\PDF::class,
|
||||
'encrypter' => \Illuminate\Encryption\Encrypter::class,
|
||||
'events' => \Illuminate\Events\Dispatcher::class,
|
||||
'excel' => \Maatwebsite\Excel\Excel::class,
|
||||
'files' => \Illuminate\Filesystem\Filesystem::class,
|
||||
'filesystem' => \Illuminate\Filesystem\FilesystemManager::class,
|
||||
'filesystem.disk' => \Illuminate\Filesystem\FilesystemAdapter::class,
|
||||
|
|
@ -1510,6 +1637,7 @@ namespace PHPSTORM_META {
|
|||
'migration.creator' => \Illuminate\Database\Migrations\MigrationCreator::class,
|
||||
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class,
|
||||
'migrator' => \Illuminate\Database\Migrations\Migrator::class,
|
||||
'paypal_client' => \Srmklive\PayPal\Services\PayPal::class,
|
||||
'profanityFilter' => \Askedio\Laravel5ProfanityFilter\ProfanityFilter::class,
|
||||
'queue' => \Illuminate\Queue\QueueManager::class,
|
||||
'queue.connection' => \Illuminate\Queue\SyncQueue::class,
|
||||
|
|
@ -1540,8 +1668,10 @@ namespace PHPSTORM_META {
|
|||
'Facade\Ignition\DumpRecorder\MultiDumpHandler' => \Facade\Ignition\DumpRecorder\MultiDumpHandler::class,
|
||||
'Facade\Ignition\ErrorPage\Renderer' => \Facade\Ignition\ErrorPage\Renderer::class,
|
||||
'Facade\Ignition\IgnitionConfig' => \Facade\Ignition\IgnitionConfig::class,
|
||||
'Facade\Ignition\JobRecorder\JobRecorder' => \Facade\Ignition\JobRecorder\JobRecorder::class,
|
||||
'Facade\Ignition\LogRecorder\LogRecorder' => \Facade\Ignition\LogRecorder\LogRecorder::class,
|
||||
'Facade\Ignition\QueryRecorder\QueryRecorder' => \Facade\Ignition\QueryRecorder\QueryRecorder::class,
|
||||
'Facade\Ignition\Support\SentReports' => \Facade\Ignition\Support\SentReports::class,
|
||||
'Illuminate\Auth\Middleware\RequirePassword' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'Illuminate\Broadcasting\BroadcastManager' => \Illuminate\Broadcasting\BroadcastManager::class,
|
||||
'Illuminate\Bus\BatchRepository' => \Illuminate\Bus\DatabaseBatchRepository::class,
|
||||
|
|
@ -1549,6 +1679,7 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Bus\Dispatcher' => \Illuminate\Bus\Dispatcher::class,
|
||||
'Illuminate\Cache\RateLimiter' => \Illuminate\Cache\RateLimiter::class,
|
||||
'Illuminate\Console\Scheduling\Schedule' => \Illuminate\Console\Scheduling\Schedule::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleClearCacheCommand' => \Illuminate\Console\Scheduling\ScheduleClearCacheCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleFinishCommand' => \Illuminate\Console\Scheduling\ScheduleFinishCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleListCommand' => \Illuminate\Console\Scheduling\ScheduleListCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleRunCommand' => \Illuminate\Console\Scheduling\ScheduleRunCommand::class,
|
||||
|
|
@ -1562,6 +1693,7 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Contracts\Pipeline\Hub' => \Illuminate\Pipeline\Hub::class,
|
||||
'Illuminate\Contracts\Queue\EntityResolver' => \Illuminate\Database\Eloquent\QueueEntityResolver::class,
|
||||
'Illuminate\Contracts\Routing\ResponseFactory' => \Illuminate\Routing\ResponseFactory::class,
|
||||
'Illuminate\Contracts\Validation\UncompromisedVerifier' => \Illuminate\Validation\NotPwnedVerifier::class,
|
||||
'Illuminate\Database\Console\DbCommand' => \Illuminate\Database\Console\DbCommand::class,
|
||||
'Illuminate\Foundation\Mix' => \Illuminate\Foundation\Mix::class,
|
||||
'Illuminate\Foundation\PackageManifest' => \Illuminate\Foundation\PackageManifest::class,
|
||||
|
|
@ -1569,9 +1701,17 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Notifications\ChannelManager' => \Illuminate\Notifications\ChannelManager::class,
|
||||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class,
|
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class,
|
||||
'Illuminate\Testing\ParallelTesting' => \Illuminate\Testing\ParallelTesting::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,
|
||||
'Maatwebsite\Excel\Files\Filesystem' => \Maatwebsite\Excel\Files\Filesystem::class,
|
||||
'Maatwebsite\Excel\Files\TemporaryFileFactory' => \Maatwebsite\Excel\Files\TemporaryFileFactory::class,
|
||||
'Maatwebsite\Excel\Transactions\TransactionHandler' => \Maatwebsite\Excel\Transactions\DbTransactionHandler::class,
|
||||
'Maatwebsite\Excel\Transactions\TransactionManager' => \Maatwebsite\Excel\Transactions\TransactionManager::class,
|
||||
'NunoMaduro\Collision\Contracts\Provider' => \NunoMaduro\Collision\Provider::class,
|
||||
'Psr\Http\Message\ResponseInterface' => \Nyholm\Psr7\Response::class,
|
||||
'Psr\Http\Message\ServerRequestInterface' => \Nyholm\Psr7\ServerRequest::class,
|
||||
|
|
@ -1584,7 +1724,6 @@ namespace PHPSTORM_META {
|
|||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class,
|
||||
'cache' => \Illuminate\Cache\CacheManager::class,
|
||||
'cache.store' => \Illuminate\Cache\Repository::class,
|
||||
'cart' => \Gloudemans\Shoppingcart\Cart::class,
|
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class,
|
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class,
|
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class,
|
||||
|
|
@ -1597,6 +1736,7 @@ namespace PHPSTORM_META {
|
|||
'command.config.clear' => \Illuminate\Foundation\Console\ConfigClearCommand::class,
|
||||
'command.console.make' => \Illuminate\Foundation\Console\ConsoleMakeCommand::class,
|
||||
'command.controller.make' => \Illuminate\Routing\Console\ControllerMakeCommand::class,
|
||||
'command.db.prune' => \Illuminate\Database\Console\PruneCommand::class,
|
||||
'command.db.wipe' => \Illuminate\Database\Console\WipeCommand::class,
|
||||
'command.debugbar.clear' => \Barryvdh\Debugbar\Console\ClearCommand::class,
|
||||
'command.down' => \Illuminate\Foundation\Console\DownCommand::class,
|
||||
|
|
@ -1644,7 +1784,9 @@ namespace PHPSTORM_META {
|
|||
'command.queue.flush' => \Illuminate\Queue\Console\FlushFailedCommand::class,
|
||||
'command.queue.forget' => \Illuminate\Queue\Console\ForgetFailedCommand::class,
|
||||
'command.queue.listen' => \Illuminate\Queue\Console\ListenCommand::class,
|
||||
'command.queue.monitor' => \Illuminate\Queue\Console\MonitorCommand::class,
|
||||
'command.queue.prune-batches' => \Illuminate\Queue\Console\PruneBatchesCommand::class,
|
||||
'command.queue.prune-failed-jobs' => \Illuminate\Queue\Console\PruneFailedJobsCommand::class,
|
||||
'command.queue.restart' => \Illuminate\Queue\Console\RestartCommand::class,
|
||||
'command.queue.retry' => \Illuminate\Queue\Console\RetryCommand::class,
|
||||
'command.queue.retry-batch' => \Illuminate\Queue\Console\RetryBatchCommand::class,
|
||||
|
|
@ -1682,6 +1824,7 @@ namespace PHPSTORM_META {
|
|||
'dompdf.wrapper' => \Barryvdh\DomPDF\PDF::class,
|
||||
'encrypter' => \Illuminate\Encryption\Encrypter::class,
|
||||
'events' => \Illuminate\Events\Dispatcher::class,
|
||||
'excel' => \Maatwebsite\Excel\Excel::class,
|
||||
'files' => \Illuminate\Filesystem\Filesystem::class,
|
||||
'filesystem' => \Illuminate\Filesystem\FilesystemManager::class,
|
||||
'filesystem.disk' => \Illuminate\Filesystem\FilesystemAdapter::class,
|
||||
|
|
@ -1700,6 +1843,7 @@ namespace PHPSTORM_META {
|
|||
'migration.creator' => \Illuminate\Database\Migrations\MigrationCreator::class,
|
||||
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class,
|
||||
'migrator' => \Illuminate\Database\Migrations\Migrator::class,
|
||||
'paypal_client' => \Srmklive\PayPal\Services\PayPal::class,
|
||||
'profanityFilter' => \Askedio\Laravel5ProfanityFilter\ProfanityFilter::class,
|
||||
'queue' => \Illuminate\Queue\QueueManager::class,
|
||||
'queue.connection' => \Illuminate\Queue\SyncQueue::class,
|
||||
|
|
@ -1730,8 +1874,10 @@ namespace PHPSTORM_META {
|
|||
'Facade\Ignition\DumpRecorder\MultiDumpHandler' => \Facade\Ignition\DumpRecorder\MultiDumpHandler::class,
|
||||
'Facade\Ignition\ErrorPage\Renderer' => \Facade\Ignition\ErrorPage\Renderer::class,
|
||||
'Facade\Ignition\IgnitionConfig' => \Facade\Ignition\IgnitionConfig::class,
|
||||
'Facade\Ignition\JobRecorder\JobRecorder' => \Facade\Ignition\JobRecorder\JobRecorder::class,
|
||||
'Facade\Ignition\LogRecorder\LogRecorder' => \Facade\Ignition\LogRecorder\LogRecorder::class,
|
||||
'Facade\Ignition\QueryRecorder\QueryRecorder' => \Facade\Ignition\QueryRecorder\QueryRecorder::class,
|
||||
'Facade\Ignition\Support\SentReports' => \Facade\Ignition\Support\SentReports::class,
|
||||
'Illuminate\Auth\Middleware\RequirePassword' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'Illuminate\Broadcasting\BroadcastManager' => \Illuminate\Broadcasting\BroadcastManager::class,
|
||||
'Illuminate\Bus\BatchRepository' => \Illuminate\Bus\DatabaseBatchRepository::class,
|
||||
|
|
@ -1739,6 +1885,7 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Bus\Dispatcher' => \Illuminate\Bus\Dispatcher::class,
|
||||
'Illuminate\Cache\RateLimiter' => \Illuminate\Cache\RateLimiter::class,
|
||||
'Illuminate\Console\Scheduling\Schedule' => \Illuminate\Console\Scheduling\Schedule::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleClearCacheCommand' => \Illuminate\Console\Scheduling\ScheduleClearCacheCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleFinishCommand' => \Illuminate\Console\Scheduling\ScheduleFinishCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleListCommand' => \Illuminate\Console\Scheduling\ScheduleListCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleRunCommand' => \Illuminate\Console\Scheduling\ScheduleRunCommand::class,
|
||||
|
|
@ -1752,6 +1899,7 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Contracts\Pipeline\Hub' => \Illuminate\Pipeline\Hub::class,
|
||||
'Illuminate\Contracts\Queue\EntityResolver' => \Illuminate\Database\Eloquent\QueueEntityResolver::class,
|
||||
'Illuminate\Contracts\Routing\ResponseFactory' => \Illuminate\Routing\ResponseFactory::class,
|
||||
'Illuminate\Contracts\Validation\UncompromisedVerifier' => \Illuminate\Validation\NotPwnedVerifier::class,
|
||||
'Illuminate\Database\Console\DbCommand' => \Illuminate\Database\Console\DbCommand::class,
|
||||
'Illuminate\Foundation\Mix' => \Illuminate\Foundation\Mix::class,
|
||||
'Illuminate\Foundation\PackageManifest' => \Illuminate\Foundation\PackageManifest::class,
|
||||
|
|
@ -1759,9 +1907,17 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Notifications\ChannelManager' => \Illuminate\Notifications\ChannelManager::class,
|
||||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class,
|
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class,
|
||||
'Illuminate\Testing\ParallelTesting' => \Illuminate\Testing\ParallelTesting::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,
|
||||
'Maatwebsite\Excel\Files\Filesystem' => \Maatwebsite\Excel\Files\Filesystem::class,
|
||||
'Maatwebsite\Excel\Files\TemporaryFileFactory' => \Maatwebsite\Excel\Files\TemporaryFileFactory::class,
|
||||
'Maatwebsite\Excel\Transactions\TransactionHandler' => \Maatwebsite\Excel\Transactions\DbTransactionHandler::class,
|
||||
'Maatwebsite\Excel\Transactions\TransactionManager' => \Maatwebsite\Excel\Transactions\TransactionManager::class,
|
||||
'NunoMaduro\Collision\Contracts\Provider' => \NunoMaduro\Collision\Provider::class,
|
||||
'Psr\Http\Message\ResponseInterface' => \Nyholm\Psr7\Response::class,
|
||||
'Psr\Http\Message\ServerRequestInterface' => \Nyholm\Psr7\ServerRequest::class,
|
||||
|
|
@ -1774,7 +1930,6 @@ namespace PHPSTORM_META {
|
|||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class,
|
||||
'cache' => \Illuminate\Cache\CacheManager::class,
|
||||
'cache.store' => \Illuminate\Cache\Repository::class,
|
||||
'cart' => \Gloudemans\Shoppingcart\Cart::class,
|
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class,
|
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class,
|
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class,
|
||||
|
|
@ -1787,6 +1942,7 @@ namespace PHPSTORM_META {
|
|||
'command.config.clear' => \Illuminate\Foundation\Console\ConfigClearCommand::class,
|
||||
'command.console.make' => \Illuminate\Foundation\Console\ConsoleMakeCommand::class,
|
||||
'command.controller.make' => \Illuminate\Routing\Console\ControllerMakeCommand::class,
|
||||
'command.db.prune' => \Illuminate\Database\Console\PruneCommand::class,
|
||||
'command.db.wipe' => \Illuminate\Database\Console\WipeCommand::class,
|
||||
'command.debugbar.clear' => \Barryvdh\Debugbar\Console\ClearCommand::class,
|
||||
'command.down' => \Illuminate\Foundation\Console\DownCommand::class,
|
||||
|
|
@ -1834,7 +1990,9 @@ namespace PHPSTORM_META {
|
|||
'command.queue.flush' => \Illuminate\Queue\Console\FlushFailedCommand::class,
|
||||
'command.queue.forget' => \Illuminate\Queue\Console\ForgetFailedCommand::class,
|
||||
'command.queue.listen' => \Illuminate\Queue\Console\ListenCommand::class,
|
||||
'command.queue.monitor' => \Illuminate\Queue\Console\MonitorCommand::class,
|
||||
'command.queue.prune-batches' => \Illuminate\Queue\Console\PruneBatchesCommand::class,
|
||||
'command.queue.prune-failed-jobs' => \Illuminate\Queue\Console\PruneFailedJobsCommand::class,
|
||||
'command.queue.restart' => \Illuminate\Queue\Console\RestartCommand::class,
|
||||
'command.queue.retry' => \Illuminate\Queue\Console\RetryCommand::class,
|
||||
'command.queue.retry-batch' => \Illuminate\Queue\Console\RetryBatchCommand::class,
|
||||
|
|
@ -1872,6 +2030,7 @@ namespace PHPSTORM_META {
|
|||
'dompdf.wrapper' => \Barryvdh\DomPDF\PDF::class,
|
||||
'encrypter' => \Illuminate\Encryption\Encrypter::class,
|
||||
'events' => \Illuminate\Events\Dispatcher::class,
|
||||
'excel' => \Maatwebsite\Excel\Excel::class,
|
||||
'files' => \Illuminate\Filesystem\Filesystem::class,
|
||||
'filesystem' => \Illuminate\Filesystem\FilesystemManager::class,
|
||||
'filesystem.disk' => \Illuminate\Filesystem\FilesystemAdapter::class,
|
||||
|
|
@ -1890,6 +2049,7 @@ namespace PHPSTORM_META {
|
|||
'migration.creator' => \Illuminate\Database\Migrations\MigrationCreator::class,
|
||||
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class,
|
||||
'migrator' => \Illuminate\Database\Migrations\Migrator::class,
|
||||
'paypal_client' => \Srmklive\PayPal\Services\PayPal::class,
|
||||
'profanityFilter' => \Askedio\Laravel5ProfanityFilter\ProfanityFilter::class,
|
||||
'queue' => \Illuminate\Queue\QueueManager::class,
|
||||
'queue.connection' => \Illuminate\Queue\SyncQueue::class,
|
||||
|
|
@ -1920,8 +2080,10 @@ namespace PHPSTORM_META {
|
|||
'Facade\Ignition\DumpRecorder\MultiDumpHandler' => \Facade\Ignition\DumpRecorder\MultiDumpHandler::class,
|
||||
'Facade\Ignition\ErrorPage\Renderer' => \Facade\Ignition\ErrorPage\Renderer::class,
|
||||
'Facade\Ignition\IgnitionConfig' => \Facade\Ignition\IgnitionConfig::class,
|
||||
'Facade\Ignition\JobRecorder\JobRecorder' => \Facade\Ignition\JobRecorder\JobRecorder::class,
|
||||
'Facade\Ignition\LogRecorder\LogRecorder' => \Facade\Ignition\LogRecorder\LogRecorder::class,
|
||||
'Facade\Ignition\QueryRecorder\QueryRecorder' => \Facade\Ignition\QueryRecorder\QueryRecorder::class,
|
||||
'Facade\Ignition\Support\SentReports' => \Facade\Ignition\Support\SentReports::class,
|
||||
'Illuminate\Auth\Middleware\RequirePassword' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'Illuminate\Broadcasting\BroadcastManager' => \Illuminate\Broadcasting\BroadcastManager::class,
|
||||
'Illuminate\Bus\BatchRepository' => \Illuminate\Bus\DatabaseBatchRepository::class,
|
||||
|
|
@ -1929,6 +2091,7 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Bus\Dispatcher' => \Illuminate\Bus\Dispatcher::class,
|
||||
'Illuminate\Cache\RateLimiter' => \Illuminate\Cache\RateLimiter::class,
|
||||
'Illuminate\Console\Scheduling\Schedule' => \Illuminate\Console\Scheduling\Schedule::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleClearCacheCommand' => \Illuminate\Console\Scheduling\ScheduleClearCacheCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleFinishCommand' => \Illuminate\Console\Scheduling\ScheduleFinishCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleListCommand' => \Illuminate\Console\Scheduling\ScheduleListCommand::class,
|
||||
'Illuminate\Console\Scheduling\ScheduleRunCommand' => \Illuminate\Console\Scheduling\ScheduleRunCommand::class,
|
||||
|
|
@ -1942,6 +2105,7 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Contracts\Pipeline\Hub' => \Illuminate\Pipeline\Hub::class,
|
||||
'Illuminate\Contracts\Queue\EntityResolver' => \Illuminate\Database\Eloquent\QueueEntityResolver::class,
|
||||
'Illuminate\Contracts\Routing\ResponseFactory' => \Illuminate\Routing\ResponseFactory::class,
|
||||
'Illuminate\Contracts\Validation\UncompromisedVerifier' => \Illuminate\Validation\NotPwnedVerifier::class,
|
||||
'Illuminate\Database\Console\DbCommand' => \Illuminate\Database\Console\DbCommand::class,
|
||||
'Illuminate\Foundation\Mix' => \Illuminate\Foundation\Mix::class,
|
||||
'Illuminate\Foundation\PackageManifest' => \Illuminate\Foundation\PackageManifest::class,
|
||||
|
|
@ -1949,9 +2113,17 @@ namespace PHPSTORM_META {
|
|||
'Illuminate\Notifications\ChannelManager' => \Illuminate\Notifications\ChannelManager::class,
|
||||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class,
|
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class,
|
||||
'Illuminate\Testing\ParallelTesting' => \Illuminate\Testing\ParallelTesting::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,
|
||||
'Maatwebsite\Excel\Files\Filesystem' => \Maatwebsite\Excel\Files\Filesystem::class,
|
||||
'Maatwebsite\Excel\Files\TemporaryFileFactory' => \Maatwebsite\Excel\Files\TemporaryFileFactory::class,
|
||||
'Maatwebsite\Excel\Transactions\TransactionHandler' => \Maatwebsite\Excel\Transactions\DbTransactionHandler::class,
|
||||
'Maatwebsite\Excel\Transactions\TransactionManager' => \Maatwebsite\Excel\Transactions\TransactionManager::class,
|
||||
'NunoMaduro\Collision\Contracts\Provider' => \NunoMaduro\Collision\Provider::class,
|
||||
'Psr\Http\Message\ResponseInterface' => \Nyholm\Psr7\Response::class,
|
||||
'Psr\Http\Message\ServerRequestInterface' => \Nyholm\Psr7\ServerRequest::class,
|
||||
|
|
@ -1964,7 +2136,6 @@ namespace PHPSTORM_META {
|
|||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class,
|
||||
'cache' => \Illuminate\Cache\CacheManager::class,
|
||||
'cache.store' => \Illuminate\Cache\Repository::class,
|
||||
'cart' => \Gloudemans\Shoppingcart\Cart::class,
|
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class,
|
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class,
|
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class,
|
||||
|
|
@ -1977,6 +2148,7 @@ namespace PHPSTORM_META {
|
|||
'command.config.clear' => \Illuminate\Foundation\Console\ConfigClearCommand::class,
|
||||
'command.console.make' => \Illuminate\Foundation\Console\ConsoleMakeCommand::class,
|
||||
'command.controller.make' => \Illuminate\Routing\Console\ControllerMakeCommand::class,
|
||||
'command.db.prune' => \Illuminate\Database\Console\PruneCommand::class,
|
||||
'command.db.wipe' => \Illuminate\Database\Console\WipeCommand::class,
|
||||
'command.debugbar.clear' => \Barryvdh\Debugbar\Console\ClearCommand::class,
|
||||
'command.down' => \Illuminate\Foundation\Console\DownCommand::class,
|
||||
|
|
@ -2024,7 +2196,9 @@ namespace PHPSTORM_META {
|
|||
'command.queue.flush' => \Illuminate\Queue\Console\FlushFailedCommand::class,
|
||||
'command.queue.forget' => \Illuminate\Queue\Console\ForgetFailedCommand::class,
|
||||
'command.queue.listen' => \Illuminate\Queue\Console\ListenCommand::class,
|
||||
'command.queue.monitor' => \Illuminate\Queue\Console\MonitorCommand::class,
|
||||
'command.queue.prune-batches' => \Illuminate\Queue\Console\PruneBatchesCommand::class,
|
||||
'command.queue.prune-failed-jobs' => \Illuminate\Queue\Console\PruneFailedJobsCommand::class,
|
||||
'command.queue.restart' => \Illuminate\Queue\Console\RestartCommand::class,
|
||||
'command.queue.retry' => \Illuminate\Queue\Console\RetryCommand::class,
|
||||
'command.queue.retry-batch' => \Illuminate\Queue\Console\RetryBatchCommand::class,
|
||||
|
|
@ -2062,6 +2236,7 @@ namespace PHPSTORM_META {
|
|||
'dompdf.wrapper' => \Barryvdh\DomPDF\PDF::class,
|
||||
'encrypter' => \Illuminate\Encryption\Encrypter::class,
|
||||
'events' => \Illuminate\Events\Dispatcher::class,
|
||||
'excel' => \Maatwebsite\Excel\Excel::class,
|
||||
'files' => \Illuminate\Filesystem\Filesystem::class,
|
||||
'filesystem' => \Illuminate\Filesystem\FilesystemManager::class,
|
||||
'filesystem.disk' => \Illuminate\Filesystem\FilesystemAdapter::class,
|
||||
|
|
@ -2080,6 +2255,7 @@ namespace PHPSTORM_META {
|
|||
'migration.creator' => \Illuminate\Database\Migrations\MigrationCreator::class,
|
||||
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class,
|
||||
'migrator' => \Illuminate\Database\Migrations\Migrator::class,
|
||||
'paypal_client' => \Srmklive\PayPal\Services\PayPal::class,
|
||||
'profanityFilter' => \Askedio\Laravel5ProfanityFilter\ProfanityFilter::class,
|
||||
'queue' => \Illuminate\Queue\QueueManager::class,
|
||||
'queue.connection' => \Illuminate\Queue\SyncQueue::class,
|
||||
|
|
@ -2101,6 +2277,10 @@ namespace PHPSTORM_META {
|
|||
]));
|
||||
|
||||
|
||||
override(\Illuminate\Foundation\Testing\Concerns\InteractsWithContainer::mock(0), map(["" => "@&\Mockery\MockInterface"]));
|
||||
override(\Illuminate\Foundation\Testing\Concerns\InteractsWithContainer::partialMock(0), map(["" => "@&\Mockery\MockInterface"]));
|
||||
override(\Illuminate\Foundation\Testing\Concerns\InteractsWithContainer::instance(0), type(1));
|
||||
override(\Illuminate\Foundation\Testing\Concerns\InteractsWithContainer::spy(0), map(["" => "@&\Mockery\MockInterface"]));
|
||||
override(\Illuminate\Support\Arr::add(0), type(0));
|
||||
override(\Illuminate\Support\Arr::except(0), type(0));
|
||||
override(\Illuminate\Support\Arr::first(0), elementType(0));
|
||||
|
|
|
|||
3482
_ide_helper.php
3482
_ide_helper.php
File diff suppressed because it is too large
Load diff
|
|
@ -21,7 +21,7 @@ class PaymentsAccounts extends Command
|
|||
|
||||
private $timeStart;
|
||||
|
||||
|
||||
private $dev = false;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
|
@ -35,18 +35,29 @@ class PaymentsAccounts extends Command
|
|||
*/
|
||||
public function handle()
|
||||
{
|
||||
\Log::info('Starting PaymentsAccounts Command', ['timestamp' => now()]);
|
||||
$this->info('RUN Command Payments Account: '.date('d.m.Y H:i'));
|
||||
$this->timeStart = microtime(true);
|
||||
|
||||
try {
|
||||
$this->updateUserNextLevel();
|
||||
$this->updatePaymentsAccountsFree();
|
||||
$this->deactivateUserAccounts();
|
||||
$this->reminderPaymentsAccounts();
|
||||
|
||||
\Log::info('PaymentsAccounts Command completed successfully');
|
||||
return 0;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
\Log::error('PaymentsAccounts Command failed', [
|
||||
'error' => $e->getMessage(),
|
||||
'trace' => $e->getTraceAsString()
|
||||
]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
private function updateUserNextLevel(){
|
||||
try {
|
||||
// now date - renewal_days
|
||||
$count = 0;
|
||||
$renewalDate = Carbon::now()->modify('+'.(config('main.renewal_days')).' days');
|
||||
|
|
@ -55,6 +66,7 @@ class PaymentsAccounts extends Command
|
|||
->where('blocked', '!=', 1)
|
||||
->where('payment_account', '<', $renewalDate)
|
||||
->whereColumn('m_level', '!=', 'next_m_level')
|
||||
->where('deleted_at', NULL)
|
||||
->get();
|
||||
|
||||
foreach($users as $user){
|
||||
|
|
@ -67,10 +79,22 @@ class PaymentsAccounts extends Command
|
|||
$sec = intval($diff);
|
||||
$micro = $diff - $sec;
|
||||
$this->info('END Command updateUserNextLevel: '.$count.' | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
|
||||
|
||||
\Log::info('updateUserNextLevel completed', [
|
||||
'users_updated' => $count,
|
||||
'execution_time' => $sec . 'sec :' . round($micro * 1000, 4) . "ms"
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
\Log::error('updateUserNextLevel failed', [
|
||||
'error' => $e->getMessage()
|
||||
]);
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function updatePaymentsAccountsFree(){
|
||||
try {
|
||||
// now date - renewal_days -1 / user_levels.payment_year false is no payment
|
||||
$count = 0;
|
||||
$renewalDate = Carbon::now()->modify('+'.(config('main.renewal_days')-1).' days');
|
||||
|
|
@ -79,7 +103,8 @@ class PaymentsAccounts extends Command
|
|||
->where('users.active', '=', 1)
|
||||
->where('users.blocked', '!=', 1)
|
||||
->where('users.payment_account', '<', $renewalDate)
|
||||
->where('user_levels.payment_year', '=', 0)
|
||||
->where('user_levels.payment_year', '=', 0)//user_levels.payment_year false is no payment
|
||||
->where('users.deleted_at', NULL)
|
||||
->get();
|
||||
|
||||
foreach($users as $user){
|
||||
|
|
@ -92,21 +117,69 @@ class PaymentsAccounts extends Command
|
|||
$sec = intval($diff);
|
||||
$micro = $diff - $sec;
|
||||
$this->info('END Command updatePaymentsAccountsFree: '.$count.' | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
|
||||
|
||||
\Log::info('updatePaymentsAccountsFree completed', [
|
||||
'users_updated' => $count,
|
||||
'execution_time' => $sec . 'sec :' . round($micro * 1000, 4) . "ms"
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
\Log::error('updatePaymentsAccountsFree failed', [
|
||||
'error' => $e->getMessage()
|
||||
]);
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
private function deactivateUserAccounts(){
|
||||
try {
|
||||
$count = 0;
|
||||
$sevenDaysAfterExpiry = Carbon::now()->subDays(7);
|
||||
$users = User::where('payment_account', '!=', NULL)
|
||||
->where('active', '=', 1)
|
||||
->where('blocked', '!=', 1)
|
||||
->where('payment_account', '<', $sevenDaysAfterExpiry)
|
||||
->where('deleted_at', NULL)
|
||||
->get();
|
||||
|
||||
foreach($users as $user){
|
||||
$user->active = 0;
|
||||
$user->save();
|
||||
$this->info('deactivateUserAccount | User: '.$user->id.' '.$user->email.' | Date :' . $user->getPaymentAccountDateFormat() . "");
|
||||
|
||||
$count ++;
|
||||
}
|
||||
|
||||
$diff = microtime(true) - $this->timeStart;
|
||||
$sec = intval($diff);
|
||||
$micro = $diff - $sec;
|
||||
$this->info('END Command deactivateUserAccounts: '.$count.' | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
|
||||
|
||||
\Log::info('deactivateUserAccounts completed', [
|
||||
'users_updated' => $count,
|
||||
'execution_time' => $sec . 'sec :' . round($micro * 1000, 4) . "ms"
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
\Log::error('deactivateUserAccounts failed', [
|
||||
'error' => $e->getMessage()
|
||||
]);
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
private function reminderPaymentsAccounts()
|
||||
{
|
||||
|
||||
try {
|
||||
$count = 0;
|
||||
$max_reminder_date = Carbon::now()->modify('+'.(config('main.remind_first_days')).' days');
|
||||
$users = User::where('payment_account', '!=', NULL)
|
||||
->where('active', '=', 1)
|
||||
->where('blocked', '!=', 1)
|
||||
->where('payment_account', '<', $max_reminder_date)
|
||||
->where('deleted_at', NULL)
|
||||
->get();
|
||||
|
||||
foreach ($users as $user){
|
||||
$status = UserCheckPaymentsAccounts::userReminderPayments($user);
|
||||
$status = UserCheckPaymentsAccounts::userReminderPayments($user, $this->dev);
|
||||
$this->info('reminderPaymentsAccounts Status: '.$status.' | User: '.$user->id.' '.$user->email.' | Date :' . $user->getPaymentAccountDateFormat() . "");
|
||||
$count ++;
|
||||
}
|
||||
|
|
@ -116,5 +189,15 @@ class PaymentsAccounts extends Command
|
|||
$micro = $diff - $sec;
|
||||
$this->info('END Command reminderPaymentsAccounts: '.$count.' | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
|
||||
|
||||
\Log::info('reminderPaymentsAccounts completed', [
|
||||
'users_processed' => $count,
|
||||
'execution_time' => $sec . 'sec :' . round($micro * 1000, 4) . "ms"
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
\Log::error('reminderPaymentsAccounts failed', [
|
||||
'error' => $e->getMessage()
|
||||
]);
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,9 +25,12 @@ class Kernel extends ConsoleKernel
|
|||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
$schedule->command('payments:accounts')
|
||||
->sendOutputTo("cron.log");
|
||||
//->hourly();
|
||||
// ->emailOutputTo('kevin@adametz.media');
|
||||
->sendOutputTo(storage_path('logs/cron.log'))
|
||||
->appendOutputTo(storage_path('logs/cron-history.log'))
|
||||
->emailOutputOnFailure(config('app.exception_mail'))
|
||||
->onFailure(function () {
|
||||
\Log::error('Payments:accounts command failed');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,87 +0,0 @@
|
|||
<?php
|
||||
namespace App\Cron;
|
||||
|
||||
use App\User;
|
||||
use App\Models\UserBusiness;
|
||||
use App\Services\HTMLHelper;
|
||||
use App\Models\UserCreditItem;
|
||||
use App\Repositories\CreditRepository;
|
||||
|
||||
class UserCheckPaymentsAccounts
|
||||
{
|
||||
private $month;
|
||||
private $year;
|
||||
|
||||
|
||||
public function __construct($month, $year)
|
||||
{
|
||||
$this->month = $month;
|
||||
$this->year = $year;
|
||||
}
|
||||
|
||||
|
||||
public function getUserBusinessByMonthYear(){
|
||||
return UserBusiness::select('user_businesses.*')
|
||||
->where('user_businesses.month', '=', $this->month)
|
||||
->where('user_businesses.year', '=', $this->year)
|
||||
->where(function($q) {
|
||||
return $q->where('user_businesses.commission_team_total', '>', 0)
|
||||
->orWhere('user_businesses.commission_shop_sales', '>', 0);
|
||||
})
|
||||
->get();
|
||||
}
|
||||
|
||||
public function addUserCreditItem($userBusiness)
|
||||
{
|
||||
$date = HTMLHelper::getMonth($userBusiness->month).' '.$userBusiness->year;
|
||||
|
||||
if($userBusiness->commission_shop_sales > 0){
|
||||
if($this->hasNotUserCreditItem($userBusiness, 1)){
|
||||
UserCreditItem::create([
|
||||
'user_id' => $userBusiness->user_id,
|
||||
'user_business_id' => $userBusiness->id,
|
||||
'credit' => $userBusiness->commission_shop_sales,
|
||||
'message' => 'Provision Shop '.$date,
|
||||
'status' => 1,
|
||||
]);
|
||||
}
|
||||
}
|
||||
if($userBusiness->commission_team_total > 0){
|
||||
if($this->hasNotUserCreditItem($userBusiness, 2)){
|
||||
UserCreditItem::create([
|
||||
'user_id' => $userBusiness->user_id,
|
||||
'user_business_id' => $userBusiness->id,
|
||||
'credit' => $userBusiness->commission_team_total,
|
||||
'message' => 'Provision Team '.$date,
|
||||
'status' => 2,
|
||||
]);
|
||||
}
|
||||
}
|
||||
return $userBusiness;
|
||||
|
||||
}
|
||||
|
||||
public function getUserCreditItemUsersByMonthYear(){
|
||||
return UserCreditItem::select('user_credit_items.*')
|
||||
->where('paid', '=', false)
|
||||
->groupBy('user_id')
|
||||
->get();
|
||||
}
|
||||
|
||||
public function makeCreditPaymentPDF($user_id, $credit_send_mail)
|
||||
{
|
||||
//$user_id = 2;
|
||||
$user = User::findOrFail($user_id);
|
||||
$data = [];
|
||||
if($credit_send_mail){
|
||||
$data['credit_send_mail'] = true;
|
||||
}
|
||||
$credit_repo = new CreditRepository($user);
|
||||
return $credit_repo->create($data);
|
||||
}
|
||||
|
||||
private function hasNotUserCreditItem($userBusiness, $status){
|
||||
return (UserCreditItem::where('user_business_id', $userBusiness->id)
|
||||
->where('user_id', $userBusiness->user_id)->where('status', $status)->count() > 0) ? false : true;
|
||||
}
|
||||
}
|
||||
|
|
@ -27,27 +27,28 @@ class UserCheckPaymentsAccounts
|
|||
> 0 deaktiv = reminder_deaktiv //status 35
|
||||
*/
|
||||
|
||||
public static function userReminderPayments(User $user){
|
||||
public static function userReminderPayments(User $user, $dev){
|
||||
//35 reminder_deaktiv
|
||||
if(!$user->isActiveAccount()){ // payment_account gt now
|
||||
return self::checkIsReminderSend($user, 35);
|
||||
return self::checkIsReminderSend($user, 35, $dev);
|
||||
}
|
||||
//34 reminder_last
|
||||
if($user->daysActiveAccount() <= config('main.remind_last_days')){
|
||||
return self::checkIsReminderSend($user, 34);
|
||||
return self::checkIsReminderSend($user, 34, $dev);
|
||||
}
|
||||
//33 reminder_sec
|
||||
if($user->daysActiveAccount() <= config('main.remind_sec_days')){
|
||||
return self::checkIsReminderSend($user, 33);
|
||||
return self::checkIsReminderSend($user, 33, $dev);
|
||||
}
|
||||
//31 reminder_first
|
||||
if($user->daysActiveAccount() > config('main.remind_sec_days')){
|
||||
return self::checkIsReminderSend($user, 31);
|
||||
return self::checkIsReminderSend($user, 31, $dev);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
private static function checkIsReminderSend(User $user, $status){
|
||||
private static function checkIsReminderSend(User $user, $status, $dev){
|
||||
|
||||
$isSend = UserHistory::whereUserId($user->id)
|
||||
->whereAction('reminder_payments')
|
||||
|
|
@ -58,7 +59,11 @@ class UserCheckPaymentsAccounts
|
|||
if($isSend){
|
||||
return 0;
|
||||
}
|
||||
if($dev){
|
||||
$referenz = 0;
|
||||
}else{
|
||||
$referenz = self::sendReminderMail($user, $status);
|
||||
}
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>'reminder_payments', 'referenz'=>$referenz, 'identifier'=>$user->payment_account, 'status'=>$status]);
|
||||
return $status;
|
||||
|
||||
|
|
@ -105,9 +110,9 @@ class UserCheckPaymentsAccounts
|
|||
]);
|
||||
try{
|
||||
if($status >= 34){
|
||||
Mail::to($user->email)->bcc(config('app.info_mail'))->send(new MailCustomMessage($user, $data, $sender, false));
|
||||
//Mail::to($user->email)->bcc(config('app.info_mail'))->send(new MailCustomMessage($user, $data, $sender, false));
|
||||
}else{
|
||||
Mail::to($user->email)->send(new MailCustomMessage($user, $data, $sender, false));
|
||||
//Mail::to($user->email)->send(new MailCustomMessage($user, $data, $sender, false));
|
||||
}
|
||||
}
|
||||
catch(\Exception $e){
|
||||
|
|
@ -129,6 +134,8 @@ class UserCheckPaymentsAccounts
|
|||
|
||||
/*public function checkConfirmation()
|
||||
{
|
||||
User Register sind in der DB UserRegister, erst bei bestätigung wird es in die User DB übertragen
|
||||
|
||||
$now = date('Y-m-d H:i:s');
|
||||
$next = date('Y-m-d H:i:s', strtotime('+3 week'));
|
||||
|
||||
|
|
|
|||
33
app/Exports/ExcelExport.php
Normal file
33
app/Exports/ExcelExport.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
namespace App\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Excel;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
|
||||
class ExcelExport implements FromCollection, WithHeadings
|
||||
{
|
||||
protected $collection;
|
||||
protected $headings;
|
||||
|
||||
use Exportable;
|
||||
|
||||
|
||||
public function __construct($data,$header)
|
||||
{
|
||||
$this->collection = $data;
|
||||
$this->headings = $header;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
return collect($this->collection);
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [$this->headings];
|
||||
}
|
||||
|
||||
}
|
||||
33
app/Exports/UserTeamExport.php
Normal file
33
app/Exports/UserTeamExport.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
namespace App\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Excel;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
|
||||
class UserTeamExport implements FromCollection, WithHeadings
|
||||
{
|
||||
protected $collection;
|
||||
protected $headings;
|
||||
|
||||
use Exportable;
|
||||
|
||||
|
||||
public function __construct($data,$header)
|
||||
{
|
||||
$this->collection = $data;
|
||||
$this->headings = $header;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
return collect($this->collection);
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [$this->headings];
|
||||
}
|
||||
|
||||
}
|
||||
33
app/Exports/XLSExport.php
Normal file
33
app/Exports/XLSExport.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
namespace App\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Excel;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
|
||||
class XLSExport implements FromCollection, WithHeadings
|
||||
{
|
||||
protected $collection;
|
||||
protected $headings;
|
||||
|
||||
use Exportable;
|
||||
|
||||
|
||||
public function __construct($data,$header)
|
||||
{
|
||||
$this->collection = $data;
|
||||
$this->headings = $header;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
return collect($this->collection);
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [$this->headings];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -595,7 +595,9 @@ class ShoppingUserController extends Controller
|
|||
if ($order->price != ($product->price * 100)) {
|
||||
$error[] = "different price: " . ($product->price * 100);
|
||||
}
|
||||
Yard::instance('shopping')->add($product->id, $product->name, (int) $order->qty, $product->price, ['image' => [], 'slug' => $product->slug, 'weight' => $product->weight]);
|
||||
|
||||
|
||||
Yard::instance('shopping')->add($product->id, $product->name, (int) $order->qty, $product->price, $product->tax, ['image' => [], 'slug' => $product->slug, 'weight' => $product->weight]);
|
||||
}
|
||||
}
|
||||
$order->message = $error;
|
||||
|
|
@ -604,7 +606,7 @@ class ShoppingUserController extends Controller
|
|||
|
||||
$ShippingCountry = ShippingCountry::whereCountryId($shopping_user->shipping_country_id)->first();
|
||||
if($ShippingCountry){
|
||||
Yard::instance('shopping')->setShippingCountryWithPrice($ShippingCountry->id);
|
||||
Yard::instance('shopping')->setShippingCountryWithPrice($ShippingCountry->id, 'ot');
|
||||
}
|
||||
$shopping_order = $this->makeShoppingOrder($shopping_user, $wp_invoice_path, $wp_notice);
|
||||
$this->orderStatusSendMail($shopping_order);
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
|
||||
use App\Models\Attribute;
|
||||
use App\Models\ProductAttribute;
|
||||
use Request;
|
||||
use App\Models\Attribute;
|
||||
use App\Models\AttributeType;
|
||||
use App\Models\ProductAttribute;
|
||||
|
||||
|
||||
class AttributeController extends Controller
|
||||
|
|
@ -20,20 +21,47 @@ class AttributeController extends Controller
|
|||
{
|
||||
|
||||
$data = [
|
||||
'values' => Attribute::all(),
|
||||
'attribute_types' => AttributeType::all(),
|
||||
'attributes' => Attribute::all(),
|
||||
'trans' => array_keys(config('localization.supportedLocales')),
|
||||
];
|
||||
return view('admin.attribute.index', $data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function store()
|
||||
{
|
||||
|
||||
$data = Request::all();
|
||||
if(isset($data['action'])){
|
||||
|
||||
if( $data['action'] === "attribute-type"){
|
||||
if($data['id'] == "new"){
|
||||
$model = AttributeType::create([
|
||||
'parent_id' => null,
|
||||
'name' => $data['name'],
|
||||
'description' => $data['description'],
|
||||
'pos' => $data['pos'],
|
||||
'active' => isset($data['active']) ? true : false,
|
||||
]);
|
||||
}else{
|
||||
$model = AttributeType::find($data['id']);
|
||||
$model->parent_id = null;
|
||||
$model->name = $data['name'];
|
||||
$model->description = $data['description'];
|
||||
$model->pos = $data['pos'];
|
||||
$model->active = isset($data['active']) ? true : false;
|
||||
$model->save();
|
||||
}
|
||||
}
|
||||
if($data['action'] === "attribute"){
|
||||
if($data['id'] == "new"){
|
||||
$model = Attribute::create([
|
||||
'parent_id' => null,
|
||||
'attribute_type_id' => $data['attribute_type_id'],
|
||||
'name' => $data['name'],
|
||||
'value' => $data['value'],
|
||||
'pos' => $data['pos'],
|
||||
'active' => isset($data['active']) ? true : false,
|
||||
]);
|
||||
|
|
@ -41,12 +69,16 @@ class AttributeController extends Controller
|
|||
$model = Attribute::find($data['id']);
|
||||
$model->parent_id = null;
|
||||
$model->name = $data['name'];
|
||||
$model->value = $data['value'];
|
||||
$model->attribute_type_id = $data['attribute_type_id'];
|
||||
$model->pos = $data['pos'];
|
||||
$model->active = isset($data['active']) ? true : false;
|
||||
$model->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($data['trans'])){
|
||||
/*if(!empty($data['trans'])){
|
||||
$trans = [];
|
||||
foreach ($data['trans'] as $lang => $value){
|
||||
if($value && $value != null){
|
||||
|
|
@ -57,7 +89,7 @@ class AttributeController extends Controller
|
|||
$model->trans_name = $trans;
|
||||
$model->save();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('admin_product_attributes'));
|
||||
|
|
@ -66,15 +98,32 @@ class AttributeController extends Controller
|
|||
}
|
||||
|
||||
|
||||
public function delete($id){
|
||||
public function delete($attr, $id){
|
||||
|
||||
if($attr === 'type'){
|
||||
if(Attribute::where('attribute_type_id', $id)->count()){
|
||||
\Session()->flash('alert-error', 'Attribute Type wird bei den Attributen verwendet');
|
||||
return redirect(route('admin_product_attributes'));
|
||||
}
|
||||
/* if(AttributeType::where('parent_id', $id)->count()){
|
||||
\Session()->flash('alert-error', 'Eintrag wird als Main Attribute verwendet');
|
||||
return redirect(route('admin_product_attributes'));
|
||||
}
|
||||
*/
|
||||
$model = AttributeType::findOrFail($id);
|
||||
$model->delete();
|
||||
\Session()->flash('alert-success', 'Attribute Type gelöscht');
|
||||
return redirect(route('admin_product_attributes'));
|
||||
}
|
||||
|
||||
if($attr === 'attr'){
|
||||
if(ProductAttribute::where('attribute_id', $id)->count()){
|
||||
\Session()->flash('alert-error', 'Eintrag wird als Produktattribute verwendet');
|
||||
\Session()->flash('alert-error', 'Attribute wird bei den Produkten verwendet');
|
||||
return redirect(route('admin_product_attributes'));
|
||||
}
|
||||
/* if(Attribute::where('parent_id', $id)->count()){
|
||||
\Session()->flash('alert-error', 'Eintrag wird als Main Attribute verwendet');
|
||||
return redirect(route('admin_industry_sectors'));
|
||||
return redirect(route('admin_product_attributes'));
|
||||
}
|
||||
*/
|
||||
$model = Attribute::findOrFail($id);
|
||||
|
|
@ -83,4 +132,7 @@ class AttributeController extends Controller
|
|||
return redirect(route('admin_product_attributes'));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -52,6 +52,8 @@ class CountryController extends Controller
|
|||
|
||||
$data['active'] = isset($data['active']) ? true : false;
|
||||
$data['switch'] = isset($data['switch']) ? true : false;
|
||||
$data['translate'] = isset($data['translate']) ? true : false;
|
||||
$data['eu_country'] = isset($data['eu_country']) ? true : false;
|
||||
$data['own_eur'] = isset($data['own_eur']) ? true : false;
|
||||
$data['currency'] = isset($data['currency']) ? true : false;
|
||||
$data['currency_faktor'] = $data['currency_faktor'] == "" ? null : reFormatNumber($data['currency_faktor']);
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ class CronController extends Controller
|
|||
if($key !== 'key'){
|
||||
abort(404);
|
||||
}
|
||||
die('not in use');
|
||||
if($action === 'check_payments_account'){
|
||||
$this->checkPaymentsAccounts();
|
||||
}
|
||||
|
|
@ -54,6 +55,8 @@ class CronController extends Controller
|
|||
*/
|
||||
public function checkConfirmation()
|
||||
{
|
||||
/*
|
||||
User Register sind in der DB UserRegister, erst bei bestätigung wird es in die User DB übertragen
|
||||
$now = date('Y-m-d H:i:s');
|
||||
$next = date('Y-m-d H:i:s', strtotime('+3 week'));
|
||||
|
||||
|
|
@ -73,7 +76,7 @@ class CronController extends Controller
|
|||
$user->confirmation_code_remider = 1;
|
||||
$user->save();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
return "TOSK";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ class DataTableController extends Controller
|
|||
->addColumn('admin', function (User $user) {
|
||||
return '<a href="#" data-toggle="modal" data-target="#modals-admin" data-id="'.$user->id.'" data-email="'.$user->email.'" data-admin="'.$user->admin.'">'.HTMLHelper::getRoleLabel($user->admin).'</a>';
|
||||
})
|
||||
->addColumn('role', function (User $user) {
|
||||
return $user->user_level ? $user->user_level->name : '';
|
||||
})
|
||||
->addColumn('confirmed', function (User $user) {
|
||||
$date = $user->getConfirmationDateFormat();
|
||||
$link = '<a href="#" data-toggle="modal" data-target="#modals-confirmed" data-id="'.$user->id.'" data-email="'.$user->email.'" data-confirmed="'.$user->confirmed.'" data-confirmation_date="'.$date.'">';
|
||||
|
|
@ -71,6 +74,9 @@ class DataTableController extends Controller
|
|||
}
|
||||
return "-";
|
||||
})*/
|
||||
->addColumn('country', function (User $user) {
|
||||
return ($user->account && $user->account->country) ? $user->account->country->de : '';
|
||||
})
|
||||
->addColumn('my_payment_methods', function (User $user) {
|
||||
$payment_methods = json_encode($user->payment_methods);
|
||||
$link = '<a href="#" data-toggle="modal" data-target="#modals-payment_methods" data-id="'.$user->id.'" data-email="'.$user->email.'" data-payment_methods="'.htmlspecialchars($payment_methods).'">';
|
||||
|
|
|
|||
200
app/Http/Controllers/Evo/SalesController.php
Executable file
200
app/Http/Controllers/Evo/SalesController.php
Executable file
|
|
@ -0,0 +1,200 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers\Evo;
|
||||
use Auth;
|
||||
use Request;
|
||||
use App\User;
|
||||
use Carbon\Carbon;
|
||||
use App\Services\HTMLHelper;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Exports\UserTeamExport;
|
||||
use App\Models\ShoppingOrderItem;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Services\BusinessPlan\ExportBot;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
class SalesController extends Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->setFilterVars();
|
||||
$data = [
|
||||
'filter_months' => HTMLHelper::getTransMonths(),
|
||||
'filter_years' => HTMLHelper::getYearRange(2022),
|
||||
];
|
||||
return view('admin.evaluation.salesvolume', $data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function download(){
|
||||
|
||||
if(Request::get('action') === "export"){
|
||||
$objects = $this->initSearch(false);
|
||||
$columns = [];
|
||||
$filename = "gs-absatzmengen-".session('product_sales_vol_filter_month').'_'.session('product_sales_vol_filter_year')."-export";
|
||||
$headers = array(
|
||||
'#',
|
||||
'Produkt',
|
||||
'Artikelnummer',
|
||||
'Menge',
|
||||
|
||||
);
|
||||
if($objects){
|
||||
foreach ($objects as $key => $obj){
|
||||
$columns[] = array(
|
||||
'id' => $key,
|
||||
'name' => $obj['name'],
|
||||
'number' => $obj['number'],
|
||||
'value' => $obj['value'],
|
||||
);
|
||||
}
|
||||
}
|
||||
return Excel::download(new UserTeamExport($columns, $headers), $filename.'.xls');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function setFilterVars(){
|
||||
|
||||
if(!session('product_sales_vol_filter_month')){
|
||||
session(['product_sales_vol_filter_month' => intval(date('m'))]);
|
||||
}
|
||||
if(!session('product_sales_vol_filter_year')){
|
||||
session(['product_sales_vol_filter_year' => intval(date('Y'))]);
|
||||
}
|
||||
|
||||
if(Request::get('product_sales_vol_filter_month')){
|
||||
session(['product_sales_vol_filter_month' => Request::get('product_sales_vol_filter_month')]);
|
||||
}
|
||||
if(Request::get('product_sales_vol_filter_year')){
|
||||
session(['product_sales_vol_filter_year' => Request::get('product_sales_vol_filter_year')]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function initSearch($returnColl = true)
|
||||
{
|
||||
$this->setFilterVars();
|
||||
|
||||
$date_start = Carbon::parse('01.'.session('product_sales_vol_filter_month').'.'.session('product_sales_vol_filter_year'))->format('Y-m-d H:i:s');
|
||||
$date_end = Carbon::parse('01.'.session('product_sales_vol_filter_month').'.'.session('product_sales_vol_filter_year'))->endOfMonth()->format('Y-m-d H:i:s');
|
||||
|
||||
$ShoppingOrders = ShoppingOrder::where('paid', 1)->where('mode', 'live')->whereBetween('created_at', [$date_start, $date_end])->get();
|
||||
|
||||
$objects = [];
|
||||
foreach($ShoppingOrders as $ShoppingOrder){
|
||||
foreach($ShoppingOrder->shopping_order_items as $shopping_order_item){
|
||||
|
||||
if($shopping_order_item->product){
|
||||
if(isset($objects[$shopping_order_item->product->id])){
|
||||
$value = intval($objects[$shopping_order_item->product->id]['value'] + $shopping_order_item->qty);
|
||||
$objects[$shopping_order_item->product->id]['value'] = $value;
|
||||
}else{
|
||||
$objects[$shopping_order_item->product->id] = [
|
||||
'name' => $shopping_order_item->product->name,
|
||||
'number' => $shopping_order_item->product->number,
|
||||
'value' => $shopping_order_item->qty
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if($returnColl){
|
||||
$collection = collect();
|
||||
|
||||
foreach($objects as $key => $obj){
|
||||
$collection->push([
|
||||
'id' => $key,
|
||||
'name' => $obj['name'],
|
||||
'number' => $obj['number'],
|
||||
'value' => $obj['value'],
|
||||
]);
|
||||
}
|
||||
return $collection;
|
||||
}
|
||||
return $objects;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function datatable(){
|
||||
|
||||
$collection = $this->initSearch(true);
|
||||
|
||||
$collect = collect([
|
||||
['id' => 1, 'name' => 'John', 'number'=>92012, 'value'=>123],
|
||||
['id' => 2, 'name' => 'Jane', 'number'=>92012, 'value'=>123],
|
||||
['id' => 3, 'name' => 'James', 'number'=>92012, 'value'=>123],
|
||||
]);
|
||||
|
||||
return \DataTables::of($collection)->toJson();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*private function testCheckFunction(){
|
||||
|
||||
//$date_start = Carbon::parse('01.'.session('product_sales_vol_filter_month').'.'.session('product_sales_vol_filter_year'))->format('Y-m-d');
|
||||
//$date_end = Carbon::parse('01.'.session('product_sales_vol_filter_month').'.'.session('product_sales_vol_filter_year'))->endOfMonth()->format('Y-m-d');
|
||||
|
||||
$date_start = Carbon::parse('01.01.2024')->format('Y-m-d H:i:s');
|
||||
$date_end = Carbon::parse('01.01.2024')->endOfMonth()->format('Y-m-d H:i:s');
|
||||
dump($date_start);
|
||||
dump($date_end);
|
||||
|
||||
$ShoppingOrders = ShoppingOrder::where('mode', 'live')->whereBetween('created_at', [$date_start, $date_end])->get();
|
||||
|
||||
$objects = [];
|
||||
$counter = 0;
|
||||
foreach($ShoppingOrders as $ShoppingOrder){
|
||||
foreach($ShoppingOrder->shopping_order_items as $shopping_order_item){
|
||||
|
||||
if($shopping_order_item->product){
|
||||
if($shopping_order_item->product->id === 122){
|
||||
//dump($shopping_order_item->qty);
|
||||
//$counter += $shopping_order_item->qty;
|
||||
if(isset($objects[$shopping_order_item->product->id])){
|
||||
$value = intval($objects[$shopping_order_item->product->id]['value'] + $shopping_order_item->qty);
|
||||
$objects[$shopping_order_item->product->id]['value'] = $value;
|
||||
}else{
|
||||
$objects[$shopping_order_item->product->id] = [
|
||||
'name' => $shopping_order_item->product->name,
|
||||
'number' => $shopping_order_item->product->number,
|
||||
'value' => $shopping_order_item->qty
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$ShoppingOrderItems = ShoppingOrderItem::whereProductId(122)->whereBetween('created_at', [$date_start, $date_end])->get();
|
||||
$counter = 0;
|
||||
foreach($ShoppingOrderItems as $ShoppingOrderItem){
|
||||
$counter += $ShoppingOrderItem->qty;
|
||||
dump($ShoppingOrderItem->id);
|
||||
}
|
||||
// dump($objects);
|
||||
dump($counter);
|
||||
dd("OKAY");
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -47,46 +47,56 @@ class FileController extends Controller
|
|||
$this->isPermission($shopping_order->auth_user_id);
|
||||
$filename = Invoice::getFilename($shopping_order);
|
||||
$path = Invoice::getDownloadPath($shopping_order);
|
||||
if (!Storage::disk('public')->exists($path)) {
|
||||
return Response::make('File no found.', 404);
|
||||
}
|
||||
$file = Storage::disk('public')->get($path);
|
||||
$type = Storage::disk('public')->mimeType($path);
|
||||
|
||||
if($do === 'download'){
|
||||
|
||||
if ($disk === 'delivery'){
|
||||
$shopping_order = \App\Models\ShoppingOrder::findOrFail($id);
|
||||
$this->isPermission($shopping_order->auth_user_id);
|
||||
$filename = Invoice::getDeliveryFilename($shopping_order);
|
||||
$path = Invoice::getDownloadPathDelivery($shopping_order);
|
||||
}
|
||||
|
||||
if ($disk === 'invoice_delivery'){
|
||||
$shopping_order = \App\Models\ShoppingOrder::findOrFail($id);
|
||||
$this->isPermission($shopping_order->auth_user_id);
|
||||
|
||||
$ifilename = Invoice::getFilename($shopping_order);
|
||||
$ipath = Invoice::getDownloadPath($shopping_order, true);
|
||||
$dfilename = Invoice::getDeliveryFilename($shopping_order);
|
||||
$dpath = Invoice::getDownloadPathDelivery($shopping_order, true);
|
||||
|
||||
$oMerger = new \App\Services\PDFMerger();
|
||||
$oMerger->init();
|
||||
|
||||
$oMerger->addPDF($ipath);
|
||||
$oMerger->addPDF($dpath);
|
||||
$filename = str_replace('Rechnung-', 'Rechnung-Lieferschein-', $ifilename);
|
||||
$oMerger->setFileName($filename);
|
||||
$oMerger->merge();
|
||||
$file = $oMerger->output();
|
||||
return Response::make($file, 200)
|
||||
->header("Content-Type", $type)
|
||||
->header("Content-Type", 'application/pdf')
|
||||
->header('Content-disposition', 'attachment; filename="'.$filename.'"');
|
||||
/* $full_path = Invoice::getDownloadPath($shopping_order, true);
|
||||
$he
|
||||
if (file_exists($full_path)) {
|
||||
return Response::download($full_path, $filename);
|
||||
}*/
|
||||
}
|
||||
if($do === 'stream'){
|
||||
return Response::make($file, 200)
|
||||
->header("Content-Type", $type)
|
||||
->header('Content-disposition','filename="'.$filename.'"');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($disk === 'credit'){
|
||||
$UserCredit = \App\Models\UserCredit::findOrFail($id);
|
||||
$this->isPermission($UserCredit->auth_user_id);
|
||||
|
||||
$filename = Credit::getFilename($UserCredit);
|
||||
$path = Credit::getDownloadPath($UserCredit);
|
||||
}
|
||||
|
||||
if (!Storage::disk('public')->exists($path)) {
|
||||
return Response::make('File no found.', 404);
|
||||
}
|
||||
|
||||
$file = Storage::disk('public')->get($path);
|
||||
$type = Storage::disk('public')->mimeType($path);
|
||||
$mime = Storage::disk('public')->mimeType($path);
|
||||
|
||||
if($do === 'download'){
|
||||
return Response::make($file, 200)
|
||||
->header("Content-Type", $type)
|
||||
->header("Content-Type", $mime)
|
||||
->header('Content-disposition', 'attachment; filename="'.$filename.'"');
|
||||
/* $full_path = Invoice::getDownloadPath($shopping_order, true);
|
||||
$he
|
||||
|
|
@ -96,11 +106,29 @@ class FileController extends Controller
|
|||
}
|
||||
if($do === 'stream'){
|
||||
return Response::make($file, 200)
|
||||
->header("Content-Type", $type)
|
||||
->header("Content-Type", $mime)
|
||||
->header('Content-disposition','filename="'.$filename.'"');
|
||||
}
|
||||
|
||||
if($do === 'file'){
|
||||
return Response::make($file, 200)
|
||||
->header("Content-Type", $mime)
|
||||
->header('Content-disposition', 'filename="'.$filename.'"');
|
||||
}
|
||||
if($do === 'image'){
|
||||
return Response::make($file, 200)
|
||||
->header("Content-Type", $mime);
|
||||
}
|
||||
if($do === 'pdf'){
|
||||
$path = storage_path().'/app/public/' . $path;
|
||||
$headers = array(
|
||||
'Content-Type:'. $mime,
|
||||
// 'Content-Length: ' . $file->size
|
||||
// 'Content-Disposition: ' . $stream . '; filename=' . $file->original_name
|
||||
);
|
||||
return Response::download($path, $filename, $headers);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -90,34 +90,7 @@ class HomeController extends Controller
|
|||
}
|
||||
|
||||
|
||||
public function verify($confirmation_code){
|
||||
if( ! $confirmation_code)
|
||||
{
|
||||
return redirect('/status/error');
|
||||
}
|
||||
|
||||
$user = User::whereConfirmationCode($confirmation_code)->first();
|
||||
|
||||
if ( ! $user)
|
||||
{
|
||||
return redirect('/status/not/found');
|
||||
}
|
||||
if($user->confirmed === 0){
|
||||
$user->confirmed = 1;
|
||||
//kill after wizzard!
|
||||
// $user->confirmation_code = null;
|
||||
// $user->confirmation_code_to = null;
|
||||
// $user->confirmation_code_remider = 0;
|
||||
$user->confirmation_date = now();
|
||||
}
|
||||
|
||||
$user->save();
|
||||
|
||||
//Login!
|
||||
Auth::login($user);
|
||||
|
||||
return redirect('/home');
|
||||
}
|
||||
|
||||
public function statusRegister(){
|
||||
return view('status.status_register');
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ class ImportProductController extends Controller
|
|||
|
||||
ProductImage::create([
|
||||
'product_id' => $product->id,
|
||||
'type' => 'product', // 'product',
|
||||
'filename' => $name,
|
||||
'original_name' => $original_name,
|
||||
'ext' => $ext,
|
||||
|
|
|
|||
|
|
@ -2,20 +2,23 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Exports\ExcelExport;
|
||||
use Request;
|
||||
use App\User;
|
||||
use Validator;
|
||||
use App\Services\SysLog;
|
||||
use App\Models\UserAccount;
|
||||
use App\Models\UserHistory;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Services\UserService;
|
||||
use App\Mail\MailAccountActive;
|
||||
use App\Mail\MailCustomMessage;
|
||||
use App\Mail\MailVerifyAccount;
|
||||
use App\Mail\MailVerifyContact;
|
||||
use App\Mail\MailAccountActive;
|
||||
use App\Models\UserAccount;
|
||||
use App\Models\UserHistory;
|
||||
use App\Repositories\ContractPDFRepository;
|
||||
use App\Models\UserWhitelabelProduct;
|
||||
use App\Repositories\UserRepository;
|
||||
use App\Services\SysLog;
|
||||
use App\Services\UserService;
|
||||
use App\User;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Request;
|
||||
use Validator;
|
||||
use App\Repositories\ContractPDFRepository;
|
||||
|
||||
class LeadController extends Controller
|
||||
{
|
||||
|
|
@ -33,13 +36,14 @@ class LeadController extends Controller
|
|||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->setFilterVars();
|
||||
$data = [
|
||||
'values' => User::where('admin', '=', 0)->where('confirmation_code_remider', '!=', 2)->get(),
|
||||
|
||||
];
|
||||
return view('admin.lead.index', $data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
|
|
@ -122,6 +126,17 @@ class LeadController extends Controller
|
|||
|
||||
$data = Request::all();
|
||||
$show = Request::get('show');
|
||||
|
||||
if(isset($data['action']) && $data['action'] == "reverse_charge_validate" && isset($data['user_id'])){
|
||||
$user = User::findOrFail($data['user_id']);
|
||||
return $this->userRepo->reverse_charge_validate($data, $user, route('admin_lead_edit', [$user->id]));
|
||||
}
|
||||
|
||||
if(isset($data['action']) && $data['action'] == "reverse_charge_delete" && isset($data['user_id'])){
|
||||
$user = User::findOrFail($data['user_id']);
|
||||
return $this->userRepo->reverse_charge_delete($data, $user, route('admin_lead_edit', [$user->id]));
|
||||
}
|
||||
|
||||
if ($data['user_id'] === "new" || $data['user_id'] == 0) {
|
||||
$rules = array(
|
||||
'salutation' => 'required',
|
||||
|
|
@ -187,6 +202,7 @@ class LeadController extends Controller
|
|||
if(isset($data['m_data_edit']) && $data['m_data_edit'] === "TSOK"){
|
||||
$user = $this->userRepo->getModel();
|
||||
$user->m_level = isset($data['m_level']) ? $data['m_level'] : NULL;
|
||||
$user->lead_type_id = isset($data['lead_type_id']) ? $data['lead_type_id'] : NULL;
|
||||
$user->m_sponsor = isset($data['m_sponsor']) ? $data['m_sponsor'] : NULL;
|
||||
$user->save();
|
||||
}
|
||||
|
|
@ -215,6 +231,227 @@ class LeadController extends Controller
|
|||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function update()
|
||||
{
|
||||
$data = Request::all();
|
||||
$show = Request::get('show');
|
||||
if(!isset($data['user_id']) || $data['user_id'] === "new" || $data['user_id'] == 0){
|
||||
abort(404, 'User not found');
|
||||
}
|
||||
$user = User::findOrFail($data['user_id']);
|
||||
|
||||
if(isset($data['action'])){
|
||||
|
||||
//add whitelabel products
|
||||
if($data['action'] === 'add_whitelabel_products'){
|
||||
if(isset($data['whitelabel_products']) && is_array($data['whitelabel_products'])){
|
||||
foreach ($data['whitelabel_products'] as $product_id){
|
||||
$user->whitelabel_products()->create(['product_id' => $product_id]);
|
||||
}
|
||||
}
|
||||
\Session()->flash('alert-save', true);
|
||||
}
|
||||
//remove whitelabel products
|
||||
if($data['action'] === 'remove_whitelabel_products'){
|
||||
if(isset($data['whitelabel_products']) && is_array($data['whitelabel_products'])){
|
||||
$user->whitelabel_products()->whereIn('product_id', $data['whitelabel_products'])->delete();
|
||||
}
|
||||
\Session()->flash('alert-success', "Produkt gelöscht");
|
||||
}
|
||||
if($data['action'] === 'upload_white_label_image'){
|
||||
//id == user_whitelabel_product_id
|
||||
$whitelabel_product = UserWhitelabelProduct::findOrFail($data['id']);
|
||||
if($whitelabel_product && $user->id == $whitelabel_product->user_id){
|
||||
return \App\Services\ProductImage::imageUpload('user_wl_product', $whitelabel_product, Request::get('upload_type'));
|
||||
}
|
||||
}
|
||||
//update whitelabel products
|
||||
if($data['action'] === 'update_whitelabel_products'){
|
||||
if(isset($data['image_wl_attributes']) && is_array($data['image_wl_attributes'])){
|
||||
foreach ( $user->whitelabel_products as $wl_product){
|
||||
foreach ($wl_product->whitelabel_images as $wl_image) {
|
||||
$wl_image->update([
|
||||
'attributes' => isset($data['image_wl_attributes'][$wl_image->id]) ? $data['image_wl_attributes'][$wl_image->id] : NULL,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
\Session()->flash('alert-save', true);
|
||||
}
|
||||
}
|
||||
return redirect(route('admin_lead_edit', [$user->id])."?show=".$show);
|
||||
}
|
||||
|
||||
public function remove($action, $user_id, $id, $mid=null){
|
||||
$show = Request::get('show');
|
||||
$user = User::findOrFail($user_id);
|
||||
|
||||
if($action === 'remove_whitelabel_label'){
|
||||
$model = $user->whitelabel_products()->where('id', $id)->first();
|
||||
return \App\Services\ProductImage::imageDelete('user_wl_image', $model, $mid);
|
||||
}
|
||||
|
||||
if($action === 'remove_whitelabel_product'){
|
||||
|
||||
$model = $user->whitelabel_products()->where('id', $id)->first();
|
||||
//remove images
|
||||
foreach ($model->whitelabel_images as $image){
|
||||
\App\Services\ProductImage::imageDelete('user_wl_image', $model, $image->id);
|
||||
|
||||
}
|
||||
$model->delete();
|
||||
\Session()->flash('alert-success', "White Label Produkt entfernt");
|
||||
return redirect(route('admin_lead_edit', [$user->id])."?show=$show");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function download(){
|
||||
|
||||
if(Request::get('action') === "export"){
|
||||
$query = $this->initSearch();
|
||||
$columns = [];
|
||||
$filename = "GS-VP-export-".date("d-m-Y");
|
||||
$headers = array(
|
||||
'ID',
|
||||
'Email',
|
||||
'Firma',
|
||||
'Anrede',
|
||||
'Vorname',
|
||||
'Nachname',
|
||||
'Mitglied',
|
||||
'Bis',
|
||||
'Art',
|
||||
|
||||
);
|
||||
$objects = $query->get();
|
||||
if($objects){
|
||||
foreach ($objects as $obj){
|
||||
$columns[] = array(
|
||||
'ID' => $obj->id,
|
||||
'Email' => $obj->email,
|
||||
'Firma' => $obj->account ? $obj->account->company : '',
|
||||
'Anrede' => $obj->account ? ($obj->account->salutation == 'mr' ? 'Herr' : 'Frau') : '-',
|
||||
'Vorname' => $obj->account ? $obj->account->first_name : '',
|
||||
'Nachname' => $obj->account ? $obj->account->last_name : '',
|
||||
'Mitglied' => $obj->payment_account ? ($obj->isActiveAccount() ? 'JA' : 'Abgelaufen') : "Nein",
|
||||
'Bis' => $obj->payment_account ? $obj->getPaymentAccountDateFormat(false) : '-',
|
||||
'Art' => $obj->lead_type ? $obj->lead_type->name : '-',
|
||||
);
|
||||
}
|
||||
}
|
||||
return Excel::download(new ExcelExport($columns, $headers), $filename.'.xls');
|
||||
}
|
||||
}
|
||||
|
||||
private function setFilterVars(){
|
||||
if(!session('filter_lead_type_id')){
|
||||
session(['filter_lead_type_id' => 'all']);
|
||||
}
|
||||
if(Request::get('filter_lead_type_id')){
|
||||
session(['filter_lead_type_id' => Request::get('filter_lead_type_id')]);
|
||||
}
|
||||
}
|
||||
|
||||
private function initSearch(){
|
||||
$this->setFilterVars();
|
||||
$query = User::with('account')->select('users.*')->where('users.deleted_at', '=', null)->where('users.admin', "<", 4);
|
||||
if(session('filter_lead_type_id') && session('filter_lead_type_id') !== null && session('filter_lead_type_id') !== "all"){
|
||||
$query->where('lead_type_id', session('filter_lead_type_id'));
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function getLeads()
|
||||
{
|
||||
$query = $this->initSearch();
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('first_name', function (User $user) {
|
||||
return $user->account ? $user->account->first_name : '';
|
||||
})
|
||||
->addColumn('company', function (User $user) {
|
||||
return $user->account ? $user->account->company : '';
|
||||
})
|
||||
->addColumn('last_name', function (User $user) {
|
||||
return $user->account ? $user->account->last_name : '';
|
||||
})
|
||||
->addColumn('user_level', function (User $user) {
|
||||
return $user->user_level ? $user->user_level->name : '';
|
||||
})
|
||||
->addColumn('lead_type', function (User $user) {
|
||||
return $user->lead_type ? $user->lead_type->name : '';
|
||||
})
|
||||
->addColumn('id', function (User $user) {
|
||||
return '<a href="' . route('admin_lead_edit', [$user->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="far fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('confirmed', function (User $user) {
|
||||
return $user->confirmed ? '<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('active', function (User $user) {
|
||||
return $user->active ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('agreement', function (User $user) {
|
||||
return $user->agreement ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('payment_account', function (User $user) {
|
||||
return $user->payment_account ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('payment_account_date', function (User $user) {
|
||||
return $user->payment_account ? $user->getPaymentAccountDateFormat(false) : "-";
|
||||
})
|
||||
/*->addColumn('payment_shop', function (User $user) {
|
||||
return $user->payment_shop ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('payment_shop_date', function (User $user) {
|
||||
return $user->payment_shop ? $user->getPaymentShopDateFormat(false) : "-";
|
||||
})*/
|
||||
->addColumn('turnover', function (User $user) {
|
||||
return "-";
|
||||
})
|
||||
->addColumn('sales_total', function (User $user) {
|
||||
return "-";
|
||||
})
|
||||
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('confirmed', 'confirmed $1')
|
||||
->orderColumn('active', 'active $1')
|
||||
->orderColumn('lead_type', 'lead_type_id $1')
|
||||
->orderColumn('agreement', 'agreement $1')
|
||||
->orderColumn('payment_account', 'payment_account $1')
|
||||
//->orderColumn('payment_shop', 'payment_shop $1')
|
||||
->rawColumns(['id', 'confirmed', 'active', 'agreement', 'payment_account'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
private function activeAccountPayment($user){
|
||||
|
||||
if($user->user_level){
|
||||
if($user->user_level->payment_year){
|
||||
//if true = payments
|
||||
$user->wizard = 20;
|
||||
$user->active = 1;
|
||||
$user->active_date = now();
|
||||
$user->confirmation_code = null;
|
||||
$user->confirmation_code_to = null;
|
||||
$user->confirmation_code_remider = 0;
|
||||
$user->save();
|
||||
}else{
|
||||
//if false = no payments for 1 year
|
||||
$user->wizard = 100;
|
||||
$user->payment_account = \Carbon::now()->modify('1 year');
|
||||
$user->active = 1;
|
||||
$user->active_date = now();
|
||||
$user->confirmation_code = null;
|
||||
$user->confirmation_code_to = null;
|
||||
$user->confirmation_code_remider = 0;
|
||||
$user->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//user released when register is complete
|
||||
public function released($action, $id){
|
||||
|
||||
|
|
@ -299,7 +536,7 @@ class LeadController extends Controller
|
|||
\Session()->flash('alert-success', "E-Mail an Vertriebspartner gesendet.");
|
||||
}
|
||||
if($action === 'reset_switch'){
|
||||
$user->wizard = 4;
|
||||
$user->wizard = 3;
|
||||
$user->save();
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>'reset_switch', 'status'=>0]);
|
||||
\Session()->flash('alert-success', "Vertriebspartner zurückgesetzt!");
|
||||
|
|
@ -353,7 +590,9 @@ class LeadController extends Controller
|
|||
|
||||
|
||||
//send new verfified mail to user
|
||||
public function newMailVerified($id){
|
||||
/* public function newMailVerified($id){
|
||||
|
||||
User Register sind in der DB UserRegister, erst bei bestätigung wird es in die User DB übertragen
|
||||
|
||||
$user = User::findOrFail($id);
|
||||
|
||||
|
|
@ -378,7 +617,7 @@ class LeadController extends Controller
|
|||
\Session()->flash('alert-success', "E-Mail erneut gesendet");
|
||||
return redirect(route('admin_lead_edit', [$user->id]));
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
public function deleteFile($user_id, $file_id, $relation){
|
||||
|
||||
|
|
@ -392,89 +631,4 @@ class LeadController extends Controller
|
|||
}
|
||||
return back();
|
||||
}
|
||||
|
||||
public function getLeads()
|
||||
{
|
||||
|
||||
$query = User::with('account')->select('users.*')->where('users.deleted_at', '=', null)->where('users.admin', "<", 4);
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('first_name', function (User $user) {
|
||||
return $user->account ? $user->account->first_name : '';
|
||||
})
|
||||
->addColumn('company', function (User $user) {
|
||||
return $user->account ? $user->account->company : '';
|
||||
})
|
||||
->addColumn('last_name', function (User $user) {
|
||||
return $user->account ? $user->account->last_name : '';
|
||||
})
|
||||
->addColumn('user_level', function (User $user) {
|
||||
return $user->user_level ? $user->user_level->name : '';
|
||||
})
|
||||
->addColumn('id', function (User $user) {
|
||||
return '<a href="' . route('admin_lead_edit', [$user->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="far fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('confirmed', function (User $user) {
|
||||
return $user->confirmed ? '<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('active', function (User $user) {
|
||||
return $user->active ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('agreement', function (User $user) {
|
||||
return $user->agreement ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('payment_account', function (User $user) {
|
||||
return $user->payment_account ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('payment_account_date', function (User $user) {
|
||||
return $user->payment_account ? $user->getPaymentAccountDateFormat(false) : "-";
|
||||
})
|
||||
/*->addColumn('payment_shop', function (User $user) {
|
||||
return $user->payment_shop ? ' <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('payment_shop_date', function (User $user) {
|
||||
return $user->payment_shop ? $user->getPaymentShopDateFormat(false) : "-";
|
||||
})*/
|
||||
->addColumn('turnover', function (User $user) {
|
||||
return "-";
|
||||
})
|
||||
->addColumn('sales_total', function (User $user) {
|
||||
return "-";
|
||||
})
|
||||
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('confirmed', 'confirmed $1')
|
||||
->orderColumn('active', 'active $1')
|
||||
->orderColumn('agreement', 'agreement $1')
|
||||
->orderColumn('payment_account', 'payment_account $1')
|
||||
//->orderColumn('payment_shop', 'payment_shop $1')
|
||||
->rawColumns(['id', 'confirmed', 'active', 'agreement', 'payment_account'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
private function activeAccountPayment($user){
|
||||
|
||||
if($user->user_level){
|
||||
if($user->user_level->payment_year){
|
||||
//if true = payments
|
||||
$user->wizard = 20;
|
||||
$user->active = 1;
|
||||
$user->active_date = now();
|
||||
$user->confirmation_code = null;
|
||||
$user->confirmation_code_to = null;
|
||||
$user->confirmation_code_remider = 0;
|
||||
$user->save();
|
||||
}else{
|
||||
//if false = no payments for 1 year
|
||||
$user->wizard = 100;
|
||||
$user->payment_account = \Carbon::now()->modify('1 year');
|
||||
$user->active = 1;
|
||||
$user->active_date = now();
|
||||
$user->confirmation_code = null;
|
||||
$user->confirmation_code_to = null;
|
||||
$user->confirmation_code_remider = 0;
|
||||
$user->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
47
app/Http/Controllers/LeadTypeController.php
Normal file
47
app/Http/Controllers/LeadTypeController.php
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
|
||||
use App\Models\LeadType;
|
||||
use Request;
|
||||
|
||||
|
||||
class LeadTypeController extends Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$data = [
|
||||
'values' => LeadType::all(),
|
||||
];
|
||||
return view('admin.lead.types', $data);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
|
||||
$data = Request::all();
|
||||
if($data['id'] === "new"){
|
||||
$model = LeadType::create([
|
||||
'name' => $data['name'],
|
||||
'active' => isset($data['active']) ? true : false,
|
||||
]);
|
||||
}else{
|
||||
$model = LeadType::find($data['id']);
|
||||
$model->name = $data['name'];
|
||||
$model->active = isset($data['active']) ? true : false;
|
||||
$model->save();
|
||||
}
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('admin_lead_types'));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -99,6 +99,17 @@ class MembershipController extends Controller
|
|||
$image = $product->images->first()->slug;
|
||||
}
|
||||
$qty = Request::get('qty') ? Request::get('qty') : 1;
|
||||
|
||||
/* //need setGlobalTaxRate
|
||||
|
||||
$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]);
|
||||
if(\App\Services\UserService::getTaxFree()){
|
||||
Yard::setTax($cartItem->rowId, 0);
|
||||
}else{
|
||||
Yard::setTax($cartItem->rowId, $product->getTaxWith(\App\Services\UserService::$user_country));
|
||||
}
|
||||
*/
|
||||
//Keine steuer
|
||||
Yard::instance('shopping')->add($product->id, $product->getLang('name'), $qty, $product->price, $product->tax, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight]);
|
||||
Yard::instance('shopping')->setGlobalTaxRate(0);
|
||||
/*
|
||||
|
|
@ -161,6 +172,8 @@ class MembershipController extends Controller
|
|||
if($action === "change_level"){
|
||||
if(Request::get('switchers-package-level')){
|
||||
$user = User::find(Auth::user()->id);
|
||||
//hier wird die nächste Mitgliedschaftsstufe gesetzt
|
||||
//wird im Cronjob UserCheckPaymentsAccounts.php verwendet und gesetzt
|
||||
$user->next_m_level = Request::get('switchers-package-level');
|
||||
$user->save();
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>$action, 'status'=>10, 'referenz'=>Request::get('switchers-package-level')]);
|
||||
|
|
|
|||
|
|
@ -177,11 +177,18 @@ class PayController extends Controller
|
|||
]);
|
||||
//paypal
|
||||
if($this->payment_method === 'pp'){
|
||||
switch ($payment_for) {
|
||||
case 7: //promotion
|
||||
$paypal = new PayPalController;
|
||||
$redirect = $paypal->payment($this->shopping_payment, $payt, $identifier, $this->shopping_order->promotion_user_id);
|
||||
$redirect = $paypal->payment($this->shopping_payment, $payt, $identifier, $payment_for, $this->shopping_order->promotion_user_id);
|
||||
Util::setUserHistoryValue(['status'=>4], $identifier);
|
||||
return $redirect;
|
||||
|
||||
case 8: //shop
|
||||
$paypal = new PayPalController;
|
||||
$redirect = $paypal->payment($this->shopping_payment, $payt, $identifier, $payment_for, $this->shopping_order->user_shop_id);
|
||||
Util::setUserHistoryValue(['status'=>4], $identifier);
|
||||
return $redirect;
|
||||
}
|
||||
}
|
||||
|
||||
Util::setUserHistoryValue(['status'=>5], $identifier);
|
||||
|
|
@ -189,6 +196,9 @@ class PayController extends Controller
|
|||
case 7: //promotion
|
||||
return redirect(route('web_promotion_goto', ['thanksorder', $this->shopping_order->promotion_user_id, $payt->id, $this->reference, $identifier]));
|
||||
break;
|
||||
case 8: //shop
|
||||
return redirect(route('web_shop_goto', ['thanksorder', $this->shopping_order->user_shop_id, $payt->id, $this->reference, $identifier]));
|
||||
break;
|
||||
|
||||
default:
|
||||
return redirect(route('user_checkout_final', [$payt->id, $this->reference, $identifier]));
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
namespace App\Http\Controllers\Pay;
|
||||
use Request;
|
||||
use App\Models\UserShop;
|
||||
use App\Models\PromotionUser;
|
||||
use App\Models\PaymentTransaction;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
|
@ -12,7 +13,7 @@ use Srmklive\PayPal\Services\PayPal as PayPalClient;
|
|||
class PayPalController extends Controller
|
||||
{
|
||||
|
||||
public function payment($shopping_payment, $payt, $identifier, $promotion_user_id)
|
||||
public function payment($shopping_payment, $payt, $identifier, $payment_for, $payment_for_user_id)
|
||||
{
|
||||
$provider = new PayPalClient;
|
||||
// Through facade. No need to import namespaces
|
||||
|
|
@ -36,8 +37,8 @@ class PayPalController extends Controller
|
|||
]
|
||||
],
|
||||
'application_context' => [
|
||||
'cancel_url' => route('cancel.paypal_payment', [$promotion_user_id, $payt->id, $shopping_payment->reference, $identifier]),
|
||||
'return_url' => route('success.paypal_payment', [$promotion_user_id, $payt->id, $shopping_payment->reference, $identifier])
|
||||
'cancel_url' => route('cancel.paypal_payment', [$payment_for, $payment_for_user_id, $payt->id, $shopping_payment->reference, $identifier]),
|
||||
'return_url' => route('success.paypal_payment', [$payment_for, $payment_for_user_id, $payt->id, $shopping_payment->reference, $identifier])
|
||||
]
|
||||
|
||||
]);
|
||||
|
|
@ -47,9 +48,8 @@ class PayPalController extends Controller
|
|||
|
||||
}
|
||||
|
||||
public function paymentSuccess($id, $transactionId=false, $reference=false, $identifier=false)
|
||||
public function paymentSuccess($payment_for, $id, $transactionId=false, $reference=false, $identifier=false)
|
||||
{
|
||||
$PromotionUser = PromotionUser::findOrFail($id);
|
||||
$payt = PaymentTransaction::findOrFail($transactionId);
|
||||
if($payt->shopping_payment->reference != $reference){
|
||||
abort(404);
|
||||
|
|
@ -74,19 +74,37 @@ class PayPalController extends Controller
|
|||
}
|
||||
$payt->request = $order['status'];
|
||||
$payt->save();
|
||||
return redirect(route('web_promotion_goto', ['thanksorder', $id, $payt->id, $reference, $identifier]));
|
||||
|
||||
}
|
||||
|
||||
public function paymentCancel($id, $transactionId=false, $reference=false, $identifier=false)
|
||||
{
|
||||
switch ($payment_for) {
|
||||
case 7: //promotion
|
||||
$PromotionUser = PromotionUser::findOrFail($id);
|
||||
|
||||
return redirect(url($PromotionUser->url));
|
||||
return redirect(route('web_promotion_goto', ['thanksorder', $id, $payt->id, $reference, $identifier]));
|
||||
case 8: //shop
|
||||
$userShop = UserShop::findOrFail($id);
|
||||
return redirect(route('web_shop_goto', ['thanksorder', $id, $payt->id, $reference, $identifier]));
|
||||
dd('Your payment has been declend. The payment cancelation page goes here!');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function paymentCancel($payment_for, $id, $transactionId=false, $reference=false, $identifier=false)
|
||||
{
|
||||
switch ($payment_for) {
|
||||
case 7: //promotion
|
||||
$PromotionUser = PromotionUser::findOrFail($id);
|
||||
return redirect(url($PromotionUser->url));
|
||||
dd('Your payment has been declend. The payment cancelation page goes here!');
|
||||
case 8: //shop
|
||||
$userShop = UserShop::findOrFail($id);
|
||||
return redirect(url($userShop->url));
|
||||
dd('Your payment has been declend. The payment cancelation page goes here!');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,17 +4,18 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Models\UserCreditMargin as ModelsUserCreditMargin;
|
||||
use Carbon;
|
||||
use Request;
|
||||
use App\User;
|
||||
use App\Services\Util;
|
||||
use App\Services\Credit;
|
||||
use App\Services\Payment;
|
||||
use App\Models\UserCredit;
|
||||
use App\Models\ShoppingOrderMargin;
|
||||
use App\Models\UserCredit;
|
||||
use App\Models\UserCreditMargin;
|
||||
use App\Repositories\CreditRepository;
|
||||
use App\Services\Credit;
|
||||
use App\Services\Payment;
|
||||
use App\Services\Payment\UserBot;
|
||||
use App\Services\Util;
|
||||
use App\User;
|
||||
use Carbon;
|
||||
use Illuminate\Support\Collection;
|
||||
use Request;
|
||||
|
||||
class PaymentCreditController extends Controller
|
||||
{
|
||||
|
|
@ -23,10 +24,12 @@ class PaymentCreditController extends Controller
|
|||
private $endYear;
|
||||
private $rangeYears;
|
||||
private $activeYear;
|
||||
private $userBot;
|
||||
|
||||
public function __construct()
|
||||
public function __construct(UserBot $userBot)
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->userBot = $userBot;
|
||||
$this->startYear = 2021;
|
||||
$this->endYear = date('Y');
|
||||
$this->rangeYears = range($this->startYear, $this->endYear);
|
||||
|
|
@ -41,7 +44,11 @@ class PaymentCreditController extends Controller
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* fügt eine neue Manuelle Gutschrift hinzu
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function store(){
|
||||
$data = Request::all();
|
||||
|
||||
|
|
@ -64,7 +71,6 @@ class PaymentCreditController extends Controller
|
|||
|
||||
$credit = Util::reFormatNumber($data['credit']);
|
||||
$credit = number_format($credit, 2, '.', '');
|
||||
|
||||
Payment::addUserCreditMargin($user, $credit, 3, $data['message']);
|
||||
\Session()->flash('alert-success', "Guthaben hinzugefügt");
|
||||
}
|
||||
|
|
@ -72,6 +78,11 @@ class PaymentCreditController extends Controller
|
|||
return redirect(route('admin_payments_credit'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Erstellt eine neue komplette Gutschrift für einen Benutzer
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function create(){
|
||||
$data = Request::all();
|
||||
if(isset($data['action'])){
|
||||
|
|
@ -95,65 +106,18 @@ class PaymentCreditController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
private function makeData(){
|
||||
private function makeData(): array
|
||||
{
|
||||
$this->setActiveYears();
|
||||
//$date1 = Carbon::parse('01.01.'.$this->activeYear." 00:00:00")->format('Y-m-d H:i:s');
|
||||
//$date2 = Carbon::parse('31.12.'.$this->activeYear." 23:59:59")->toDateString();
|
||||
$this->userBot->readUserHasCredits();
|
||||
$this->userBot->readUserHasPendingCredit();
|
||||
|
||||
$ShoppingOrderMargins = ShoppingOrderMargin::join('users', 'm_sponsor_id', '=', 'users.id')
|
||||
->groupBy('m_sponsor_id')
|
||||
->join('user_accounts', 'account_id', '=', 'user_accounts.id')
|
||||
->select('users.id as user_id', 'users.email', 'user_accounts.first_name', 'user_accounts.last_name')
|
||||
->wherePaid(true)
|
||||
->whereCancellation(false)
|
||||
->wherePartnerCommissionPaid(false)
|
||||
->where('partner_commission_pending_to', '<', Carbon::now())
|
||||
->get();
|
||||
|
||||
$ShoppingOrderMarginPendings = ShoppingOrderMargin::join('users', 'm_sponsor_id', '=', 'users.id')
|
||||
->groupBy('m_sponsor_id')
|
||||
->join('user_accounts', 'account_id', '=', 'user_accounts.id')
|
||||
->select('users.id as user_id', 'users.email', 'user_accounts.first_name', 'user_accounts.last_name')
|
||||
->wherePaid(true)
|
||||
->whereCancellation(false)
|
||||
->wherePartnerCommissionPaid(false)
|
||||
->where('partner_commission_pending_to', '>=', Carbon::now())
|
||||
->get();
|
||||
|
||||
$UserCreditMargins = UserCreditMargin::wherePaid(false)->get();
|
||||
$ShoppingOrderMarginUserIds = ShoppingOrderMargin::select('m_sponsor_id')->groupBy('m_sponsor_id')
|
||||
->wherePaid(true)
|
||||
->whereCancellation(false)
|
||||
->wherePartnerCommissionPaid(false)
|
||||
->where('partner_commission_pending_to', '<', Carbon::now())
|
||||
->get()->pluck('m_sponsor_id')->toArray();
|
||||
|
||||
$onlyUserCreditMargins = [];
|
||||
foreach($UserCreditMargins as $key => $UserCreditMargin){
|
||||
if(!in_array($UserCreditMargin->user_id, $ShoppingOrderMarginUserIds)){
|
||||
if(isset($onlyUserCreditMargins[$UserCreditMargin->user_id])){
|
||||
$onlyUserCreditMargins[$UserCreditMargin->user_id]['sum'] += $UserCreditMargin->credit;
|
||||
$onlyUserCreditMargins[$UserCreditMargin->user_id]['entries'][$UserCreditMargin->id] = $UserCreditMargin;
|
||||
}else{
|
||||
$onlyUserCreditMargins[$UserCreditMargin->user_id] = [
|
||||
'user_id' => $UserCreditMargin->user->id,
|
||||
'first_name' => $UserCreditMargin->user->account->first_name,
|
||||
'last_name' => $UserCreditMargin->user->account->last_name,
|
||||
'email' => $UserCreditMargin->user->email,
|
||||
'sum' => $UserCreditMargin->credit,
|
||||
'entries' => [$UserCreditMargin->id => $UserCreditMargin],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
$data = [
|
||||
return [
|
||||
'years' => $this->rangeYears,
|
||||
'active_year' => $this->activeYear,
|
||||
'ShoppingOrderMargins' => $ShoppingOrderMargins,
|
||||
'ShoppingOrderMarginPendings' => $ShoppingOrderMarginPendings,
|
||||
'onlyUserCreditMargins' => $onlyUserCreditMargins,
|
||||
'users_credits' => $this->userBot->getUsers(),
|
||||
'users_credits_pending' => $this->userBot->getUsersPending(),
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function setActiveYears(){
|
||||
|
|
@ -173,19 +137,25 @@ class PaymentCreditController extends Controller
|
|||
\Session()->flash('alert-error', "Guthaben kann nicht gelöscht werden");
|
||||
}
|
||||
}
|
||||
if($del === 'shopping_order_margin'){
|
||||
$ShoppingOrderMargin = ShoppingOrderMargin::findOrFail($id);
|
||||
$ShoppingOrderMargin->out_paid = true;
|
||||
$ShoppingOrderMargin->save();
|
||||
\Session()->flash('alert-success', "Gutschrift ist gelöscht");
|
||||
}
|
||||
return redirect(route('admin_payments_credit'));
|
||||
}
|
||||
|
||||
public function datatable(){
|
||||
|
||||
$this->setActiveYears();
|
||||
$date1 = Carbon::parse('01.01.'.$this->activeYear)->format('Y-m-d');
|
||||
$date2 = Carbon::parse('31.12.'.$this->activeYear)->format('Y-m-d');
|
||||
$startDate = Carbon::parse("01.01.{$this->activeYear}")->format('Y-m-d');
|
||||
$endDate = Carbon::parse("31.12.{$this->activeYear}")->format('Y-m-d');
|
||||
|
||||
$query = UserCredit::with('user', 'user.account')->select('user_credits.*')
|
||||
//::with('shopping_user', )->select('shopping_orders.*')
|
||||
//->where('paid', '=', 1)
|
||||
->whereBetween('date', [$date1, $date2]);
|
||||
->whereBetween('date', [$startDate, $endDate]);
|
||||
//->orderBy('created_at', 'DESC');
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ class PaymentInvoiceController extends Controller
|
|||
return Payment::getShoppingOrderBadge($ShoppingOrder);
|
||||
})
|
||||
->addColumn('payment_for', function (ShoppingOrder $ShoppingOrder) {
|
||||
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getPaymentForColor().'">'.$ShoppingOrder->getPaymentForType().'</span>';
|
||||
return Payment::getPaymentForTypeBadge($ShoppingOrder);
|
||||
})
|
||||
->addColumn('invoice', function (ShoppingOrder $ShoppingOrder) {
|
||||
$ret = "";
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ namespace App\Http\Controllers;
|
|||
|
||||
|
||||
use App\Models\PaymentMethod;
|
||||
use App\Models\UserLevel;
|
||||
use Request;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -136,75 +136,16 @@ class ProductController extends Controller
|
|||
// Upload FILE -----------------------------------------------------------------------------------------------------------------------
|
||||
public function imageUpload(){
|
||||
|
||||
$product_id = Request::get('product_id');
|
||||
if(Request::has('product_id')){
|
||||
$product = Product::findOrFail(Request::get('product_id'));
|
||||
return \App\Services\ProductImage::imageUpload('product', $product, Request::get('upload_type'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function imageDelete($product_image_id, $product_id){
|
||||
$product = Product::findOrFail($product_id);
|
||||
|
||||
try {
|
||||
$image = \App\Services\Slim::getImages('images')[0];
|
||||
|
||||
if ( isset($image['output']['data']) )
|
||||
{
|
||||
|
||||
// Base64 of the image
|
||||
$data = $image['output']['data'];
|
||||
$file_ex = array( 'image/jpeg' => 'jpg', 'image/png' => 'png');
|
||||
|
||||
if (!isset($file_ex[$image['output']['type']])) {
|
||||
\Session()->flash('alert-danger', 'File is not jpg or png!');
|
||||
return redirect(route('admin_product_edit', [$product->id]));
|
||||
}
|
||||
|
||||
$ext = $file_ex[$image['output']['type']];
|
||||
// Original file name
|
||||
$name = $image['output']['name'];
|
||||
$name = \App\Services\Slim::sanitizeFileName($name);
|
||||
$name = uniqid() . '_' . $name;
|
||||
|
||||
$data = \Storage::disk('public')->put(
|
||||
'images/product/'.$product->id.'/'.$name,
|
||||
$data
|
||||
);
|
||||
|
||||
ProductImage::create([
|
||||
'product_id' => $product->id,
|
||||
'filename' => $name,
|
||||
'original_name' => $image['output']['name'],
|
||||
'ext' => $ext,
|
||||
'mine' => $image['output']['type'],
|
||||
'size' => $image['input']['size']
|
||||
]);
|
||||
|
||||
|
||||
\Session()->flash('alert-success', "Datei hochgeladen");
|
||||
return redirect(route('admin_product_edit', [$product->id]));
|
||||
}
|
||||
\Session()->flash('alert-danger', "Datei leer");
|
||||
return redirect(route('admin_product_edit', [$product->id]));
|
||||
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
\Session()->flash('alert-danger', "Fehler".$e);
|
||||
return redirect(route('admin_product_edit', [$product->id]));
|
||||
}
|
||||
}
|
||||
|
||||
public function imageDelete($image_id, $product_id){
|
||||
|
||||
$product = Product::findOrFail($product_id);
|
||||
$product_image = ProductImage::findOrFail($image_id);
|
||||
|
||||
if($product_image->product_id == $product->id){
|
||||
$file = 'images/product/'.$product->id.'/'.$product_image->filename;
|
||||
\Storage::disk('public')->delete($file);
|
||||
|
||||
$product_image->delete();
|
||||
|
||||
\Session()->flash('alert-success', "Datei gelöscht");
|
||||
return redirect(route('admin_product_edit', [$product->id]));
|
||||
|
||||
}
|
||||
\Session()->flash('alert-danger', "Datei nicht gefunden");
|
||||
return redirect(route('admin_product_edit', [$product->id]));
|
||||
return \App\Services\ProductImage::imageDelete('product', $product, $product_image_id);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,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::getPaymentForTypeBadge($ShoppingOrder);
|
||||
})
|
||||
->addColumn('reference', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->getLastShoppingPayment('reference');
|
||||
|
|
@ -210,7 +210,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::getPaymentForTypeBadge($ShoppingOrder);
|
||||
})
|
||||
->addColumn('reference', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->getLastShoppingPayment('reference');
|
||||
|
|
@ -246,43 +246,59 @@ class SalesController extends Controller
|
|||
abort(404);
|
||||
}
|
||||
if(isset($data['action'])){
|
||||
|
||||
if($data['action'] === 'store_shipped' && isset($data['shipped'])){
|
||||
$shopping_order = ShoppingOrder::findOrFail($data['id']);
|
||||
$shopping_order->shipped = $data['shipped'];
|
||||
$shopping_order->save();
|
||||
//handel Promotion Product and credit by storno
|
||||
Payment::handelUserPromotionOrder($shopping_order);
|
||||
Payment::handelUserShopOrder($shopping_order);
|
||||
|
||||
if($shopping_order->getAPIShippedType() === 'sent' || $shopping_order->getAPIShippedType() === 'close'){
|
||||
if(!$shopping_order->shipped_at){
|
||||
$shopping_order->shipped_at = now();
|
||||
$shopping_order->save();
|
||||
//set to oder_margin
|
||||
if($shopping_order->shopping_order_margin && $shopping_order->shopping_order_margin->hasPartnerCommission()){
|
||||
//is shipped set pending_to
|
||||
if($shopping_order->shopping_order_margin){
|
||||
if($shopping_order->shopping_order_margin->hasPartnerCommission()){
|
||||
$days = Setting::getContentBySlug('pending_partner_commissions_in_days');
|
||||
$days = $days ? $days : 20;
|
||||
$partner_commission_pending_to = $shopping_order->shipped_at;
|
||||
$partner_commission_pending_to->addDays($days);
|
||||
$shopping_order->shopping_order_margin->partner_commission_pending_to = $partner_commission_pending_to;
|
||||
$shopping_order->shopping_order_margin->save();
|
||||
}else{
|
||||
$days = Setting::getContentBySlug('pending_order_margins_in_days');
|
||||
$days = $days ? $days : 20;
|
||||
$margin_pending_to = $shopping_order->shipped_at;
|
||||
$margin_pending_to->addDays($days);
|
||||
$shopping_order->shopping_order_margin->margin_pending_to = $margin_pending_to;
|
||||
$shopping_order->shopping_order_margin->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$shopping_order->shipped_at = null;
|
||||
$shopping_order->save();
|
||||
if($shopping_order->shopping_order_margin && $shopping_order->shopping_order_margin->hasPartnerCommission()){
|
||||
if($shopping_order->shopping_order_margin){
|
||||
//zurücksetzen der pending_to
|
||||
$shopping_order->shopping_order_margin->partner_commission_pending_to = null;
|
||||
$shopping_order->shopping_order_margin->margin_pending_to = null;
|
||||
$shopping_order->shopping_order_margin->save();
|
||||
}
|
||||
}
|
||||
if($shopping_order->getAPIShippedType() === 'cancel'){
|
||||
if($shopping_order->shopping_order_margin){
|
||||
$shopping_order->shopping_order_margin->cancellation = true;
|
||||
$shopping_order->shopping_order_margin->partner_commission_pending_to = null;
|
||||
$shopping_order->shopping_order_margin->margin_pending_to = null;
|
||||
$shopping_order->shopping_order_margin->save();
|
||||
}
|
||||
}else{
|
||||
if($shopping_order->shopping_order_margin && $shopping_order->shopping_order_margin->cancellation){
|
||||
$shopping_order->shopping_order_margin->cancellation = false;
|
||||
$shopping_order->shopping_order_margin->partner_commission_pending_to = null;
|
||||
$shopping_order->shopping_order_margin->margin_pending_to = null;
|
||||
$shopping_order->shopping_order_margin->save();
|
||||
}
|
||||
}
|
||||
|
|
@ -326,10 +342,10 @@ class SalesController extends Controller
|
|||
$shopping_order->save();
|
||||
$shopping_payment->txaction = $data['txaction'];
|
||||
$shopping_payment->save();
|
||||
|
||||
if($payt->status === 'vor' && $payt->txaction === 'paid'){
|
||||
$send_link = Payment::paymentStatusPaidAction($shopping_order, true);
|
||||
}
|
||||
|
||||
//handel credit loading by change when by $shopping_order_item->handl
|
||||
if($shopping_order->shopping_user->is_for === 'cr'){
|
||||
$last_UserPayCredit = UserPayCredit::where('shopping_order_id', $shopping_order->id)->whereIn('status', [7, 8])->orderBy('id', 'DESC')->first();
|
||||
|
|
|
|||
193
app/Http/Controllers/Stats/SalesController.php
Executable file
193
app/Http/Controllers/Stats/SalesController.php
Executable file
|
|
@ -0,0 +1,193 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers\Stats;
|
||||
|
||||
use Auth;
|
||||
use Request;
|
||||
use App\User;
|
||||
use Carbon\Carbon;
|
||||
use Faker\Core\Number;
|
||||
use App\Exports\ExcelExport;
|
||||
use App\Services\HTMLHelper;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Services\Stats\Sales;
|
||||
use App\Models\ShoppingOrderItem;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Services\BusinessPlan\ExportBot;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
class SalesController extends Controller
|
||||
{
|
||||
|
||||
private $serviceSales;
|
||||
|
||||
public function __construct(Sales $serviceSales)
|
||||
{
|
||||
$this->middleware('admin');
|
||||
$this->serviceSales = $serviceSales;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->setFilterVars();
|
||||
$data = [
|
||||
'filter_months' => HTMLHelper::getTransMonths(true),
|
||||
'filter_years' => HTMLHelper::getYearRange(2020),
|
||||
'filter_products' => $this->serviceSales->setFilterProducts(),
|
||||
];
|
||||
return view('admin.stats.salesvolume', $data);
|
||||
}
|
||||
|
||||
|
||||
public function download()
|
||||
{
|
||||
|
||||
$this->setFilterVars();
|
||||
|
||||
if (Request::get('action') === "filter") {
|
||||
// $data = Request::all();
|
||||
return back();
|
||||
}
|
||||
|
||||
if (Request::get('action') === "export") {
|
||||
$objects = $this->serviceSales->getObjects();
|
||||
$columns = [];
|
||||
$filename = "gs-absatzmengen-" . session('product_sales_vol_filter_month') . '_' . session('product_sales_vol_filter_year') . "-export";
|
||||
$headers = array(
|
||||
'#',
|
||||
'Produkt',
|
||||
'Artikelnummer',
|
||||
'Menge',
|
||||
'Gesamt Netto in EURO',
|
||||
'Vorjahr Menge',
|
||||
'Vorjahr Gesamt Netto in EURO',
|
||||
'Einzelrabatt',
|
||||
'Einzelrabatt %',
|
||||
'VP Einzelrabatt %',
|
||||
|
||||
|
||||
);
|
||||
if ($objects) {
|
||||
foreach ($objects as $key => $obj) {
|
||||
$columns[] = array(
|
||||
'id' => $key,
|
||||
'name' => $obj['name'],
|
||||
'number' => $obj['number'],
|
||||
'qty' => $obj['qty'],
|
||||
'total' => $obj['total'],
|
||||
'pre_qty' => $obj['pre_qty'],
|
||||
'pre_total' => $obj['pre_total'],
|
||||
'single_commission' => $obj['single_commission'],
|
||||
'value_commission' => $obj['value_commission'],
|
||||
'partner_commission' => $obj['partner_commission'],
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
return Excel::download(new ExcelExport($columns, $headers), $filename . '.xls');
|
||||
}
|
||||
}
|
||||
|
||||
private function setFilterVars()
|
||||
{
|
||||
|
||||
if (!session('product_sales_vol_filter_month')) {
|
||||
session(['product_sales_vol_filter_month' => intval(date('m'))]);
|
||||
}
|
||||
if (!session('product_sales_vol_filter_year')) {
|
||||
session(['product_sales_vol_filter_year' => intval(date('Y'))]);
|
||||
}
|
||||
if (!session('product_sales_vol_filter_products')) {
|
||||
session(['product_sales_vol_filter_products' => []]);
|
||||
}
|
||||
if (Request::get('product_sales_vol_filter_month')) {
|
||||
session(['product_sales_vol_filter_month' => Request::get('product_sales_vol_filter_month')]);
|
||||
}
|
||||
if (Request::get('product_sales_vol_filter_year')) {
|
||||
session(['product_sales_vol_filter_year' => Request::get('product_sales_vol_filter_year')]);
|
||||
}
|
||||
if (Request::get('product_sales_vol_filter_products')) {
|
||||
session(['product_sales_vol_filter_products' => Request::get('product_sales_vol_filter_products')]);
|
||||
}
|
||||
|
||||
$this->serviceSales->setFilterVars(
|
||||
session('product_sales_vol_filter_month'),
|
||||
session('product_sales_vol_filter_year'),
|
||||
session('product_sales_vol_filter_products')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
|
||||
$this->setFilterVars();
|
||||
$collection = $this->serviceSales->getCollection();
|
||||
|
||||
/* $collect = collect([
|
||||
['id' => 1, 'name' => 'John', 'number'=>92012, 'value'=>123],
|
||||
['id' => 2, 'name' => 'Jane', 'number'=>92012, 'value'=>123],
|
||||
['id' => 3, 'name' => 'James', 'number'=>92012, 'value'=>123],
|
||||
]);
|
||||
*/
|
||||
|
||||
return \DataTables::of($collection)->toJson();
|
||||
}
|
||||
|
||||
/*private function testCheckFunction(){
|
||||
|
||||
//$date_start = Carbon::parse('01.'.session('product_sales_vol_filter_month').'.'.session('product_sales_vol_filter_year'))->format('Y-m-d');
|
||||
//$date_end = Carbon::parse('01.'.session('product_sales_vol_filter_month').'.'.session('product_sales_vol_filter_year'))->endOfMonth()->format('Y-m-d');
|
||||
|
||||
$date_start = Carbon::parse('01.01.2024')->format('Y-m-d H:i:s');
|
||||
$date_end = Carbon::parse('01.01.2024')->endOfMonth()->format('Y-m-d H:i:s');
|
||||
dump($date_start);
|
||||
dump($date_end);
|
||||
|
||||
$ShoppingOrders = ShoppingOrder::where('mode', 'live')->whereBetween('created_at', [$date_start, $date_end])->get();
|
||||
|
||||
$objects = [];
|
||||
$counter = 0;
|
||||
foreach($ShoppingOrders as $ShoppingOrder){
|
||||
foreach($ShoppingOrder->shopping_order_items as $shopping_order_item){
|
||||
|
||||
if($shopping_order_item->product){
|
||||
if($shopping_order_item->product->id === 122){
|
||||
//dump($shopping_order_item->qty);
|
||||
//$counter += $shopping_order_item->qty;
|
||||
if(isset($objects[$shopping_order_item->product->id])){
|
||||
$value = intval($objects[$shopping_order_item->product->id]['value'] + $shopping_order_item->qty);
|
||||
$objects[$shopping_order_item->product->id]['value'] = $value;
|
||||
}else{
|
||||
$objects[$shopping_order_item->product->id] = [
|
||||
'name' => $shopping_order_item->product->name,
|
||||
'number' => $shopping_order_item->product->number,
|
||||
'value' => $shopping_order_item->qty
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$ShoppingOrderItems = ShoppingOrderItem::whereProductId(122)->whereBetween('created_at', [$date_start, $date_end])->get();
|
||||
$counter = 0;
|
||||
foreach($ShoppingOrderItems as $ShoppingOrderItem){
|
||||
$counter += $ShoppingOrderItem->qty;
|
||||
dump($ShoppingOrderItem->id);
|
||||
}
|
||||
// dump($objects);
|
||||
dump($counter);
|
||||
dd("OKAY");
|
||||
}*/
|
||||
}
|
||||
|
|
@ -285,7 +285,7 @@ class AdminToolsController extends Controller
|
|||
$text = "";
|
||||
|
||||
$kas = new KasController();
|
||||
$domain = 'mivita.care';
|
||||
$domain = 'hier die DOMAIN';
|
||||
|
||||
$ssl = KasSLLController::getApiSSLParameter();
|
||||
|
||||
|
|
|
|||
|
|
@ -498,12 +498,17 @@ class CheckoutController extends Controller
|
|||
'net_amount' => Yard::instance('shopping')->getYardMargin()->net_amount,
|
||||
'from_payment_credit' => Yard::instance('shopping')->totalfromCredit(2, '.', ''),
|
||||
'from' => now(),
|
||||
'status' => $shopping_order->payment_for, //7 => 'from promotion', 8 => 'from shop',
|
||||
'content' => serialize(Yard::instance('shopping')->getYardMargin()->toArray())
|
||||
];
|
||||
if(Yard::instance('shopping')->getYardMargin()->net_partner_commission > 0){
|
||||
if(isset($shopping_order->auth_user->m_sponsor)){
|
||||
if($shopping_order->auth_user->user_sponsor && $shopping_order->auth_user->user_sponsor->isActiveAccount()){
|
||||
$data['m_sponsor_id'] = $shopping_order->auth_user->m_sponsor;
|
||||
$data['net_partner_commission'] = Yard::instance('shopping')->getYardMargin()->net_partner_commission;
|
||||
}
|
||||
}
|
||||
}
|
||||
$shopping_order_margin = false;
|
||||
if ($this->getPayments('shopping_order_margin_id')) {
|
||||
$shopping_order_margin = ShoppingOrderMargin::find($this->getPayments('shopping_order_margin_id'));
|
||||
|
|
|
|||
|
|
@ -370,7 +370,11 @@ class HomepartyController extends Controller
|
|||
$date = date('d.m.Y H:i:s', $time);
|
||||
$user = User::find(Auth::user()->id);
|
||||
Yard::instance('shopping')->destroy();
|
||||
Yard::instance('shopping')->add($homeparty->id, 'Bestellung Homeparty '.$date, 1, \App\Services\HomepartyCart::$price, ['image' => "", 'slug' => $time, 'weight' => 0]);
|
||||
die("STOP nicht getestet");
|
||||
Yard::instance('shopping')->add($homeparty->id, 'Bestellung Homeparty '.$date, 1, \App\Services\HomepartyCart::$price, /*need TAX*/ 1, ['image' => "", 'slug' => $time, 'weight' => 0]);
|
||||
|
||||
// $cartItem = Yard::instance('shopping')->add($homeparty->id, 'Bestellung Homeparty '.$date, 1, \App\Services\HomepartyCart::$ek_price, false, false, ['image' => "", 'slug' => $time, 'weight' => 0]);
|
||||
Yard::setTax($cartItem->rowId, 0);
|
||||
do {
|
||||
$identifier = Util::getToken();
|
||||
} while( ShoppingInstance::where('identifier', $identifier)->count() );
|
||||
|
|
|
|||
94
app/Http/Controllers/User/MyOrderController.php
Normal file
94
app/Http/Controllers/User/MyOrderController.php
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers\User;
|
||||
use Auth;
|
||||
use Yard;
|
||||
use Request;
|
||||
use App\User;
|
||||
use Validator;
|
||||
use App\Services\Util;
|
||||
use App\Models\Product;
|
||||
use App\Models\UserShop;
|
||||
use App\Services\Payment;
|
||||
use App\Models\UserHistory;
|
||||
use App\Models\ShoppingUser;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Models\ProductCategory;
|
||||
use App\Models\ShippingCountry;
|
||||
use App\Models\ShoppingInstance;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\ProductBuy;
|
||||
|
||||
class MyOrderController 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);
|
||||
}
|
||||
$shopping_order->getLastShoppingPayment();
|
||||
|
||||
$data = [
|
||||
'shopping_order' => $shopping_order,
|
||||
'isAdmin' => false,
|
||||
];
|
||||
return view('user.order.detail', $data);
|
||||
}
|
||||
|
||||
public function datatable(){
|
||||
|
||||
$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_myorder_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 $ShoppingOrder->getFormattedTotalShipping()." €";
|
||||
})
|
||||
->addColumn('payment', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->getLastShoppingPayment('getPaymentType');
|
||||
})
|
||||
->addColumn('shipped', function (ShoppingOrder $ShoppingOrder) {
|
||||
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getShippedColor().'">'.$ShoppingOrder->getShippedType().'</span>';
|
||||
})
|
||||
->addColumn('payment_for', function (ShoppingOrder $ShoppingOrder) {
|
||||
return Payment::getPaymentForTypeBadge($ShoppingOrder);
|
||||
})
|
||||
->addColumn('reference', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->getLastShoppingPayment('reference');
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('txaction', 'txaction $1')
|
||||
->orderColumn('payment_for', 'payment_for $1')
|
||||
->orderColumn('shipped', 'shipped $1')
|
||||
->orderColumn('total_shipping', 'total_shipping $1')
|
||||
->rawColumns(['id', 'txaction', 'payment_for', 'shipped'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -7,18 +7,20 @@ use Yard;
|
|||
use Request;
|
||||
use App\User;
|
||||
use Validator;
|
||||
use App\Services\Shop;
|
||||
use App\Services\Util;
|
||||
use App\Models\Product;
|
||||
use App\Models\UserShop;
|
||||
use App\Services\Payment;
|
||||
use App\Models\ProductBuy;
|
||||
use App\Models\UserHistory;
|
||||
use App\Models\ShoppingUser;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Services\UserService;
|
||||
use App\Models\ProductCategory;
|
||||
use App\Models\ShippingCountry;
|
||||
use App\Models\ShoppingInstance;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\ProductBuy;
|
||||
|
||||
class OrderController extends Controller
|
||||
{
|
||||
|
|
@ -28,80 +30,15 @@ class OrderController extends Controller
|
|||
$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);
|
||||
}
|
||||
$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 $ShoppingOrder->getFormattedTotalShipping()." €";
|
||||
})
|
||||
->addColumn('payment', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->getLastShoppingPayment('getPaymentType');
|
||||
})
|
||||
->addColumn('shipped', function (ShoppingOrder $ShoppingOrder) {
|
||||
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>';
|
||||
})
|
||||
->addColumn('reference', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->getLastShoppingPayment('reference');
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('txaction', 'txaction $1')
|
||||
->orderColumn('payment_for', 'payment_for $1')
|
||||
->orderColumn('shipped', 'shipped $1')
|
||||
->orderColumn('total_shipping', 'total_shipping $1')
|
||||
->rawColumns(['id', 'txaction', 'payment_for', 'shipped'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
||||
public function delivery($for, $id=null)
|
||||
{
|
||||
$user = User::find(\Auth::user()->id);
|
||||
|
||||
$shopping_user = null;
|
||||
$delivery_id = null;
|
||||
if($for === 'ot'){
|
||||
$shopping_user = $this->checkShoppingUser($id, $user);
|
||||
if(strpos($for, 'ot') !== false){
|
||||
$shopping_user = Shop::checkShoppingUser($id, $user);
|
||||
$delivery_id = $shopping_user->id;
|
||||
if(!$this->checkShoppingCountry($for, $delivery_id) && !\Session()->has('custom-error')){
|
||||
if(!Shop::checkShoppingCountry($for, $delivery_id) && !\Session()->has('custom-error')){
|
||||
\Session()->flash('custom-error', __('validation.custom.shipping_not_found'));
|
||||
return redirect(route('user_order_my_delivery', [$for, $delivery_id]));
|
||||
}
|
||||
|
|
@ -109,12 +46,11 @@ class OrderController extends Controller
|
|||
|
||||
if(Request::get('action') === 'next'){
|
||||
Yard::instance('shopping')->destroy();
|
||||
if(Request::get('switchers-radio-is-for') === 'ot'){
|
||||
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,
|
||||
|
|
@ -132,16 +68,23 @@ class OrderController extends Controller
|
|||
$shopping_user = null;
|
||||
$delivery_id = null;
|
||||
|
||||
if($for === 'ot'){
|
||||
$shopping_user = $this->checkShoppingUser($id, $user);
|
||||
if(strpos($for, 'ot') !== false){
|
||||
$shopping_user = Shop::checkShoppingUser($id, $user);
|
||||
$delivery_id = $shopping_user->id;
|
||||
}
|
||||
$shipping_country_id = $this->checkShoppingCountry($for, $id);
|
||||
if($for === 'ot-customer'){ //noch nicht implementiert
|
||||
//Liederung an ot-customer (Kunden) Zahlung und Rechnung geht an Kunden
|
||||
UserService::initCustomerYard($shopping_user, $for);
|
||||
}else{
|
||||
//Lieferung an user oder ot-member (Kunden) rechnung geht an User
|
||||
//lieferland und rechnungsland prüfen
|
||||
$shipping_country_id = Shop::checkShoppingCountry($for, $id);
|
||||
if(!$shipping_country_id){
|
||||
\Session()->flash('custom-error', __('validation.custom.shipping_not_found'));
|
||||
return redirect(route('user_order_my_delivery', [$for, $delivery_id]));
|
||||
}
|
||||
Yard::instance('shopping')->setShippingCountryWithPrice($shipping_country_id, $for);
|
||||
UserService::initUserYard($user, $shipping_country_id, $for);
|
||||
}
|
||||
|
||||
if($for === 'cr'){
|
||||
Yard::instance('shopping')->setGlobalTaxRate(0);
|
||||
|
|
@ -150,7 +93,6 @@ class OrderController extends Controller
|
|||
}else{
|
||||
Yard::instance('shopping')->setShoppingUser($user, true);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'shopping_user' => $shopping_user,
|
||||
'user' => $user,
|
||||
|
|
@ -183,6 +125,8 @@ class OrderController extends Controller
|
|||
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'])){
|
||||
|
|
@ -211,6 +155,7 @@ class OrderController extends Controller
|
|||
$data['is_from'] = 'user_order';
|
||||
$data['is_for'] = $for;
|
||||
$data['shopping_user_id'] = $id;
|
||||
$data['user_price_infos'] = Yard::instance('shopping')->getUserPriceInfos();
|
||||
unset($data['quantity']);
|
||||
unset($data['_token']);
|
||||
|
||||
|
|
@ -236,48 +181,108 @@ class OrderController extends Controller
|
|||
return redirect(route('user_checkout', [$identifier]));
|
||||
}
|
||||
|
||||
private function checkShoppingCountry($for, $id=null){
|
||||
|
||||
$country_id = null;
|
||||
if($for === 'me' || $for === 'mp' || $for === 'cr'){
|
||||
private function checkSendYardForPayment($data, $id){
|
||||
|
||||
$user = User::find(\Auth::user()->id);
|
||||
if($user->same_as_billing){
|
||||
$country_id = $user->account->country_id;
|
||||
}else{
|
||||
$country_id = $user->account->shipping_country_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'));
|
||||
}
|
||||
if($for === 'ot' && $id){
|
||||
$shopping_user = ShoppingUser::findOrFail($id);
|
||||
if($shopping_user->same_as_billing){
|
||||
$country_id = $shopping_user->billing_country_id;
|
||||
}else{
|
||||
$country_id = $shopping_user->shipping_country_id;
|
||||
//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($country_id){
|
||||
if($shipping_country = ShippingCountry::whereCountryId($country_id)->first()){
|
||||
return $shipping_country->id;
|
||||
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'));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private function checkShoppingUser($id, $user){
|
||||
if($id === null){
|
||||
abort(403, 'Error: Keine User ID');
|
||||
$shipping_price = Shop::getShippingPriceByShippingCountryId($shipping_country_id, Yard::instance('shopping')->weight());
|
||||
//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'));
|
||||
}
|
||||
$shopping_user = ShoppingUser::findOrFail($id);
|
||||
if($shopping_user->member_id !== $user->id){
|
||||
abort(403, 'Error: Falsche User ID');
|
||||
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'));
|
||||
}
|
||||
$shopping_user = ShoppingUser::findOrFail($id);
|
||||
if($shopping_user->is_like){
|
||||
abort(403, 'Error: Kunde in Prüfung');
|
||||
}
|
||||
return $shopping_user;
|
||||
|
||||
if($data['shipping_is_for'] == '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'));
|
||||
}
|
||||
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(){
|
||||
|
||||
|
|
@ -430,7 +435,11 @@ class OrderController extends Controller
|
|||
}
|
||||
|
||||
//get the card item
|
||||
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->getPriceWith(false, true), $product->tax,
|
||||
|
||||
//Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->price, $product->tax, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight]);
|
||||
|
||||
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->price, $product->tax,
|
||||
//$product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), true, Yard::instance('shopping')->getUserCountry()), $product->getTaxWith(Yard::instance('shopping')->getUserCountry()), //$product->tax, true?
|
||||
[
|
||||
'image' => $image,
|
||||
'slug' => $product->slug,
|
||||
|
|
@ -440,7 +449,14 @@ class OrderController extends Controller
|
|||
'value_commission' => $product->value_commission,
|
||||
'partner_commission' => $product->partner_commission,
|
||||
]);
|
||||
Yard::setTax($cartItem->rowId, $product->tax);
|
||||
|
||||
if(Yard::instance('shopping')->getUserTaxFree()){
|
||||
//Yard::setTax($cartItem->rowId, 0);
|
||||
Yard::instance('shopping')->setGlobalTaxRate(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']);
|
||||
|
|
@ -476,7 +492,7 @@ class OrderController extends Controller
|
|||
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);
|
||||
Yard::instance('shopping')->setShippingCountryWithPrice($shipping_country->id, $is_for); //$is_for == 'ot' or 'me'
|
||||
$this->checkCompProduct(Yard::instance('shopping')->getNumComp());
|
||||
}
|
||||
}
|
||||
|
|
@ -544,13 +560,28 @@ class OrderController extends Controller
|
|||
}
|
||||
|
||||
private function getCompProducts($for) {
|
||||
|
||||
if($for === 'me' && \App\Models\Setting::getContentBySlug('order_partner_is_comp_me')) {
|
||||
return Product::whereActive(true)->whereJsonContains('show_on', ['2'])->where('shipping_addon', true)->orderBy('pos', 'DESC')->get();
|
||||
return Product::whereActive(true)
|
||||
->where(function($query) {
|
||||
$query->whereRaw("JSON_CONTAINS(show_on, '\"2\"')")
|
||||
->orWhereRaw("JSON_CONTAINS(show_on, '\"11\"')");
|
||||
})
|
||||
->where('shipping_addon', true)
|
||||
->orderBy('pos', 'DESC')
|
||||
->get();
|
||||
}
|
||||
|
||||
if($for === 'ot' && \App\Models\Setting::getContentBySlug('order_partner_is_comp_ot')) {
|
||||
return Product::whereActive(true)->whereJsonContains('show_on', ['1'])->where('shipping_addon', true)->orderBy('pos', 'DESC')->get();
|
||||
return Product::whereActive(true)
|
||||
->where(function($query) {
|
||||
$query->whereRaw("JSON_CONTAINS(show_on, '\"1\"')")
|
||||
->orWhereRaw("JSON_CONTAINS(show_on, '\"11\"')");
|
||||
})
|
||||
->where('shipping_addon', true)
|
||||
->orderBy('pos', 'DESC')
|
||||
->get();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,10 +47,10 @@ class PaymentController extends Controller
|
|||
return nl2br($user_pay_credit->message);
|
||||
}elseif($user_pay_credit->status === 5 || $user_pay_credit->status === 6){
|
||||
return trans('payment.'.$user_pay_credit->message).
|
||||
' <a class="btn btn-outline-secondary btn-xs" href="'.route('user_sales_order_detail', [$user_pay_credit->shopping_order_id]).'"><i class="ion ion-md-eye"></i></a>';
|
||||
' <a class="btn btn-outline-secondary btn-xs" href="'.route('user_sales_detail', [$user_pay_credit->shopping_order_id]).'"><i class="ion ion-md-eye"></i></a>';
|
||||
}else{
|
||||
return trans('payment.'.$user_pay_credit->message).
|
||||
' <a class="btn btn-outline-secondary btn-xs" href="'.route('user_order_detail', [$user_pay_credit->shopping_order_id]).'"><i class="ion ion-md-eye"></i></a>';
|
||||
' <a class="btn btn-outline-secondary btn-xs" href="'.route('user_myorder_detail', [$user_pay_credit->shopping_order_id]).'"><i class="ion ion-md-eye"></i></a>';
|
||||
}
|
||||
})
|
||||
->addColumn('credit', function (UserPayCredit $user_pay_credit) {
|
||||
|
|
|
|||
|
|
@ -1,50 +1,56 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers\User;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Services\Payment;
|
||||
use App\User;
|
||||
|
||||
|
||||
class SalesController extends Controller
|
||||
{
|
||||
protected $userShopRepo;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('active.account');
|
||||
}
|
||||
|
||||
public function orders()
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data = [
|
||||
];
|
||||
return view('user.sales.orders', $data);
|
||||
return view('user.sales.index', $data);
|
||||
}
|
||||
|
||||
public function orderDetail($id)
|
||||
public function detail($id)
|
||||
{
|
||||
$user = User::find(\Auth::user()->id);
|
||||
$shopping_order = ShoppingOrder::findOrFail($id);
|
||||
if($shopping_order->member_id !== $user->id){
|
||||
abort(404);
|
||||
}
|
||||
if($shopping_order->payment_for !== 6 && $shopping_order->payment_for !== 7 && $shopping_order->payment_for !== 8){
|
||||
return redirect(route('user_myorder_detail', [$shopping_order->id]));
|
||||
abort(403, 'Beraterbestellung');
|
||||
}
|
||||
$data = [
|
||||
'shopping_order' => $shopping_order,
|
||||
'isAdmin' => false,
|
||||
];
|
||||
return view('user.sales.order_detail', $data);
|
||||
|
||||
return view('user.sales.detail', $data);
|
||||
}
|
||||
|
||||
public function ordersDatatable(){
|
||||
public function datatable(){
|
||||
|
||||
$user = User::find(\Auth::user()->id);
|
||||
$query = ShoppingOrder::with('shopping_user')->select('shopping_orders.*')->where('shopping_orders.member_id', $user->id);
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('id', function (ShoppingOrder $ShoppingOrder) {
|
||||
return '<a href="' . route('user_sales_order_detail', [$ShoppingOrder->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
return '<a href="' . route('user_sales_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");
|
||||
|
|
@ -53,7 +59,7 @@ class SalesController extends Controller
|
|||
return Payment::getShoppingOrderBadge($ShoppingOrder);
|
||||
})
|
||||
->addColumn('total_shipping', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->getFormattedTotalShipping();
|
||||
return '<span class="no-line-break">'.$ShoppingOrder->getFormattedTotalShipping()." €</span>";
|
||||
})
|
||||
->addColumn('orders', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->shopping_user ? $ShoppingOrder->shopping_user->orders : '';
|
||||
|
|
@ -62,15 +68,25 @@ class SalesController 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::getPaymentForTypeBadge($ShoppingOrder);
|
||||
})
|
||||
->addColumn('shipped', function (ShoppingOrder $ShoppingOrder) {
|
||||
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getShippedColor().'">'.$ShoppingOrder->getShippedType().'</span>
|
||||
';
|
||||
})
|
||||
->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>' : '-';
|
||||
})
|
||||
->orderColumn('payment_for', 'payment_for $1')
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('txaction', 'txaction $1')
|
||||
->orderColumn('payment_for', 'payment_for $1')
|
||||
->rawColumns(['id', 'payment_for', 'txaction', 'user_shop_id'])
|
||||
->orderColumn('user_shop_id', 'user_shop_id $1')
|
||||
->orderColumn('total_shipping', 'total_shipping $1')
|
||||
|
||||
->rawColumns(['id', 'txaction', 'user_shop_id', 'total_shipping', 'invoice', 'shipped', 'payment_for'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
119
app/Http/Controllers/User/ShopController.php
Normal file
119
app/Http/Controllers/User/ShopController.php
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\User;
|
||||
|
||||
use Request;
|
||||
use App\User;
|
||||
use Response;
|
||||
use Validator;
|
||||
use App\Services\Util;
|
||||
use App\Models\UserShop;
|
||||
use App\Models\PromotionUser;
|
||||
use App\Services\UserService;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Repositories\UserShopRepository;
|
||||
|
||||
class ShopController extends Controller
|
||||
{
|
||||
protected $userShopRepo;
|
||||
|
||||
public function __construct(UserShopRepository $userShopRepo)
|
||||
{
|
||||
$this->middleware('active.account');
|
||||
$this->userShopRepo = $userShopRepo;
|
||||
}
|
||||
|
||||
public function index(){
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
// $user_shop = UserShop::where('user_id', Auth::user()->id)->first();
|
||||
if(!$user->shop){
|
||||
//create new shop
|
||||
$user = $this->createNewUserShop(Auth::user());
|
||||
}
|
||||
if($user->shop->user_id != Auth::user()->id){
|
||||
abort(404);
|
||||
}
|
||||
$data = [
|
||||
'user_shop' => $user->shop,
|
||||
];
|
||||
|
||||
return view('user.shop.detail', $data);
|
||||
}
|
||||
private function createNewUserShop($user){
|
||||
return $this->userShopRepo->create($user);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$data = Request::all();
|
||||
$user = Auth::user();
|
||||
|
||||
if(isset($data['action']) && $data['action'] === 'save-user-shop'){
|
||||
$rules = array(
|
||||
'name' => 'required',
|
||||
'user_shop_url' => ' required|alpha_dash|profanity|'.'unique:user_shops,url,'.$user->shop->id.',id'.'|min:4|max:20|full_word_check',
|
||||
);
|
||||
Validator::extend('full_word_check', function ($attribute, $value, $parameters, $validator) {
|
||||
$profanity = \App\Models\Setting::getContentBySlug('promotion_user_url_profanity');
|
||||
$profanity = array_map('trim', explode(',', $profanity));
|
||||
if(in_array($value, $profanity)){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
return redirect(route('user_shop'))->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
$model = $this->userShopRepo->update($user->shop->id, Request::all());
|
||||
}
|
||||
\Session()->flash('alert-save', true);
|
||||
return redirect(route('user_shop'));
|
||||
}
|
||||
|
||||
public function load(){
|
||||
$data = Request::all();
|
||||
|
||||
if(Request::ajax()) {
|
||||
if(isset($data['action']) && $data['action'] === 'validate_url'){
|
||||
$unique = 'unique:user_shops,url';
|
||||
if(isset($data['usid'])){
|
||||
$unique .= ','.$data['usid'].',id';
|
||||
}
|
||||
$rules = array(
|
||||
'user_shop_url' => ' required|alpha_dash|profanity|'.$unique.'|min:4|max:20|full_word_check',
|
||||
);
|
||||
Validator::extend('full_word_check', function ($attribute, $value, $parameters, $validator) {
|
||||
$profanity = \App\Models\Setting::getContentBySlug('promotion_user_url_profanity');
|
||||
$profanity = array_map('trim', explode(',', $profanity));
|
||||
if(in_array($value, $profanity)){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
//$messages = $validator->messages();
|
||||
return Response::json(array(
|
||||
'success' => false,
|
||||
'errors' => $validator->getMessageBag()->toArray()
|
||||
|
||||
));
|
||||
}
|
||||
//$slug = SlugService::createSlug(UserShop::class, 'slug', Request::get('user_promotion_url'));
|
||||
$name = Util::sanitize(Request::get('user_shop_url'), true, false, true, true);
|
||||
|
||||
return Response::json(array(
|
||||
'success' => true,
|
||||
'preview_user_shop_url' => config('app.shop_url')."/".$name,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers\User;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Services\Payment;
|
||||
use App\User;
|
||||
|
||||
|
||||
class SalesController extends Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('active.shop');
|
||||
}
|
||||
|
||||
public function orders()
|
||||
{
|
||||
$data = [
|
||||
];
|
||||
return view('user.shop.sales.orders', $data);
|
||||
}
|
||||
|
||||
public function orderDetail($id)
|
||||
{
|
||||
$user = User::find(\Auth::user()->id);
|
||||
$shopping_order = ShoppingOrder::findOrFail($id);
|
||||
if($shopping_order->member_id !== $user->id){
|
||||
abort(404);
|
||||
}
|
||||
$data = [
|
||||
'shopping_order' => $shopping_order,
|
||||
'isAdmin' => false,
|
||||
];
|
||||
return view('user.shop.sales.order_detail', $data);
|
||||
}
|
||||
|
||||
public function ordersDatatable(){
|
||||
|
||||
$user = User::find(\Auth::user()->id);
|
||||
$query = ShoppingOrder::with('shopping_user')->select('shopping_orders.*')->where('member_id', $user->id);
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('id', function (ShoppingOrder $ShoppingOrder) {
|
||||
return '<a href="' . route('user_shop_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 $ShoppingOrder->getFormattedTotalShipping();
|
||||
})
|
||||
->addColumn('orders', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->shopping_user ? $ShoppingOrder->shopping_user->orders : '';
|
||||
})
|
||||
->addColumn('user_shop_id', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->user_shop ? '<a href="'.$ShoppingOrder->user_shop->getSubdomain(false).'" target="_blank">'.$ShoppingOrder->user_shop->getSubdomain(false).'</span>' : '';
|
||||
})
|
||||
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('txaction', 'txaction $1')
|
||||
->orderColumn('user_shop_id', 'user_shop_id $1')
|
||||
->rawColumns(['id', 'txaction', 'user_shop_id'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -39,6 +39,15 @@ class UserDataController extends Controller
|
|||
/*if(!$user->account){
|
||||
$user->account = new UserAccount();
|
||||
}*/
|
||||
$data = Request::all();
|
||||
if(isset($data['action']) && $data['action'] == "reverse_charge_validate"){
|
||||
return $this->userRepo->reverse_charge_validate($data, $user, route('user_edit', [$user->id]));
|
||||
}
|
||||
|
||||
if(isset($data['action']) && $data['action'] == "reverse_charge_delete"){
|
||||
return $this->userRepo->reverse_charge_delete($data, $user, route('user_edit', [$user->id]));
|
||||
}
|
||||
|
||||
$rules = array(
|
||||
'salutation' => 'required',
|
||||
'first_name'=>'required',
|
||||
|
|
@ -50,9 +59,6 @@ class UserDataController extends Controller
|
|||
'mobil' => 'required_without:phone',
|
||||
'tax_number' => 'required_without:tax_identification_number',
|
||||
'tax_identification_number' => 'required_without:tax_number',
|
||||
'birthday_day' => 'required',
|
||||
'birthday_month' => 'required',
|
||||
'birthday_year' => 'required',
|
||||
'country_id' => 'required|integer|min:1',
|
||||
'email' => 'required|string|email|max:255|exists:users,email',
|
||||
'email-confirm' => 'required|same:email',
|
||||
|
|
@ -79,7 +85,7 @@ class UserDataController extends Controller
|
|||
} else {
|
||||
$this->userRepo->update(Request::all());
|
||||
\Session()->flash('alert-save', true);
|
||||
return redirect('/user/edit');
|
||||
return redirect(route('user_edit', [$user->id]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -343,8 +343,10 @@ class UserShopController extends Controller
|
|||
|
||||
public function userShopRegisterSubDomain($slug){
|
||||
|
||||
return ['success' => false, 'error' => 'no KAS'];
|
||||
/*
|
||||
$kas = new KasController();
|
||||
$domain = 'mivita.care';
|
||||
$domain = 'HIER DIE DOMAIN';
|
||||
|
||||
|
||||
//check if exisist
|
||||
|
|
@ -360,7 +362,7 @@ class UserShopController extends Controller
|
|||
$pra = array(
|
||||
'subdomain_name' => $slug,
|
||||
'domain_name' => $domain,
|
||||
'subdomain_path' => '/mein.mivita.care/public/',
|
||||
'subdomain_path' => '/hier der Ordner /public/',
|
||||
'php_version' => '7.3',
|
||||
//'ssl_proxy' => 'Y',
|
||||
//'redirect_status' => 0
|
||||
|
|
@ -370,6 +372,7 @@ class UserShopController extends Controller
|
|||
return ['success' => true];
|
||||
}
|
||||
return ['success' => false, 'error' => $add_subdomain];
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ use App\Models\PaymentMethod;
|
|||
use App\Models\PromotionUser;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Models\ShoppingPayment;
|
||||
use App\Services\PromotionCart;
|
||||
use App\Services\UserCart;
|
||||
use App\Models\PaymentTransaction;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Repositories\CheckoutRepository;
|
||||
|
|
@ -37,13 +37,16 @@ class PromotionController extends Controller
|
|||
}
|
||||
|
||||
if($path === 'impressum'){
|
||||
return view('web.promotion.impressum');
|
||||
return view('web.legal.impressum');
|
||||
}
|
||||
if($path === 'datenschutzerklaerung'){
|
||||
return view('web.promotion.datenschutzerklaerung');
|
||||
return view('web.legal.datenschutzerklaerung');
|
||||
}
|
||||
if($path === 'widerrufsbelehrung'){
|
||||
return view('web.promotion.widerrufsbelehrung');
|
||||
return view('web.legal.widerrufsbelehrung');
|
||||
}
|
||||
if($path === 'versandarten'){
|
||||
return view('web.legal.versandarten');
|
||||
}
|
||||
//search for promo
|
||||
$PromotionUser = PromotionUser::where('url', trim($path))->whereNull('user_deleted_at')->first();
|
||||
|
|
@ -56,17 +59,23 @@ class PromotionController extends Controller
|
|||
];
|
||||
return view('web.promotion.outofstock', $data);
|
||||
}
|
||||
PromotionCart::initYard();
|
||||
UserCart::initYard('prom', null, $PromotionUser);
|
||||
|
||||
$first_category = Category::where('active', true)->whereJsonContains('show_on', ['3'])->orderBy('pos', 'DESC')->first();
|
||||
$first_category_id = isset($first_category->id) ? $first_category->id : false;
|
||||
$shop_products = $this->getShowProducts();
|
||||
$first_category_id = false;
|
||||
if(Request::get('catid')){
|
||||
$first_category_id = Request::get('catid');
|
||||
}
|
||||
|
||||
//$first_category = Category::where('active', true)->whereJsonContains('show_on', ['3'])->orderBy('pos', 'DESC')->first();
|
||||
//$first_category_id = isset($first_category->id) ? $first_category->id : false;
|
||||
$shop_products = $this->getShowProducts($first_category_id);
|
||||
|
||||
$data = [
|
||||
'promotion_user' => $PromotionUser,
|
||||
'shop_products' => $shop_products,
|
||||
'user_payment_methods' => PaymentMethod::getDefaultAsArray()->toArray(),
|
||||
'first_category_id' => $first_category_id,
|
||||
'categories_by_show_on' => '3'
|
||||
];
|
||||
return view('web.promotion.index', $data);
|
||||
}
|
||||
|
|
@ -230,38 +239,38 @@ class PromotionController extends Controller
|
|||
return response()->json(['response' => $data, 'shop_products_view'=>$shop_products_view, 'status'=>$status]);
|
||||
}
|
||||
if($data['action'] === 'switch-free-product'){
|
||||
\App\Services\PromotionCart::updateFeeProduct($data);
|
||||
\App\Services\UserCart::updateFeeProduct($data);
|
||||
}
|
||||
if($data['action'] === 'add-shop-product'){
|
||||
$data['qty'] = \App\Services\PromotionCart::updateProduct($data, true);
|
||||
$data['qty'] = \App\Services\UserCart::updateProduct($data, true);
|
||||
}
|
||||
if($data['action'] === 'update-shop-product'){
|
||||
$data['qty'] = \App\Services\PromotionCart::updateProduct($data);
|
||||
$data['qty'] = \App\Services\UserCart::updateProduct($data);
|
||||
}
|
||||
if($data['action'] === 'remove-shop-product'){
|
||||
\App\Services\PromotionCart::updateProduct($data);
|
||||
\App\Services\UserCart::updateProduct($data);
|
||||
$data['qty'] = 0;
|
||||
}
|
||||
if($data['action'] === 'clear-cart'){
|
||||
\App\Services\PromotionCart::clearCart($data);
|
||||
\App\Services\UserCart::clearCart($data);
|
||||
}
|
||||
if($data['action'] === 'switch-shipping'){
|
||||
\App\Services\PromotionCart::switchShipping($data);
|
||||
\App\Services\UserCart::switchShipping($data);
|
||||
}
|
||||
if($data['action'] === 'change-state-shipping'){
|
||||
\App\Services\PromotionCart::changeStateShipping($data);
|
||||
\App\Services\UserCart::changeStateShipping($data, 'prom');
|
||||
}
|
||||
|
||||
$cart = view("web.promotion._promotion_cart", compact('data'))->render();
|
||||
if(Yard::instance('shopping')->isQuickShipping()){
|
||||
$invoice = view("web.promotion._invoice_details_quick")->render();
|
||||
$invoice = view("web.components._invoice_details_quick")->render();
|
||||
}else{
|
||||
$invoice = view("web.promotion._invoice_details")->render();
|
||||
$invoice = view("web.components._invoice_details")->render();
|
||||
}
|
||||
$checkout = view("web.promotion._checkout")->render();
|
||||
$data['shipping_price_formated'] = PromotionCart::getCurrentShippingPrice();
|
||||
$checkout = view("web.components._checkout")->render();
|
||||
$data['shipping_price_formated'] = UserCart::getCurrentShippingPrice(2); //shipping_for === 2 promotion , 3 shop
|
||||
|
||||
return response()->json(['response' => $data, 'cart'=>$cart, 'invoice'=>$invoice, 'checkout'=>$checkout, 'status'=>$status]);
|
||||
return response()->json(['response' => $data, 'cart'=>$cart, 'invoice'=>$invoice, 'checkout'=>$checkout, 'status'=>$status, 'basketqty'=>Yard::instance('shopping')->count()]);
|
||||
}
|
||||
return response()->json(['response' => $data, 'html'=>$ret, 'status'=>$status]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,19 +3,21 @@
|
|||
namespace App\Http\Controllers\Web;
|
||||
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Mail\MailContact;
|
||||
use App\Mail\MailVerifyAccount;
|
||||
use App\Models\UserHistory;
|
||||
use App\Repositories\UserRepository;
|
||||
use App\Services\SysLog;
|
||||
use App\Services\UserService;
|
||||
use App\User;
|
||||
use GuzzleHttp\Client;
|
||||
use Request;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use App\Services\Util;
|
||||
use App\User;
|
||||
use Validator;
|
||||
use App\Services\Util;
|
||||
use GuzzleHttp\Client;
|
||||
use App\Services\SysLog;
|
||||
use App\Mail\MailContact;
|
||||
use App\Models\UserHistory;
|
||||
use App\Models\UserRegister;
|
||||
use App\Services\UserService;
|
||||
use App\Mail\MailVerifyAccount;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Repositories\UserRepository;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
|
||||
class RegisterController extends Controller
|
||||
|
|
@ -34,33 +36,105 @@ class RegisterController extends Controller
|
|||
$this->userRepo = $userRepo;
|
||||
}
|
||||
|
||||
public function member($member_id = false)
|
||||
public function showConsentPage()
|
||||
{
|
||||
$data = [
|
||||
'from_member_id' => session('from_member_id')
|
||||
];
|
||||
return view('auth.recaptcha-consent', $data);
|
||||
}
|
||||
|
||||
public function acceptConsent()
|
||||
{
|
||||
if (!Request::has('recaptcha_consent')) {
|
||||
return back()->withErrors(['error' => 'Bitte stimmen Sie der Verwendung von reCAPTCHA zu']);
|
||||
}
|
||||
|
||||
session(['recaptcha_consent' => true]);
|
||||
return redirect()->route('register.form');
|
||||
}
|
||||
|
||||
public function showRegistrationForm()
|
||||
{
|
||||
if (!session('recaptcha_consent')) {
|
||||
return redirect()->route('register.consent');
|
||||
}
|
||||
$data = [
|
||||
'from_member_id' => session('from_member_id')
|
||||
];
|
||||
return view('auth.register', $data);
|
||||
}
|
||||
|
||||
public function member($from_member_id = false)
|
||||
{
|
||||
$this->userRepo->clearUserRegister();
|
||||
|
||||
if(!$from_member_id){
|
||||
return redirect()->route('register.consent');
|
||||
}
|
||||
|
||||
//ist ein gültiger Member ID und ist aktiv?
|
||||
$user_id = (int) str_replace('gs', '', $from_member_id) - config('main.add_number_id');
|
||||
$user = User::find($user_id);
|
||||
if(!$user || !$user->isActive() || !$user->isActiveAccount()){
|
||||
return redirect()->route('register.consent');
|
||||
}
|
||||
session(['from_member_id' => $from_member_id]);
|
||||
return redirect()->route('register.consent');
|
||||
|
||||
/*
|
||||
//hat einen Member ID?
|
||||
if(!$member_id){
|
||||
return redirect('/registrierung');
|
||||
}
|
||||
|
||||
//ist ein gültiger Member ID und ist aktiv?
|
||||
$user_id = (int) str_replace('gs', '', $member_id) - config('main.add_number_id');
|
||||
$user = User::find($user_id);
|
||||
if(!$user || !$user->isActive() || !$user->isActiveAccount()){
|
||||
return redirect('/registrierung');
|
||||
}
|
||||
|
||||
if (!session('recaptcha_consent')) {
|
||||
$data = [
|
||||
'from_member_id' => Request::get('from_member_id')
|
||||
];
|
||||
return view('auth.recaptcha-consent', $data);
|
||||
|
||||
//return redirect()->route('register.consent')->with(['from_member_id' => $member_id]);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'from_member_id' => $member_id
|
||||
];
|
||||
return view('auth.register', $data);
|
||||
*/
|
||||
}
|
||||
|
||||
public function register(){
|
||||
|
||||
public function register(){
|
||||
$this->userRepo->clearUserRegister();
|
||||
// Überprüfe zuerst die reCAPTCHA-Einwilligung
|
||||
|
||||
/* if (!Request::has('recaptcha_consent')) {
|
||||
return back()->withErrors(['recaptcha_consent' => 'Bitte stimmen Sie der Verwendung von reCAPTCHA zu'])->withInput(Request::all());
|
||||
}*/
|
||||
|
||||
// Überprüfe reCAPTCHA
|
||||
$recaptchaResponse = Request::input('g-recaptcha-response');
|
||||
if (!$this->verifyRecaptcha($recaptchaResponse)) {
|
||||
return back()->withErrors(['g-recaptcha-response' => 'Bitte bestätigen Sie, dass Sie kein Roboter sind'])->withInput(Request::all());
|
||||
}
|
||||
|
||||
$rules = array(
|
||||
'salutation' => 'required',
|
||||
'first_name'=>'required',
|
||||
'last_name'=>'required',
|
||||
'first_name'=>'required|string|min:2',
|
||||
'last_name'=>'required|string|min:2',
|
||||
'email' => 'required|string|email|max:255|unique:users',
|
||||
'password' => 'required|string|min:6|confirmed',
|
||||
'password_confirmation' => 'required|string|min:6',
|
||||
'accepted_data_protection' => 'required',
|
||||
'g-recaptcha-response' => 'required',
|
||||
);
|
||||
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
|
|
@ -68,37 +142,54 @@ class RegisterController extends Controller
|
|||
return back()->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
|
||||
//search in UserRegister
|
||||
$data = Request::all();
|
||||
$user = $this->userRepo->create($data);
|
||||
|
||||
$confirmation_code = UserService::createConfirmationCode();
|
||||
|
||||
$user->lang = !empty(\App::getLocale()) ? \App::getLocale() : "de";
|
||||
$user->confirmation_code = $confirmation_code;
|
||||
$user->confirmation_code_to = date('Y-m-d H:i:s', strtotime('+1 week'));
|
||||
$user->confirmation_code_remider = 0;
|
||||
if(isset($data['from_member_id'])){
|
||||
$user->m_sponsor = (int) str_replace('gs', '', $data['from_member_id']) - config('main.add_number_id');
|
||||
$UserRegister = UserRegister::where('identifier', $data['email'])->first();
|
||||
if($UserRegister){
|
||||
$exists = [
|
||||
'register_email' => $data['email']
|
||||
];
|
||||
return view('auth.existing', $exists);
|
||||
}
|
||||
$user->save();
|
||||
|
||||
$user = User::find($user->id);
|
||||
|
||||
$userObj = $this->userRepo->createUserRegister($data);
|
||||
$from_member_id = session('from_member_id');
|
||||
$user_id = isset($from_member_id) ? (int) str_replace('gs', '', $from_member_id) - config('main.add_number_id') : config('app.main_user_id'); // Krummel
|
||||
try {
|
||||
Mail::to($user->email)->bcc(config('app.info_mail'))->send(new MailVerifyAccount($confirmation_code, $user));
|
||||
Mail::to($userObj->email)->bcc(config('app.info_mail'))->send(new MailVerifyAccount($userObj->confirmation_code, $userObj));
|
||||
}
|
||||
catch(\Exception $e){
|
||||
SysLog::action('register-user', 'auth_register', 5)
|
||||
->setUserId($user->id)
|
||||
->setModel($user->id, User::class)
|
||||
->setUserId($user_id)
|
||||
->setModel(null, UserRegister::class)
|
||||
->setMessage('Error send register E-Mail: '.$e->getMessage())
|
||||
->save();
|
||||
}
|
||||
UserHistory::create(['user_id' => $user->id, 'action'=>'register', 'status'=>0]);
|
||||
UserHistory::create(['user_id' => $user_id, 'action'=>'register', 'status'=>0]);
|
||||
|
||||
return redirect('/user_register/finish');
|
||||
}
|
||||
|
||||
// Neue Methode zur Überprüfung des reCAPTCHA
|
||||
private function verifyRecaptcha($recaptchaResponse)
|
||||
{
|
||||
if (empty($recaptchaResponse)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$client = new Client();
|
||||
$response = $client->post('https://www.google.com/recaptcha/api/siteverify', [
|
||||
'form_params' => [
|
||||
'secret' => config('services.recaptcha.secret_key'),
|
||||
'response' => $recaptchaResponse
|
||||
]
|
||||
]);
|
||||
|
||||
$body = json_decode((string)$response->getBody());
|
||||
return $body->success;
|
||||
}
|
||||
|
||||
public function finish()
|
||||
{
|
||||
$data = [
|
||||
|
|
@ -106,4 +197,40 @@ class RegisterController extends Controller
|
|||
];
|
||||
return view('auth.finish', $data);
|
||||
}
|
||||
|
||||
public function verify($confirmation_code){
|
||||
|
||||
if( ! $confirmation_code)
|
||||
{
|
||||
return redirect('/status/error');
|
||||
}
|
||||
|
||||
$UserRegister = UserRegister::where ('instance', $confirmation_code)->first();
|
||||
|
||||
if ( ! $UserRegister)
|
||||
{
|
||||
return redirect('/status/not/found');
|
||||
}
|
||||
|
||||
$user = $this->userRepo->create($UserRegister);
|
||||
|
||||
//Login!
|
||||
Auth::login($user);
|
||||
|
||||
return redirect('/home');
|
||||
}
|
||||
|
||||
public function registerAgain(){
|
||||
$data = Request::all();
|
||||
if(!isset($data['register_email'])){
|
||||
abort(403, "No E-Mail");
|
||||
}
|
||||
$UserRegister = UserRegister::where('identifier', $data['register_email'])->first();
|
||||
if(!$UserRegister){
|
||||
abort(403, "No E-Mail Register");
|
||||
}
|
||||
Mail::to($UserRegister->identifier)->bcc(config('app.info_mail'))->send(new MailVerifyAccount($UserRegister->instance, $UserRegister->content));
|
||||
return redirect('/user_register/finish');
|
||||
|
||||
}
|
||||
}
|
||||
294
app/Http/Controllers/Web/ShopController.php
Normal file
294
app/Http/Controllers/Web/ShopController.php
Normal file
|
|
@ -0,0 +1,294 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Web;
|
||||
|
||||
use Yard;
|
||||
use Request;
|
||||
use Response;
|
||||
use Validator;
|
||||
use App\Services\Util;
|
||||
use App\Models\Product;
|
||||
use App\Models\UserShop;
|
||||
use App\Services\Payment;
|
||||
use App\Models\UserHistory;
|
||||
use App\Models\PaymentMethod;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Models\ShoppingPayment;
|
||||
use App\Services\UserCart;
|
||||
use App\Models\PaymentTransaction;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Repositories\CheckoutRepository;
|
||||
|
||||
class ShopController extends Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function serve($path = null)
|
||||
{
|
||||
if(!isset($path)){
|
||||
$path = 'grueneseele';
|
||||
//abort(402);
|
||||
}
|
||||
if($path === 'impressum'){
|
||||
return view('web.legal.impressum');
|
||||
}
|
||||
if($path === 'datenschutzerklaerung'){
|
||||
return view('web.legal.datenschutzerklaerung');
|
||||
}
|
||||
if($path === 'widerrufsbelehrung'){
|
||||
return view('web.legal.widerrufsbelehrung');
|
||||
}
|
||||
if($path === 'versandarten'){
|
||||
return view('web.legal.versandarten');
|
||||
}
|
||||
|
||||
//search for promo
|
||||
$userShop = UserShop::where('url', trim($path))->first();
|
||||
if(!$userShop){
|
||||
//redirect !!!!
|
||||
abort(402);
|
||||
}
|
||||
if(!$userShop->isActive()){
|
||||
$data = [
|
||||
'user_shop' => $userShop,
|
||||
];
|
||||
//redirect !!!!
|
||||
return view('web.shop.outofstock', $data);
|
||||
}
|
||||
UserCart::initYard('shop', $userShop, null);
|
||||
$first_category_id = false;
|
||||
if(Request::get('catid')){
|
||||
$first_category_id = Request::get('catid');
|
||||
}
|
||||
|
||||
$userMargin = \App\Services\Shop::calculateUserShopMargins($userShop, null);
|
||||
|
||||
//$first_category = Category::where('active', true)->whereJsonContains('show_on', ['8'])->orderBy('pos', 'DESC')->first();
|
||||
// $first_category_id = isset($first_category->id) ? $first_category->id : false;
|
||||
$shop_products = $this->getShowProducts($first_category_id);
|
||||
|
||||
$data = [
|
||||
'user_shop' => $userShop,
|
||||
'shop_products' => $shop_products,
|
||||
'user_payment_methods' => PaymentMethod::getDefaultAsArray()->toArray(),
|
||||
'first_category_id' => $first_category_id,
|
||||
'categories_by_show_on' => '8',
|
||||
'userMargin' => $userMargin
|
||||
];
|
||||
return view('web.shop.index', $data);
|
||||
}
|
||||
|
||||
public function goto($load, $user_shop_id, $transactionId=false, $reference=false, $identifier=false){
|
||||
$userShop = UserShop::findOrFail($user_shop_id);
|
||||
$data = [
|
||||
'user_shop' => $userShop,
|
||||
];
|
||||
|
||||
if($load === 'thanksreminder'){
|
||||
return view('web.shop.thanksreminder', $data);
|
||||
}
|
||||
if($load === 'notactive'){
|
||||
return view('web.shop.notactive', $data);
|
||||
}
|
||||
if($load === 'thanksorder'){
|
||||
$payt = PaymentTransaction::findOrFail($transactionId);
|
||||
if($payt->shopping_payment->reference != $reference){
|
||||
abort(404);
|
||||
}
|
||||
Yard::instance('shopping')->destroy();
|
||||
$checkRepo = new CheckoutRepository();
|
||||
$checkRepo->destroy();
|
||||
if(($payt->status === 'fnc' || $payt->status === 'vor' || $payt->status === 'pp' || $payt->status === 'non') && $payt->txaction === 'prev'){
|
||||
$this->directPaymentStatus($payt, $identifier);
|
||||
}
|
||||
$data = [
|
||||
'user_shop' => $userShop,
|
||||
'order_reference' => $payt->shopping_payment->reference,
|
||||
'pay_trans' => $payt,
|
||||
];
|
||||
return view('web.shop.thanksorder', $data);
|
||||
}
|
||||
|
||||
}
|
||||
public function store($user_shop_id){
|
||||
|
||||
$userShop = UserShop::findOrFail($user_shop_id);
|
||||
$data = Request::all();
|
||||
if(!isset($data['action'])){
|
||||
abort(402);
|
||||
}
|
||||
|
||||
if($data['action'] === 'submit-reminder-service'){
|
||||
return redirect(route('web_shop_goto', ['thanksreminder', $userShop->id]));
|
||||
}
|
||||
if($data['action'] === 'submit-order'){
|
||||
$rules = array(
|
||||
'billing_firstname'=>'required',
|
||||
'billing_lastname'=>'required',
|
||||
'billing_address'=>'required',
|
||||
'billing_zipcode'=>'required',
|
||||
'billing_city' => 'required',
|
||||
'billing_state' => 'required',
|
||||
'billing_email'=>'required|email',
|
||||
);
|
||||
|
||||
if(Request::get('same_as_billing')){
|
||||
$rules = array_merge($rules, [
|
||||
'shipping_firstname'=>'required',
|
||||
'shipping_lastname'=>'required',
|
||||
'shipping_address'=>'required',
|
||||
'shipping_zipcode'=>'required',
|
||||
'shipping_city' => 'required',
|
||||
'shipping_salutation' => 'required'
|
||||
]);
|
||||
}
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return back()->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
$identifier = Util::getToken();
|
||||
$data['is_from'] = 'shopping';
|
||||
$data['is_for'] = 'us'; //usershopping
|
||||
unset($data['_token']);
|
||||
Yard::instance('shopping')->putYardExtra('shopping_data', $data);
|
||||
|
||||
UserHistory::create(['user_id' => $userShop->user_id, 'action'=>'web_shop_payment', 'status'=>1, 'product_id'=>null, 'identifier'=>$identifier]);
|
||||
$checkRepo = new CheckoutRepository();
|
||||
$checkRepo->setUserShop(8, $userShop);
|
||||
$checkRepo->init($identifier, $data);
|
||||
return $checkRepo->makePayment();
|
||||
}
|
||||
}
|
||||
|
||||
private function directPaymentStatus(PaymentTransaction $payt, $identifier){
|
||||
|
||||
if(isset($payt->transmitted_data['param'])){
|
||||
$shopping_order = ShoppingOrder::find($payt->transmitted_data['param']);
|
||||
$shopping_payment = ShoppingPayment::where('reference', $payt->transmitted_data['reference'])->first();
|
||||
|
||||
$shopping_order->txaction = 'open';
|
||||
$shopping_order->save();
|
||||
$payt->txaction = "open";
|
||||
|
||||
//is Promotion Handel it
|
||||
if($shopping_order->promotion_user_id > 0){
|
||||
Payment::handelPromotionProduct($shopping_order);
|
||||
}
|
||||
if($shopping_payment){
|
||||
//Payment::handelUserPayCredits($shopping_order, 'deduction');
|
||||
if($payt->status === 'vor'){
|
||||
$shopping_payment->txaction = 'open';
|
||||
$shopping_order->txaction = 'open';
|
||||
$payt->txaction = "open";
|
||||
$shopping_order->save();
|
||||
|
||||
}
|
||||
if($payt->status === 'pp'){
|
||||
$send_link = Payment::paymentStatusPaidAction($shopping_order, true);
|
||||
$shopping_payment->txaction = 'paid';
|
||||
$shopping_order->txaction = 'paid';
|
||||
$payt->txaction = "paid";
|
||||
$shopping_order->save();
|
||||
}
|
||||
if($payt->status === 'fnc'){
|
||||
$send_link = Payment::paymentStatusPaidAction($shopping_order, true);
|
||||
$shopping_payment->txaction = 'paid';
|
||||
$shopping_order->txaction = 'paid';
|
||||
$payt->txaction = "paid";
|
||||
$shopping_order->save();
|
||||
|
||||
}
|
||||
if($payt->status === 'non'){
|
||||
$send_link = Payment::paymentStatusPaidAction($shopping_order, true);
|
||||
$shopping_payment->txaction = 'paid';
|
||||
$shopping_order->txaction = 'paid';
|
||||
$payt->txaction = "paid";
|
||||
$shopping_order->save();
|
||||
\App\Services\Shop::newUserOrder($shopping_order->shopping_user->number);
|
||||
}
|
||||
$shopping_payment->save();
|
||||
}
|
||||
$payt->save();
|
||||
$data = [
|
||||
'mode' => $payt->transmitted_data['mode'],
|
||||
'txaction' => $payt->txaction,
|
||||
'send_link' => false,
|
||||
];
|
||||
Payment::paymentStatusSendMail($shopping_order, $shopping_payment, $data);
|
||||
}
|
||||
}
|
||||
|
||||
public function load(){
|
||||
$data = Request::all();
|
||||
$ret = "";
|
||||
$status = false;
|
||||
|
||||
if(Request::ajax()){
|
||||
if($data['action'] === 'web-show-product'){
|
||||
$product = Product::find($data['id']); //current user form order
|
||||
$ret = view("web.shop.show_product", compact('product', 'data'))->render();
|
||||
}
|
||||
if(isset($data['perform'])){
|
||||
if($data['action'] === 'switch-show_products'){
|
||||
$category_id = isset($data['show_products_option']) ? $data['show_products_option'] : false;
|
||||
$shop_products = $this->getShowProducts($category_id);
|
||||
$shop_products_view = view("web.shop._shop_products_inner", compact('shop_products'))->render();
|
||||
return response()->json(['response' => $data, 'shop_products_view'=>$shop_products_view, 'status'=>$status]);
|
||||
}
|
||||
if($data['action'] === 'add-shop-product'){
|
||||
$data['qty'] = \App\Services\UserCart::updateProduct($data, true);
|
||||
}
|
||||
if($data['action'] === 'minus-shop-product'){
|
||||
$data['qty'] = \App\Services\UserCart::updateProduct($data, false, true);
|
||||
}
|
||||
if($data['action'] === 'update-shop-product'){
|
||||
$data['qty'] = \App\Services\UserCart::updateProduct($data);
|
||||
}
|
||||
if($data['action'] === 'remove-shop-product'){
|
||||
\App\Services\UserCart::updateProduct($data);
|
||||
$data['qty'] = 0;
|
||||
}
|
||||
if($data['action'] === 'clear-cart'){
|
||||
\App\Services\UserCart::clearCart($data);
|
||||
}
|
||||
if($data['action'] === 'switch-shipping'){
|
||||
\App\Services\UserCart::switchShipping($data);
|
||||
}
|
||||
if($data['action'] === 'change-state-shipping'){
|
||||
\App\Services\UserCart::changeStateShipping($data, 'shop');
|
||||
}
|
||||
|
||||
$cart = view("web.shop._shop_cart", compact('data'))->render();
|
||||
if(Yard::instance('shopping')->isQuickShipping()){
|
||||
$invoice = view("web.components._invoice_details_quick")->render();
|
||||
}else{
|
||||
$invoice = view("web.components._invoice_details")->render();
|
||||
}
|
||||
$checkout = view("web.components._checkout")->render();
|
||||
$data['shipping_price_formated'] = UserCart::getCurrentShippingPrice(3); //shipping_for === 2 promotion , 3 shop
|
||||
|
||||
return response()->json(['response' => $data, 'cart'=>$cart, 'invoice'=>$invoice, 'checkout'=>$checkout, 'status'=>$status, 'basketqty'=>Yard::instance('shopping')->count()]);
|
||||
}
|
||||
return response()->json(['response' => $data, 'html'=>$ret, 'status'=>$status]);
|
||||
}
|
||||
}
|
||||
|
||||
private function getShowProducts($category_id = false){
|
||||
$shop_products = [];
|
||||
if($category_id){
|
||||
$shop_products = Product::where('active', true)->whereJsonContains('show_on', ['8'])
|
||||
->whereHas('categories', function ($query) use ($category_id) {
|
||||
$query->where('category_id', $category_id); //->whereJsonContains('show_on', ['3']);
|
||||
})->orderBy('pos', 'ASC')->get();
|
||||
}else{
|
||||
$shop_products = Product::where('active', true)->whereJsonContains('show_on', ['8'])
|
||||
->orderBy('pos', 'ASC')->get();
|
||||
}
|
||||
return $shop_products;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,22 +2,23 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Mail\MailReleaseAccount;
|
||||
use App\Models\File;
|
||||
use App\Models\Product;
|
||||
use App\Models\ShoppingInstance;
|
||||
use App\Models\UserAccount;
|
||||
use App\Models\UserHistory;
|
||||
use App\Models\UserLevel;
|
||||
use App\Repositories\FileRepository;
|
||||
use App\Services\Util;
|
||||
use App\User;
|
||||
use Auth;
|
||||
use Hash;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Request;
|
||||
use Validator;
|
||||
use Yard;
|
||||
use Request;
|
||||
use App\User;
|
||||
use Validator;
|
||||
use App\Models\File;
|
||||
use App\Services\Util;
|
||||
use App\Models\Product;
|
||||
use App\Models\UserLevel;
|
||||
use App\Models\UserAccount;
|
||||
use App\Models\UserHistory;
|
||||
use App\Mail\MailReleaseAccount;
|
||||
use App\Models\ShoppingInstance;
|
||||
use App\Repositories\FileRepository;
|
||||
use App\Repositories\UserRepository;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class WizardController extends Controller
|
||||
{
|
||||
|
|
@ -150,6 +151,12 @@ class WizardController extends Controller
|
|||
$user->account = new UserAccount();
|
||||
}
|
||||
|
||||
$data = Request::all();
|
||||
if($step == 7 && Request::get('user_country_id')){
|
||||
$user->account->country_id = Request::get('user_country_id');
|
||||
$user->account->save();
|
||||
return redirect(route('wizard_register', [1]));
|
||||
}
|
||||
if ($step == 0) {
|
||||
$rules = array(
|
||||
'accepted_data_protection' => 'required',
|
||||
|
|
@ -185,7 +192,23 @@ class WizardController extends Controller
|
|||
$user->save();
|
||||
return redirect(route('wizard_register'));
|
||||
}
|
||||
|
||||
if ($step == 1) {
|
||||
$data = Request::all();
|
||||
if(isset($data['action']) && $data['action'] == "reverse_charge_validate"){
|
||||
$user->wizard = 1;
|
||||
$user->save();
|
||||
$userRepo = new UserRepository($user);
|
||||
return $userRepo->reverse_charge_validate($data, $user, route('wizard_register', [1]));
|
||||
}
|
||||
|
||||
if(isset($data['action']) && $data['action'] == "reverse_charge_delete"){
|
||||
$user->wizard = 1;
|
||||
$user->save();
|
||||
$userRepo = new UserRepository($user);
|
||||
return $userRepo->reverse_charge_delete($data, $user, route('wizard_register', [1]));
|
||||
}
|
||||
|
||||
$rules = array(
|
||||
'salutation' => 'required',
|
||||
'first_name' => 'required',
|
||||
|
|
@ -198,9 +221,6 @@ class WizardController extends Controller
|
|||
'tax_number' => 'required_without:tax_identification_number',
|
||||
'tax_identification_number' => 'required_without:tax_number',
|
||||
'country_id' => 'required|integer|min:1',
|
||||
'birthday_day' => 'required',
|
||||
'birthday_month' => 'required',
|
||||
'birthday_year' => 'required'
|
||||
);
|
||||
|
||||
if (!Request::get('same_as_billing')) {
|
||||
|
|
@ -220,19 +240,26 @@ class WizardController extends Controller
|
|||
$user->save();
|
||||
return redirect(route('wizard_register', [1]))->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
|
||||
$data = Request::all();
|
||||
$data['same_as_billing'] = Request::get('same_as_billing') == NULL ? 0 : 1;
|
||||
$data['birthday_day'] = isset($data['birthday_day']) ? $data['birthday_day'] : 1;
|
||||
$data['birthday_month'] = isset($data['birthday_month']) ? $data['birthday_month'] : 1;
|
||||
$data['birthday_year'] = isset($data['birthday_year']) ? $data['birthday_year'] : 1970;
|
||||
$data['birthday_year'] = isset($data['birthday_year']) ? $data['birthday_year'] : 1900;
|
||||
$data['birthday'] = $data['birthday_day'].".".$data['birthday_month'].".".$data['birthday_year'];
|
||||
$data['birthday'] = $data['birthday'] == "1.1.1900" ? null : $data['birthday'];
|
||||
$user->account->fill($data)->save();
|
||||
$user->wizard = 2;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register'));
|
||||
}
|
||||
|
||||
if ($step == 2) {
|
||||
/* if ($step == 2) {
|
||||
//kein Ausweis hochladen - deaktiviert
|
||||
dd("deaktiviert");
|
||||
$user->wizard = 3;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register'));
|
||||
/*
|
||||
if(Request::get('submit') === 'do'){
|
||||
if(File::whereUserId($user->id)->whereIdentifier('id_card')->count() == 0){
|
||||
$validator = Validator::make(Request::all(), []);
|
||||
|
|
@ -251,8 +278,10 @@ class WizardController extends Controller
|
|||
$this->fileRepo->_set('identifier', 'id_card');
|
||||
return $this->fileRepo->uploadFile(Request::all());
|
||||
}
|
||||
*/
|
||||
|
||||
if ($step == 3) {
|
||||
if ($step == 2) {
|
||||
$data = Request::all();
|
||||
if(Request::get('submit') === 'do'){
|
||||
$data = Request::all();
|
||||
|
||||
|
|
@ -260,7 +289,7 @@ class WizardController extends Controller
|
|||
if(File::whereUserId($user->id)->whereIdentifier('business_license')->count() == 0){
|
||||
$validator = Validator::make(Request::all(), []);
|
||||
$validator->errors()->add('field', __('Kein Gewerbeschein hinterlegt, bitte erst hochladen.'));
|
||||
$user->wizard = 3;
|
||||
$user->wizard = 2;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register'))->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
|
|
@ -272,7 +301,7 @@ class WizardController extends Controller
|
|||
if(!$data['non_business_license_reason'] || $data['non_business_license_reason'] == ""){
|
||||
$validator = Validator::make(Request::all(), []);
|
||||
$validator->errors()->add('field', __('Bitte gib eine Begründung ein, warum Du keinen Gewerbeschein benötigst.'));
|
||||
$user->wizard = 3;
|
||||
$user->wizard = 2;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register'))->withErrors($validator)->withInput(Request::all());
|
||||
}else{
|
||||
|
|
@ -281,7 +310,7 @@ class WizardController extends Controller
|
|||
}
|
||||
|
||||
$user->account->setNotice('business_license', $data['business_license_choose']);
|
||||
$user->wizard = 4;
|
||||
$user->wizard = 3;
|
||||
$user->save();
|
||||
|
||||
return redirect(route('wizard_register'));
|
||||
|
|
@ -293,7 +322,7 @@ class WizardController extends Controller
|
|||
return $this->fileRepo->uploadFile(Request::all());
|
||||
}
|
||||
|
||||
if ($step == 4) {
|
||||
if ($step == 3) {
|
||||
|
||||
$data = Request::all();
|
||||
|
||||
|
|
@ -397,6 +426,23 @@ class WizardController extends Controller
|
|||
return redirect(route('wizard_create', [12]));
|
||||
}
|
||||
if($step == 12){
|
||||
|
||||
$data = Request::all();
|
||||
|
||||
if(isset($data['action']) && $data['action'] == "reverse_charge_validate"){
|
||||
$user->wizard = 12;
|
||||
$user->save();
|
||||
$userRepo = new UserRepository($user);
|
||||
return $userRepo->reverse_charge_validate($data, $user, route('wizard_create', [12]));
|
||||
}
|
||||
|
||||
if(isset($data['action']) && $data['action'] == "reverse_charge_delete"){
|
||||
$user->wizard = 12;
|
||||
$user->save();
|
||||
$userRepo = new UserRepository($user);
|
||||
return $userRepo->reverse_charge_delete($data, $user, route('wizard_create', [12]));
|
||||
}
|
||||
|
||||
$rules = array(
|
||||
'salutation' => 'required',
|
||||
'first_name' => 'required',
|
||||
|
|
@ -409,9 +455,6 @@ class WizardController extends Controller
|
|||
'tax_number' => 'required_without:tax_identification_number',
|
||||
'tax_identification_number' => 'required_without:tax_number',
|
||||
'country_id' => 'required|integer|min:1',
|
||||
'birthday_day' => 'required',
|
||||
'birthday_month' => 'required',
|
||||
'birthday_year' => 'required'
|
||||
);
|
||||
|
||||
if(!Request::get('same_as_billing')){
|
||||
|
|
@ -464,6 +507,15 @@ class WizardController extends Controller
|
|||
if($product->images->count()){
|
||||
$image = $product->images->first()->slug;
|
||||
}
|
||||
/*need setGlobalTaxRate
|
||||
$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]);
|
||||
if(\App\Services\UserService::getTaxFree()){
|
||||
Yard::setTax($cartItem->rowId, 0);
|
||||
}else{
|
||||
Yard::setTax($cartItem->rowId, $product->getTaxWith(\App\Services\UserService::$user_country));
|
||||
}
|
||||
*/
|
||||
//Keine steuer
|
||||
Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->price, $product->tax, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight]);
|
||||
Yard::instance('shopping')->setGlobalTaxRate(0);
|
||||
|
||||
|
|
@ -475,6 +527,18 @@ class WizardController extends Controller
|
|||
if($product_on_board->images->count()){
|
||||
$image = $product_on_board->images->first()->slug;
|
||||
}
|
||||
|
||||
/*
|
||||
need?
|
||||
$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]);
|
||||
if(\App\Services\UserService::getTaxFree()){
|
||||
Yard::setTax($cartItem->rowId, 0);
|
||||
}else{
|
||||
Yard::setTax($cartItem->rowId, $product->getTaxWith(\App\Services\UserService::$user_country));
|
||||
}
|
||||
*/
|
||||
Yard::instance('shopping')->add($product_on_board->id, $product_on_board->getLang('name'), 1, $product_on_board->price, $product->tax, ['image' => $image, 'slug' => $product_on_board->slug, 'weight' => $product_on_board->weight]);
|
||||
}
|
||||
}
|
||||
|
|
@ -522,10 +586,16 @@ class WizardController extends Controller
|
|||
if($relation === 'upload'){
|
||||
$user = User::findOrFail(Auth::user()->id);
|
||||
$file = $user->files()->findOrFail($id);
|
||||
$identifier = $file->identifier;
|
||||
//remove file
|
||||
\Storage::disk('user')->delete($file->dir.$file->filename);
|
||||
$file->delete();
|
||||
\Session()->flash('alert-success', "Datei gelöscht");
|
||||
if($identifier === 'business_license'){
|
||||
$user->wizard = 2;
|
||||
$user->save();
|
||||
return redirect(route('wizard_register', [2]));
|
||||
}
|
||||
}
|
||||
return back();
|
||||
}
|
||||
|
|
|
|||
46
app/Libraries/InvoicePDF.php
Normal file
46
app/Libraries/InvoicePDF.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
namespace App\Libraries;
|
||||
|
||||
use App\Libraries\CouponPDF;
|
||||
use App\Models\Coupon;
|
||||
use Storage;
|
||||
|
||||
class InvoicePDF{
|
||||
|
||||
protected $view;
|
||||
protected $pdf;
|
||||
|
||||
|
||||
public function __construct($view)
|
||||
{
|
||||
$this->view = $view;
|
||||
}
|
||||
|
||||
public function create($data, $name='test.pdf', $output='stream', $path = false){
|
||||
|
||||
header('Content-type: text/html; charset=UTF-8') ;//chrome
|
||||
//dd($data);
|
||||
|
||||
$pdf = app('dompdf.wrapper');
|
||||
$pdf->getDomPDF();
|
||||
$pdf->set_option("enable_php", true);
|
||||
$pdf->loadView($this->view, $data);
|
||||
$pdf->setPaper('A4', 'portrait');
|
||||
|
||||
if($output === 'stream'){
|
||||
return $pdf->stream($name);
|
||||
}
|
||||
if($output === 'download'){
|
||||
return $pdf->download($name);
|
||||
}
|
||||
|
||||
if($output === 'save'){
|
||||
if($path){
|
||||
$pdf->save($path.$name);
|
||||
return $path.$name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
@ -67,8 +67,8 @@ class MailCheckout extends Mailable
|
|||
'greetings' => __('email.greetings'),
|
||||
'sender' => __('email.sender'),
|
||||
'send_link' => $this->send_link,
|
||||
'url' => Util::getMyMivitaUrl(),
|
||||
'button' => Util::getMyMivitaUrl(false),
|
||||
'url' => Util::getMyUrl(),
|
||||
'button' => Util::getMyUrl(false),
|
||||
'mode' => $this->mode
|
||||
]);
|
||||
}else{
|
||||
|
|
|
|||
63
app/Mail/MailLog.php
Normal file
63
app/Mail/MailLog.php
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
namespace App\Mail;
|
||||
|
||||
use App\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class MailLog extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
protected $channel;
|
||||
protected $context;
|
||||
protected $message;
|
||||
protected $data;
|
||||
|
||||
public $subject;
|
||||
|
||||
public function __construct($channel, $context, $message, $data)
|
||||
{
|
||||
$this->channel = $channel;
|
||||
$this->context = $context;
|
||||
$this->message = $message;
|
||||
$this->data = $data;
|
||||
$this->subject = 'mivita Log';
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function build()
|
||||
{
|
||||
$title = 'Log: '.$this->channel.' '.$this->context;
|
||||
|
||||
//make Data readable
|
||||
$this->data = json_encode($this->data, JSON_PRETTY_PRINT);
|
||||
$content = "";
|
||||
|
||||
|
||||
$content .= "\n";
|
||||
$content .= "Channel: ".$this->channel."\n";
|
||||
$content .= "Context: ".$this->context."\n";
|
||||
if(\Auth::check()){
|
||||
$content .= "From User: ".\Auth::user()->id." | ".\Auth::user()->email."\n";
|
||||
}
|
||||
$content .= "\n";
|
||||
$content .= "Message: ".$this->message."\n";
|
||||
$content .= "\n";
|
||||
$content .= "Data: ".$this->data."\n";
|
||||
$content .= "\n";
|
||||
$content .= "\n";
|
||||
$content .= "Time: ".now()->format("d.m.Y H:i");
|
||||
$content .= "\n";
|
||||
$content .= request()->header('User-Agent');
|
||||
|
||||
|
||||
return $this->view('emails.sys')->with([
|
||||
'title' => $title,
|
||||
'content' => $content,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -12,14 +12,14 @@ class MailVerifyAccount extends Mailable
|
|||
use Queueable, SerializesModels;
|
||||
|
||||
protected $confirmation_code;
|
||||
protected $user;
|
||||
protected $userObj;
|
||||
public $subject;
|
||||
|
||||
|
||||
public function __construct($confirmation_code, User $user)
|
||||
public function __construct($confirmation_code, $userObj)
|
||||
{
|
||||
$this->confirmation_code = $confirmation_code;
|
||||
$this->user = $user;
|
||||
$this->userObj = $userObj;
|
||||
$this->subject = __('email.email_verify');
|
||||
}
|
||||
|
||||
|
|
@ -27,11 +27,11 @@ class MailVerifyAccount extends Mailable
|
|||
public function build()
|
||||
{
|
||||
$salutation = __('email.salutation').",";
|
||||
if($this->user->account){
|
||||
if($this->user->account->salutation === "mr"){
|
||||
$salutation = __('email.dear_sir')." ".$this->user->account->first_name.",";
|
||||
if($this->userObj){
|
||||
if($this->userObj->salutation === "mr"){
|
||||
$salutation = __('email.dear_sir')." ".$this->userObj->first_name.",";
|
||||
}else{
|
||||
$salutation = __('email.dear_mrs')." ".$this->user->account->first_name.",";
|
||||
$salutation = __('email.dear_mrs')." ".$this->userObj->first_name.",";
|
||||
}
|
||||
}
|
||||
return $this->view('emails.auth')->with([
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Services\Util;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
|
|
@ -25,39 +26,66 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Attribute wherePos($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Attribute whereTransName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Attribute whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
* @property string|null $slug
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Attribute whereSlug($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Attribute newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Attribute newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Attribute query()
|
||||
* @property-read int|null $childrens_count
|
||||
* @property int $attribute_type_id
|
||||
* @property string|null $value
|
||||
* @property-read \App\Models\AttributeType $attribute_type
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Attribute whereAttributeTypeId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Attribute whereValue($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Attribute extends Model
|
||||
{
|
||||
protected $table = 'attributes';
|
||||
|
||||
protected $casts = ['trans_name' => 'array'];
|
||||
|
||||
protected $fillable = [
|
||||
'parent_id', 'name', 'pos', 'active',
|
||||
protected $casts = [
|
||||
'parent_id' => 'int',
|
||||
'pos' => 'int',
|
||||
'active' => 'bool',
|
||||
'trans_name' => 'array',
|
||||
];
|
||||
|
||||
|
||||
protected $fillable = [
|
||||
'parent_id',
|
||||
'attribute_type_id',
|
||||
'name',
|
||||
'value',
|
||||
'trans_name',
|
||||
'pos',
|
||||
'active',
|
||||
'slug'
|
||||
];
|
||||
|
||||
public function attribute_type()
|
||||
{
|
||||
return $this->belongsTo(AttributeType::class, 'attribute_type_id');
|
||||
}
|
||||
|
||||
public function parent()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Attribute', 'parent_id');
|
||||
return $this->belongsTo(Attribute::class, 'parent_id');
|
||||
}
|
||||
|
||||
public function childrens()
|
||||
{
|
||||
return $this->hasMany('App\Models\Attribute', 'parent_id', 'id');
|
||||
return $this->hasMany(Attribute::class, 'parent_id', 'id');
|
||||
}
|
||||
|
||||
public function setPosAttribute($value){
|
||||
$this->attributes['pos'] = is_numeric($value) ? $value : null;
|
||||
|
||||
}
|
||||
|
||||
public function getFormattedValue()
|
||||
{
|
||||
// return isset($this->attributes['value']) ? Util::formatNumber($this->attributes['value']) : "";
|
||||
}
|
||||
|
||||
public function getLang($key)
|
||||
{
|
||||
$lang = \App::getLocale();
|
||||
|
|
|
|||
111
app/Models/AttributeType.php
Normal file
111
app/Models/AttributeType.php
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class AttributeType
|
||||
*
|
||||
* @property int $id
|
||||
* @property int|null $parent_id
|
||||
* @property string $name
|
||||
* @property string|null $trans_name
|
||||
* @property int|null $pos
|
||||
* @property bool $active
|
||||
* @property string $slug
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property Attribute|null $attribute
|
||||
* @property Collection|Attribute[] $attributes
|
||||
* @package App\Models
|
||||
* @property string|null $description
|
||||
* @property-read Collection<int, \App\Models\Attribute> $childrens
|
||||
* @property-read int|null $childrens_count
|
||||
* @property-read \App\Models\Attribute|null $parent
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|AttributeType newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|AttributeType newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|AttributeType query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|AttributeType whereActive($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|AttributeType whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|AttributeType whereDescription($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|AttributeType whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|AttributeType whereName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|AttributeType whereParentId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|AttributeType wherePos($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|AttributeType whereSlug($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|AttributeType whereTransName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|AttributeType whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class AttributeType extends Model
|
||||
{
|
||||
protected $table = 'attribute_types';
|
||||
|
||||
protected $casts = [
|
||||
'parent_id' => 'int',
|
||||
'pos' => 'int',
|
||||
'active' => 'bool',
|
||||
'trans_name' => 'array'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'parent_id',
|
||||
'name',
|
||||
'description',
|
||||
'trans_name',
|
||||
'pos',
|
||||
'active',
|
||||
'slug'
|
||||
];
|
||||
|
||||
public function parent()
|
||||
{
|
||||
return $this->belongsTo(Attribute::class, 'parent_id');
|
||||
}
|
||||
|
||||
public function childrens()
|
||||
{
|
||||
return $this->hasMany(Attribute::class, 'parent_id', 'id');
|
||||
}
|
||||
|
||||
public function setPosAttribute($value){
|
||||
$this->attributes['pos'] = is_numeric($value) ? $value : null;
|
||||
}
|
||||
|
||||
public function getLang($key)
|
||||
{
|
||||
$lang = \App::getLocale();
|
||||
if ($lang == 'de') {
|
||||
return $this->{$key};
|
||||
}
|
||||
$trans = $this->getTrans($key, $lang);
|
||||
if (!$trans || $trans == '') {
|
||||
return $this->{$key};
|
||||
}
|
||||
return $trans;
|
||||
}
|
||||
|
||||
public function getTrans($key, $lang)
|
||||
{
|
||||
$key = 'trans_' . $key;
|
||||
if (!empty($this->{$key}[$lang])) {
|
||||
return $this->{$key}[$lang];
|
||||
}
|
||||
}
|
||||
|
||||
public function getTranNames()
|
||||
{
|
||||
$ret = "";
|
||||
foreach ((array) $this->trans_name as $value){
|
||||
$ret .= $value.', ';
|
||||
}
|
||||
return rtrim($ret, ', ');
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Models;
|
||||
|
||||
use App\Services\Type;
|
||||
use App\Models\Product;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Cviebrock\EloquentSluggable\Sluggable;
|
||||
|
||||
|
|
@ -27,7 +28,6 @@ use Cviebrock\EloquentSluggable\Sluggable;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category wherePos($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category whereTransName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
* @property string|null $slug
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ProductCategory[] $product_categories
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category findSimilarSlugs($attribute, $config, $slug)
|
||||
|
|
@ -47,6 +47,9 @@ use Cviebrock\EloquentSluggable\Sluggable;
|
|||
* @property-read \App\Models\IqImage|null $iq_image
|
||||
* @property-read int|null $product_categories_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Category withUniqueSlugConstraints(\Illuminate\Database\Eloquent\Model $model, string $attribute, array $config, string $slug)
|
||||
* @property array|null $show_on
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Category whereShowOn($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Category extends Model
|
||||
{
|
||||
|
|
@ -60,7 +63,7 @@ class Category extends Model
|
|||
'parent_id', 'name', 'headline', 'pos', 'active', 'show_on'
|
||||
];
|
||||
|
||||
public function sluggable()
|
||||
public function sluggable(): array
|
||||
{
|
||||
return [
|
||||
'slug' => [
|
||||
|
|
@ -134,15 +137,21 @@ class Category extends Model
|
|||
return rtrim($ret, ', ');
|
||||
}
|
||||
|
||||
public function getShowOnTypes(){
|
||||
public function getShowOnTypes($seperator = false){
|
||||
$ret = [];
|
||||
if($this->show_on && is_array($this->show_on)){
|
||||
foreach($this->show_on as $show){
|
||||
$ret[] = isset(Type::$showONs[$show]) ? Type::$showONs[$show] : '-';
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
return $seperator ? implode($seperator, $ret) : $ret;
|
||||
}
|
||||
|
||||
public function getProductsCountOn($show_on = ['8']){
|
||||
$category_id = $this->id;
|
||||
return Product::where('active', true)->whereJsonContains('show_on', $show_on)
|
||||
->whereHas('categories', function ($query) use ($category_id) {
|
||||
$query->where('category_id', $category_id); //
|
||||
})->orderBy('pos', 'ASC')->count();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ use PHPUnit\Framework\Constraint\Count;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereIt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country wherePhone($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereRu($value)
|
||||
* @mixin \Eloquent
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country query()
|
||||
|
|
@ -57,6 +56,13 @@ use PHPUnit\Framework\Constraint\Count;
|
|||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\CountryPrice[] $country_prices
|
||||
* @property-read int|null $country_prices_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereCurrencyUnit($value)
|
||||
* @property bool|null $translate
|
||||
* @property bool|null $eu_country
|
||||
* @property bool|null $supply_country
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Country whereEuCountry($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Country whereSupplyCountry($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Country whereTranslate($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Country extends Model
|
||||
{
|
||||
|
|
@ -64,17 +70,19 @@ class Country extends Model
|
|||
|
||||
protected $casts = [
|
||||
'switch' => 'bool',
|
||||
'translate' => 'bool',
|
||||
'supply_country' => 'bool',
|
||||
'eu_country' => 'bool',
|
||||
'own_eur' => 'bool',
|
||||
'currency' => 'bool',
|
||||
'currency_calc' => 'bool',
|
||||
'trans_name' => 'array',
|
||||
'attr' => 'array'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'code', 'phone', 'en', 'de', 'es', 'fr', 'it', 'ru',
|
||||
'switch', 'own_eur', 'currency', 'currency_unit', 'currency_calc', 'currency_faktor',
|
||||
'active', 'trans_name', 'attr',
|
||||
'supply_country', 'eu_country', 'switch', 'translate', 'own_eur', 'currency', 'currency_unit', 'currency_calc', 'currency_faktor',
|
||||
'active', 'attr',
|
||||
];
|
||||
|
||||
public function country_prices()
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CountryPrice whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CountryPrice whereProductId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CountryPrice whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CountryPrice whereCCurrency($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class CountryPrice extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage whereProductId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage whereSize($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
* @property string|null $slug
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage findSimilarSlugs($attribute, $config, $slug)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage whereSlug($value)
|
||||
|
|
@ -39,6 +38,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @property int|null $pos
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqImage wherePos($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|IqImage withUniqueSlugConstraints(\Illuminate\Database\Eloquent\Model $model, string $attribute, array $config, string $slug)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class IqImage extends Model
|
||||
{
|
||||
|
|
@ -51,7 +51,7 @@ class IqImage extends Model
|
|||
'filename', 'original_name', 'ext', 'mine', 'size'
|
||||
];
|
||||
|
||||
public function sluggable()
|
||||
public function sluggable(): array
|
||||
{
|
||||
return [
|
||||
'slug' => [
|
||||
|
|
|
|||
43
app/Models/LeadType.php
Normal file
43
app/Models/LeadType.php
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class LeadType
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property bool $active
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|LeadType newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|LeadType newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|LeadType query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|LeadType whereActive($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|LeadType whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|LeadType whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|LeadType whereName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|LeadType whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class LeadType extends Model
|
||||
{
|
||||
protected $table = 'lead_type';
|
||||
|
||||
protected $casts = [
|
||||
'active' => 'bool'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'active'
|
||||
];
|
||||
}
|
||||
|
|
@ -36,11 +36,11 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentMethod whereShort($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentMethod whereShowAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentMethod whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
* @property string|null $max_price
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PaymentMethod whereMaxPrice($value)
|
||||
* @property array $show_on
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PaymentMethod whereShowOn($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class PaymentMethod extends Model
|
||||
{
|
||||
|
|
@ -71,14 +71,14 @@ class PaymentMethod extends Model
|
|||
return isset(Type::$payShowATs[$this->show_at]) ? Type::$payShowATs[$this->show_at] : '-';
|
||||
}
|
||||
|
||||
public function getShowOnTypes(){
|
||||
public function getShowOnTypes($seperator = false){
|
||||
$ret = [];
|
||||
if($this->show_on && is_array($this->show_on)){
|
||||
foreach($this->show_on as $show){
|
||||
$ret[] = isset(Type::$payShowONs[$show]) ? Type::$payShowONs[$show] : '-';
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
return $seperator ? implode($seperator, $ret) : $ret;
|
||||
}
|
||||
|
||||
public static function getDefaultAsArray($short=false){
|
||||
|
|
@ -105,6 +105,9 @@ class PaymentMethod extends Model
|
|||
$payment_method = PaymentMethod::whereShort($short)->first();
|
||||
|
||||
if($payment_method && $payment_method->active){
|
||||
if(!$user_payment_methods || !is_array($user_payment_methods)){
|
||||
abort(403, 'Fehler: Es sind keine Zahlungsmethoden hinterlegt');
|
||||
}
|
||||
if(in_array($payment_method->id, $user_payment_methods)){
|
||||
if($total > 0 && $payment_method->max_price > 0){
|
||||
if($payment_method->max_price >= $total){
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentTransaction whereTxid($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentTransaction whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentTransaction whereUserid($value)
|
||||
* @mixin \Eloquent
|
||||
* @property string|null $mode
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentTransaction whereMode($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class PaymentTransaction extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Product whereUsage($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\Product withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\Product withoutTrashed()
|
||||
* @mixin \Eloquent
|
||||
* @property string|null $slug
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Product findSimilarSlugs($attribute, $config, $slug)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Product whereSlug($value)
|
||||
|
|
@ -130,6 +129,17 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @property array|null $show_on
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Product whereShortCopy($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Product whereShowOn($value)
|
||||
* @property bool $exclude_stats_sales
|
||||
* @property bool|null $whitelabel
|
||||
* @property string|null $whitelabel_name
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ProductAttribute> $attribute_variants
|
||||
* @property-read int|null $attribute_variants_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ProductImage> $whitelabel_images
|
||||
* @property-read int|null $whitelabel_images_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Product whereExcludeStatsSales($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Product whereWhitelabel($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Product whereWhitelabelName($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Product extends Model
|
||||
{
|
||||
|
|
@ -155,10 +165,12 @@ class Product extends Model
|
|||
'wp_number' => 'int',
|
||||
'single_commission' => 'bool',
|
||||
'amount_commission' => 'bool',
|
||||
'exclude_stats_sales' => 'bool',
|
||||
'active' => 'bool',
|
||||
'shipping_addon' => 'bool',
|
||||
'max_buy' => 'bool',
|
||||
'max_buy_num' => 'int'
|
||||
'max_buy_num' => 'int',
|
||||
'whitelabel' => 'bool',
|
||||
];
|
||||
use Sluggable;
|
||||
|
||||
|
|
@ -168,6 +180,8 @@ class Product extends Model
|
|||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'whitelabel',
|
||||
'whitelabel_name',
|
||||
'title',
|
||||
'copy',
|
||||
'short_copy',
|
||||
|
|
@ -195,12 +209,14 @@ class Product extends Model
|
|||
'amount_commission',
|
||||
'value_commission',
|
||||
'partner_commission',
|
||||
'exclude_stats_sales',
|
||||
'identifier',
|
||||
'action',
|
||||
'upgrade_to_id',
|
||||
'shipping_addon',
|
||||
'max_buy',
|
||||
'max_buy_num'
|
||||
|
||||
];
|
||||
|
||||
public $identifiers_types = [
|
||||
|
|
@ -219,9 +235,6 @@ class Product extends Model
|
|||
4 => 'KG',
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
public $actions = [
|
||||
0 => 'payment_for_account',
|
||||
1 => 'charging_credits',
|
||||
|
|
@ -231,7 +244,7 @@ class Product extends Model
|
|||
|
||||
];
|
||||
|
||||
public function sluggable()
|
||||
public function sluggable(): array
|
||||
{
|
||||
return [
|
||||
'slug' => [
|
||||
|
|
@ -241,19 +254,28 @@ class Product extends Model
|
|||
}
|
||||
|
||||
public function attributes(){
|
||||
return $this->hasMany('App\Models\ProductAttribute', 'product_id', 'id');
|
||||
return $this->hasMany(ProductAttribute::class, 'product_id', 'id')->where('type_id','!=', 1);
|
||||
}
|
||||
|
||||
public function attribute_variants(){
|
||||
return $this->hasMany(ProductAttribute::class, 'product_id', 'id')->where('type_id','=', 1);
|
||||
}
|
||||
|
||||
|
||||
public function categories(){
|
||||
return $this->hasMany('App\Models\ProductCategory', 'product_id', 'id');
|
||||
}
|
||||
|
||||
public function images(){
|
||||
return $this->hasMany('App\Models\ProductImage', 'product_id', 'id')->orderBy('pos');
|
||||
return $this->hasMany(ProductImage::class, 'product_id', 'id')->where('type','=', 'product')->orderBy('pos');
|
||||
}
|
||||
|
||||
public function imagesActive(){
|
||||
return $this->hasMany('App\Models\ProductImage', 'product_id', 'id')->where('active', true)->orderBy('pos');
|
||||
return $this->hasMany(ProductImage::class, 'product_id', 'id')->where('type','=', 'product')->where('active', true)->orderBy('pos');
|
||||
}
|
||||
|
||||
public function whitelabel_images(){
|
||||
return $this->hasMany(ProductImage::class, 'product_id', 'id')->where('type','=', 'wllogo')->orderBy('pos');
|
||||
}
|
||||
|
||||
public function country_prices()
|
||||
|
|
@ -291,6 +313,11 @@ class Product extends Model
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getWhiteLableName($id = 0){
|
||||
return $this->whitelabel_name ? $this->whitelabel_name : $this->name;
|
||||
}
|
||||
|
||||
public function _format_number($value){
|
||||
return preg_replace("/[^0-9,]/", "", $value);
|
||||
}
|
||||
|
|
@ -330,9 +357,9 @@ class Product extends Model
|
|||
return isset($this->attributes['price_ek']) ? Util::formatNumber($this->attributes['price_ek']) : "";
|
||||
}
|
||||
|
||||
public function getFormattedTax()
|
||||
public function getFormattedTax($country = null)
|
||||
{
|
||||
return isset($this->attributes['tax']) ? Util::formatNumber($this->attributes['tax'], 0) : "";
|
||||
return isset($this->attributes['tax']) ? Util::formatNumber($this->getTaxWith($country), 0) : "";
|
||||
}
|
||||
|
||||
public function getFormattedPriceOld()
|
||||
|
|
@ -362,24 +389,38 @@ class Product extends Model
|
|||
return $price;
|
||||
}
|
||||
/*price net*/
|
||||
private function calcPriceNet($price){
|
||||
$tax_rate = ($this->attributes['tax'] + 100) / 100;
|
||||
|
||||
private function calcPriceNet($price, $country=null){
|
||||
$tax = $this->getTaxWith($country);
|
||||
$tax_rate = ($tax + 100) / 100;
|
||||
return $price / $tax_rate;
|
||||
}
|
||||
|
||||
//price calu with
|
||||
public function getPriceWith(Bool $net = true, Bool $ufactor = true){
|
||||
$price = $this->attributes['price'];
|
||||
$price = $net ? $this->calcPriceNet($price) : $price;
|
||||
public function getPriceWith(Bool $net = true, Bool $ufactor = true, $country = null, $commission=false){
|
||||
$price = isset($this->attributes['price']) ? $this->attributes['price'] : null;
|
||||
|
||||
/*$cprice = $country ? $this->getCPrice($country) : null; //eigener Preis für Land
|
||||
$price = $cprice ? $cprice : $price; */
|
||||
|
||||
$price = $net ? $this->calcPriceNet($price, $country) : $price;
|
||||
$price = $ufactor ? $this->calcPriceUserFactor($price) : $price;
|
||||
$price = $commission ? $this->calcPriceUserCommission($price) : $price;
|
||||
return round($price, 2);
|
||||
}
|
||||
|
||||
/*out*/
|
||||
public function getFormattedPriceWith(Bool $net = true, Bool $ufactor = true)
|
||||
{
|
||||
return isset($this->attributes['price']) ? Util::formatNumber($this->getPriceWith($net, $ufactor)) : "";
|
||||
}
|
||||
|
||||
public function getTaxWith($country = null){
|
||||
$tax = isset($this->attributes['tax']) ? $this->attributes['tax'] : null;
|
||||
$ctax = $country ? $this->getCTax($country) : null;
|
||||
return $ctax !== null ? $ctax : $tax;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getBasePriceFormattedFull(){
|
||||
if($price = $this->getBasePrice()){
|
||||
|
|
@ -424,14 +465,14 @@ class Product extends Model
|
|||
return isset(Type::$showATs[$this->show_at]) ? Type::$showATs[$this->show_at] : '-';
|
||||
}
|
||||
|
||||
public function getShowOnTypes(){
|
||||
public function getShowOnTypes($seperator = false){
|
||||
$ret = [];
|
||||
if($this->show_on && is_array($this->show_on)){
|
||||
foreach($this->show_on as $show){
|
||||
$ret[] = isset(Type::$showONs[$show]) ? Type::$showONs[$show] : '-';
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
return $seperator ? implode($seperator, $ret) : $ret;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -493,5 +534,15 @@ class Product extends Model
|
|||
return $this->price;
|
||||
}
|
||||
|
||||
public function getFormattedPriceCurrencyWith(Bool $net = true, Bool $ufactor = true, Country $country = null, $commission = false){
|
||||
$ret = "";
|
||||
if($country && isset($country->currency) && $country->currency){
|
||||
$price = $this->getPriceWith($net, $ufactor, $country, $commission);
|
||||
$ret = formatNumber($price * $country->currency_faktor)." ".$country->currency_unit;
|
||||
return '<br><span class="small">~'.$ret.'<span>';
|
||||
}
|
||||
return "" ;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,44 +1,66 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* App\Models\ProductAttribute
|
||||
* Class ProductAttribute
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $product_id
|
||||
* @property int $attribute_id
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property-read \App\Models\Attribute $attribute
|
||||
* @property-read \App\Models\Product $product
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductAttribute whereAttributeId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductAttribute whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductAttribute whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductAttribute whereProductId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductAttribute whereUpdatedAt($value)
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property Attribute $attribute
|
||||
* @property Product $product
|
||||
* @package App\Models
|
||||
* @property int $type_id
|
||||
* @property-read \App\Models\AttributeType $attribute_type
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProductAttribute newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProductAttribute newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProductAttribute query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProductAttribute whereAttributeId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProductAttribute whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProductAttribute whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProductAttribute whereProductId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProductAttribute whereTypeId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProductAttribute whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductAttribute newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductAttribute newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductAttribute query()
|
||||
*/
|
||||
class ProductAttribute extends Model
|
||||
{
|
||||
protected $table = 'product_attributes';
|
||||
|
||||
protected $fillable = [
|
||||
'product_id', 'attribute_id',
|
||||
protected $casts = [
|
||||
'product_id' => 'int',
|
||||
'type_id' => 'int',
|
||||
'attribute_id' => 'int'
|
||||
];
|
||||
|
||||
public function product()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Product', 'product_id');
|
||||
}
|
||||
protected $fillable = [
|
||||
'product_id',
|
||||
'type_id',
|
||||
'attribute_id'
|
||||
];
|
||||
|
||||
public function attribute()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Attribute', 'attribute_id');
|
||||
return $this->belongsTo(Attribute::class);
|
||||
}
|
||||
|
||||
public function attribute_type()
|
||||
{
|
||||
return $this->belongsTo(AttributeType::class);
|
||||
}
|
||||
|
||||
public function product()
|
||||
{
|
||||
return $this->belongsTo(Product::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,10 +20,14 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductCategory whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductCategory whereProductId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductCategory whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductCategory newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductCategory newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductCategory query()
|
||||
* @property int|null $pos
|
||||
* @property array|null $show_on
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProductCategory wherePos($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProductCategory whereShowOn($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class ProductCategory extends Model
|
||||
{
|
||||
|
|
@ -47,14 +51,14 @@ class ProductCategory extends Model
|
|||
return $this->belongsTo('App\Models\Category', 'category_id');
|
||||
}
|
||||
|
||||
public function getShowOnTypes(){
|
||||
public function getShowOnTypes($seperator = false){
|
||||
$ret = [];
|
||||
if($this->show_on && is_array($this->show_on)){
|
||||
foreach($this->show_on as $show){
|
||||
$ret[] = isset(Type::$showONs[$show]) ? Type::$showONs[$show] : '-';
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
return $seperator ? implode($seperator, $ret) : $ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage whereProductId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage whereSize($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
* @property string|null $slug
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage findSimilarSlugs($attribute, $config, $slug)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage whereSlug($value)
|
||||
|
|
@ -39,6 +38,14 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @property int|null $pos
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage wherePos($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProductImage withUniqueSlugConstraints(\Illuminate\Database\Eloquent\Model $model, string $attribute, array $config, string $slug)
|
||||
* @property int|null $user_wl_product_id
|
||||
* @property string|null $type
|
||||
* @property object|null $attributes
|
||||
* @property-read \App\Models\UserWhitelabelProduct|null $user_wl_product
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProductImage whereAttributes($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProductImage whereType($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProductImage whereUserWlProductId($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class ProductImage extends Model
|
||||
{
|
||||
|
|
@ -47,11 +54,15 @@ class ProductImage extends Model
|
|||
|
||||
protected $table = 'product_images';
|
||||
|
||||
protected $fillable = [
|
||||
'product_id', 'filename', 'original_name', 'ext', 'mine', 'size'
|
||||
protected $casts = [
|
||||
'attributes' => 'object'
|
||||
];
|
||||
|
||||
public function sluggable()
|
||||
protected $fillable = [
|
||||
'product_id', 'user_wl_product_id', 'type', 'filename', 'original_name', 'ext', 'mine', 'size', 'attributes'
|
||||
];
|
||||
|
||||
public function sluggable(): array
|
||||
{
|
||||
return [
|
||||
'slug' => [
|
||||
|
|
@ -65,6 +76,11 @@ class ProductImage extends Model
|
|||
return $this->belongsTo('App\Models\Product', 'product_id');
|
||||
}
|
||||
|
||||
public function user_wl_product()
|
||||
{
|
||||
return $this->belongsTo('App\Models\UserWhitelabelProduct', 'user_wl_product_id');
|
||||
}
|
||||
|
||||
public function formatBytes($precision = 2)
|
||||
{
|
||||
$size = $this->size;
|
||||
|
|
@ -80,4 +96,23 @@ class ProductImage extends Model
|
|||
}
|
||||
}
|
||||
|
||||
public function getImagePath()
|
||||
{
|
||||
if($this->type === 'uwllogo'){
|
||||
return '/images/user_product/'.$this->user_wl_product_id .'/'.$this->filename;
|
||||
}
|
||||
if($this->type === 'product'){
|
||||
return '/images/product/'.$this->product_id .'/'.$this->filename;
|
||||
}
|
||||
if($this->type === 'wllogo'){
|
||||
return '/images/product/'.$this->product_id .'/'.$this->filename;
|
||||
}
|
||||
|
||||
return '/images/product/'.$this->product_id .'/'.$this->filename;
|
||||
}
|
||||
|
||||
|
||||
public function getBaseImagePath(){
|
||||
return base_path()."/storage/app/public".$this->getImagePath();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ use Illuminate\Database\Eloquent\Collection;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionAdmin whereName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionAdmin whereTo($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionAdmin whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
* @property int|null $type
|
||||
* @property bool $shop
|
||||
* @property-read Collection|\App\Models\PromotionAdminProduct[] $promotion_admin_products
|
||||
|
|
@ -57,6 +56,7 @@ use Illuminate\Database\Eloquent\Collection;
|
|||
* @property string|null $user_about
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionAdmin whereUserAbout($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionAdmin whereUserDescription($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class PromotionAdmin extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUser whereUrl($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUser whereUsedBudgetTotal($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUser whereUserDeletedAt($value)
|
||||
* @mixin \Eloquent
|
||||
* @property int $user_id
|
||||
* @property string|null $user_address
|
||||
* @property-read Collection|\App\Models\PromotionUserProduct[] $promotion_user_products
|
||||
|
|
@ -60,6 +59,9 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUser whereAboutYou($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUser whereInternalDescription($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUser whereInternalName($value)
|
||||
* @property-read Collection<int, \App\Models\PromotionUserOrder> $promotion_user_orders
|
||||
* @property-read int|null $promotion_user_orders_count
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class PromotionUser extends Model
|
||||
{
|
||||
|
|
@ -71,7 +73,7 @@ class PromotionUser extends Model
|
|||
'pick_up' => 'bool',
|
||||
'used_budget_total' => 'float',
|
||||
'sell_items_total' => 'int',
|
||||
'active' => 'bool'
|
||||
'active' => 'bool',
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
|
|
@ -132,7 +134,6 @@ class PromotionUser extends Model
|
|||
}
|
||||
|
||||
|
||||
|
||||
public function getUrlPreview()
|
||||
{
|
||||
return $this->url ? config('app.promo_url')."/".$this->url : "";
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUserOrder whereStatus($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUserOrder whereTaxRate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUserOrder whereUpdatedAt($value)
|
||||
* @property bool|null $pick_up
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|PromotionUserOrder wherePickUp($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class PromotionUserOrder extends Model
|
||||
|
|
|
|||
|
|
@ -43,10 +43,10 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|Setting whereText($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Setting whereType($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Setting whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
* @property int|null $int
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Setting whereInt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Setting withUniqueSlugConstraints(\Illuminate\Database\Eloquent\Model $model, string $attribute, array $config, string $slug)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Setting extends Model
|
||||
{
|
||||
|
|
@ -84,7 +84,7 @@ class Setting extends Model
|
|||
|
||||
];
|
||||
|
||||
public function sluggable()
|
||||
public function sluggable(): array
|
||||
{
|
||||
return [
|
||||
'slug' => [
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Shipping whereName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Shipping whereTransName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Shipping whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ShippingPrice[] $shipping_prices
|
||||
* @property-read int|null $shipping_prices_count
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Shipping extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingCountry whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingCountry whereShippingId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingCountry whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ShoppingOrder[] $shopping_orders
|
||||
* @property-read int|null $shopping_orders_count
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class ShippingCountry extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice whereWeightFrom($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice whereWeightTo($value)
|
||||
* @mixin \Eloquent
|
||||
* @property-write mixed $tax
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice whereTaxRate($value)
|
||||
* @property float|null $price_comp
|
||||
|
|
@ -43,6 +42,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingPrice wherePriceComp($value)
|
||||
* @property int|null $shipping_for
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShippingPrice whereShippingFor($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class ShippingPrice extends Model
|
||||
{
|
||||
|
|
@ -54,7 +54,8 @@ class ShippingPrice extends Model
|
|||
|
||||
public static $shippingForTypes = [
|
||||
1 => 'Berater Bestellungen',
|
||||
2 => 'Shop Bestellungen',
|
||||
2 => 'Promotion Bestellungen',
|
||||
3 => 'Shop Bestellungen',
|
||||
];
|
||||
|
||||
public function shipping()
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereUserShopId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereWeight($value)
|
||||
* @mixin \Eloquent
|
||||
* @property int|null $payment_for
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder wherePaymentFor($value)
|
||||
* @property int|null $member_id
|
||||
|
|
@ -104,6 +103,9 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @property-read \App\Models\PromotionUser|null $promotion_user
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder wherePromotionUserId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereShippingOption($value)
|
||||
* @property array|null $delivery
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereDelivery($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class ShoppingOrder extends Model
|
||||
{
|
||||
|
|
@ -116,10 +118,10 @@ class ShoppingOrder extends Model
|
|||
'shopping_user_id',
|
||||
'auth_user_id',
|
||||
'promotion_user_id',
|
||||
'user_shop_id',
|
||||
'member_id',
|
||||
'payment_for',
|
||||
'country_id',
|
||||
'user_shop_id',
|
||||
'total',
|
||||
'subtotal_full',
|
||||
'discount',
|
||||
|
|
@ -135,6 +137,7 @@ class ShoppingOrder extends Model
|
|||
'weight',
|
||||
'paid',
|
||||
'invoice',
|
||||
'delivery',
|
||||
'invoice_number',
|
||||
'txaction',
|
||||
'wp_invoice_path',
|
||||
|
|
@ -149,6 +152,7 @@ class ShoppingOrder extends Model
|
|||
protected $casts = [
|
||||
'wp_notice' => 'array',
|
||||
'invoice' => 'array',
|
||||
'delivery' => 'array',
|
||||
'shipped_at' => 'datetime',
|
||||
];
|
||||
|
||||
|
|
@ -196,10 +200,10 @@ class ShoppingOrder extends Model
|
|||
|
||||
public static $apiShippedTypes = [
|
||||
0 => 'open', //(Fullfilment durch Händler)',
|
||||
1 => 'process', //(Fullfilment durch MIVITA: nicht Versand)
|
||||
2 => 'sent', //(Fullfilment durch MIVITA: Versand erfolgt)'
|
||||
3 => 'close', //(Fullfilment durch MIVITA: Versand erfolgt)',
|
||||
4 => 'pick_up', //(Fullfilment durch MIVITA: Versand erfolgt)',
|
||||
1 => 'process', //(Fullfilment: nicht Versand)
|
||||
2 => 'sent', //(Fullfilment: Versand erfolgt)'
|
||||
3 => 'close', //(Fullfilment: Versand erfolgt)',
|
||||
4 => 'pick_up', //(Fullfilment: Versand erfolgt)',
|
||||
10 => 'cancel'
|
||||
];
|
||||
|
||||
|
|
@ -232,6 +236,11 @@ class ShoppingOrder extends Model
|
|||
return $this->belongsTo('App\Models\PromotionUser','promotion_user_id');
|
||||
}
|
||||
|
||||
public function user_shop()
|
||||
{
|
||||
return $this->belongsTo('App\Models\UserShop','user_shop_id');
|
||||
}
|
||||
|
||||
//can null
|
||||
public function member()
|
||||
{
|
||||
|
|
@ -367,6 +376,11 @@ class ShoppingOrder extends Model
|
|||
}
|
||||
return $count;
|
||||
}
|
||||
|
||||
public function isInvoice(){
|
||||
return $this->user_invoice ? true : false;
|
||||
}
|
||||
|
||||
public function isPickUp(){
|
||||
return $this->shipping_option === 'pick_up' ? true : false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrderItem whereShoppingOrderId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrderItem whereSlug($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrderItem whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
* @property float|null $tax_rate
|
||||
* @property \Illuminate\Support\Carbon|null $deleted_at
|
||||
* @property string|null $user_deleted_at
|
||||
|
|
@ -48,6 +47,9 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @property int|null $free_product_id
|
||||
* @property-read \App\Models\PromotionUserProduct|null $promotion_user_product
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrderItem whereFreeProductId($value)
|
||||
* @property bool|null $handle
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrderItem whereHandle($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class ShoppingOrderItem extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrderMargin whereStatus($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrderMargin whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrderMargin whereUserId($value)
|
||||
* @mixin \Eloquent
|
||||
* @property \Illuminate\Support\Carbon|null $partner_commission_pending_to
|
||||
* @property bool|null $partner_commission_paid
|
||||
* @property-read User|null $m_sponsor
|
||||
|
|
@ -59,6 +58,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrderMargin wherePartnerCommissionPendingTo($value)
|
||||
* @property int|null $user_credit_id
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrderMargin whereUserCreditId($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class ShoppingOrderMargin extends Model
|
||||
{
|
||||
|
|
@ -73,9 +73,12 @@ class ShoppingOrderMargin extends Model
|
|||
'from_payment_credit' => 'float',
|
||||
'm_sponsor_id' => 'int',
|
||||
'net_partner_commission' => 'float',
|
||||
'paid' => 'bool',
|
||||
'cancellation' => 'bool',
|
||||
'status' => 'int',
|
||||
'order_paid' => 'bool', //ist die Bestellung bezahlt?
|
||||
'out_paid' => 'bool', //ist die Provision Marge ausgezahlt?
|
||||
'cancellation' => 'bool', //ist die Stornierung beantragt?
|
||||
'status' => 'int', //status der Bestellung
|
||||
'margin_pending_to' => 'datetime',
|
||||
'margin_paid' => 'bool',
|
||||
'partner_commission_pending_to' => 'datetime',
|
||||
'partner_commission_paid' => 'bool',
|
||||
'user_credit_id' => 'int',
|
||||
|
|
@ -95,15 +98,29 @@ class ShoppingOrderMargin extends Model
|
|||
'm_sponsor_id',
|
||||
'net_partner_commission',
|
||||
'from',
|
||||
'paid',
|
||||
'order_paid',
|
||||
'out_paid',
|
||||
'cancellation',
|
||||
'status',
|
||||
'margin_pending_to',
|
||||
'margin_paid',
|
||||
'partner_commission_pending_to',
|
||||
'partner_commission_paid',
|
||||
'user_credit_id',
|
||||
'content'
|
||||
];
|
||||
|
||||
|
||||
public static $statusTypes = [
|
||||
0 => 'user order',
|
||||
1 => '',
|
||||
7 => 'from promotion',
|
||||
8 => 'from shop',
|
||||
9 => 'storniert'
|
||||
];
|
||||
|
||||
private $storedContent;
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
|
|
@ -131,4 +148,33 @@ class ShoppingOrderMargin extends Model
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getFormattedNetDiscount()
|
||||
{
|
||||
return formatNumber($this->attributes['net_discount']);
|
||||
}
|
||||
|
||||
public function getFormattedNetPartnerCommission()
|
||||
{
|
||||
return formatNumber($this->attributes['net_partner_commission']);
|
||||
}
|
||||
|
||||
public function getRestoreContent($key = false)
|
||||
{
|
||||
if(!$this->storedContent){
|
||||
$this->storedContent = unserialize($this->attributes['content']);
|
||||
}
|
||||
if (is_array($this->storedContent)) {
|
||||
switch ($key) {
|
||||
case 'items':
|
||||
return $this->storedContent['items'];
|
||||
break;
|
||||
case 'commission':
|
||||
return $this->storedContent['commission'];
|
||||
break;
|
||||
|
||||
}
|
||||
return $this->storedContent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,9 +38,9 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingPayment whereTxaction($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingPayment whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingPayment whereWallettype($value)
|
||||
* @mixin \Eloquent
|
||||
* @property string|null $mode
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingPayment whereMode($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class ShoppingPayment extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -69,7 +69,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereShippingSalutation($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereShippingZipcode($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
* @property int|null $orders
|
||||
* @property-read \App\Models\ShoppingOrder $shopping_order
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ShoppingOrder[] $shopping_orders
|
||||
|
|
@ -113,6 +112,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereIsFrom($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereShippingEmail($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereShoppingUserId($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class ShoppingUser extends Model
|
||||
{
|
||||
|
|
@ -274,7 +274,7 @@ class ShoppingUser extends Model
|
|||
}
|
||||
return 0;
|
||||
case 'shopping':
|
||||
return $this->is_for === 'pr' ? 7 : 8; //7 Promotion
|
||||
return $this->is_for === 'pr' ? 7 : 8; //7 Promotion //8 Shop
|
||||
case 'extern':
|
||||
return 10;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereSlug($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereStatus($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|SySetting withUniqueSlugConstraints(\Illuminate\Database\Eloquent\Model $model, string $attribute, array $config, string $slug)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class SySetting extends Model
|
||||
{
|
||||
|
|
@ -63,7 +63,7 @@ class SySetting extends Model
|
|||
1 => 'default',
|
||||
];
|
||||
|
||||
public function sluggable()
|
||||
public function sluggable(): array
|
||||
{
|
||||
return [
|
||||
'slug' => [
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ use Carbon\Carbon;
|
|||
* @method static bool|null restore()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\UserAccount withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\UserAccount withoutTrashed()
|
||||
* @mixin \Eloquent
|
||||
* @property int $id
|
||||
* @property string|null $salutation
|
||||
* @property string|null $first_name
|
||||
|
|
@ -121,6 +120,13 @@ use Carbon\Carbon;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereNotice($value)
|
||||
* @property string|null $about_you
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserAccount whereAboutYou($value)
|
||||
* @property int $reverse_charge
|
||||
* @property string|null $reverse_charge_code
|
||||
* @property string|null $reverse_charge_valid
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserAccount whereReverseCharge($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserAccount whereReverseChargeCode($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserAccount whereReverseChargeValid($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class UserAccount extends Model
|
||||
{
|
||||
|
|
@ -196,6 +202,12 @@ class UserAccount extends Model
|
|||
return Carbon::parse($this->attributes['accept_contract'])->format(\Util::formatDateTimeDB());
|
||||
}
|
||||
|
||||
public function getReverseChargeValidFormat(){
|
||||
if(!$this->attributes['reverse_charge_valid']){ return ""; }
|
||||
return Carbon::parse($this->attributes['reverse_charge_valid'])->format(\Util::formatDateTimeDB());
|
||||
}
|
||||
|
||||
|
||||
public function getPaymentData($key)
|
||||
{
|
||||
return isset($this->payment_data[$key]) ? $this->payment_data[$key] : '';
|
||||
|
|
|
|||
|
|
@ -44,13 +44,13 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereTotal($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereUserMargins($value)
|
||||
* @mixin \Eloquent
|
||||
* @property string|null $credit_number
|
||||
* @property string|null $date
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereCreditNumber($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereDate($value)
|
||||
* @property object|null $user_credits
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereUserCredits($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class UserCredit extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Services\Util;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
|
|
@ -33,9 +34,9 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditMargin whereStatus($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditMargin whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditMargin whereUserId($value)
|
||||
* @mixin \Eloquent
|
||||
* @property int|null $user_credit_id
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditMargin whereUserCreditId($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class UserCreditMargin extends Model
|
||||
{
|
||||
|
|
@ -75,4 +76,8 @@ class UserCreditMargin extends Model
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getFormattedCredit(){
|
||||
return Util::formatNumber($this->credit);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,11 +38,11 @@ use App\User;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserHistory whereStatus($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserHistory whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserHistory whereUserId($value)
|
||||
* @mixin \Eloquent
|
||||
* @property string|null $identifier
|
||||
* @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
|
||||
*/
|
||||
class UserHistory extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel wherePos($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel whereTransName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserLevel whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
* @property string|null $content
|
||||
* @property array|null $trans_content
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel whereContent($value)
|
||||
|
|
@ -37,6 +36,9 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\UserLevelMargin[] $user_level_margins_re
|
||||
* @property-read int|null $user_level_margins_re_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel wherePartnerProvision($value)
|
||||
* @property bool $payment_year
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserLevel wherePaymentYear($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class UserLevel extends Model
|
||||
{
|
||||
|
|
|
|||
45
app/Models/UserRegister.php
Normal file
45
app/Models/UserRegister.php
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class UserRegister
|
||||
*
|
||||
* @property string $identifier
|
||||
* @property string $instance
|
||||
* @property string $content
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserRegister newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserRegister newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserRegister query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserRegister whereContent($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserRegister whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserRegister whereIdentifier($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserRegister whereInstance($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserRegister whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class UserRegister extends Model
|
||||
{
|
||||
protected $table = 'user_registers';
|
||||
public $incrementing = false;
|
||||
|
||||
protected $casts = [
|
||||
'content' => 'object'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'identifier', 'instance', 'content'
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
132
app/Models/UserShop.php
Normal file
132
app/Models/UserShop.php
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class UserShop
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property string|null $url
|
||||
* @property string|null $name
|
||||
* @property string|null $description
|
||||
* @property string|null $about_you
|
||||
* @property string|null $user_address
|
||||
* @property string|null $trans
|
||||
* @property bool $pick_up
|
||||
* @property bool $active
|
||||
* @property Carbon|null $active_date
|
||||
* @property string|null $featured
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property string|null $deleted_at
|
||||
* @property User $user
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop onlyTrashed()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereAboutYou($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereActive($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereActiveDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereDeletedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereDescription($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereFeatured($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop wherePickUp($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereTrans($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereUrl($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereUserAddress($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop whereUserId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop withTrashed()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserShop withoutTrashed()
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class UserShop extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'user_shops';
|
||||
|
||||
protected $casts = [
|
||||
'user_id' => 'int',
|
||||
'pick_up' => 'bool',
|
||||
'active' => 'bool',
|
||||
'featured' => 'array',
|
||||
'trans' => 'array',
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'active_date'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'url',
|
||||
'name',
|
||||
'description',
|
||||
'about_you',
|
||||
'user_address',
|
||||
'trans',
|
||||
'pick_up',
|
||||
'active',
|
||||
'active_date',
|
||||
'featured'
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function getUrlPreview()
|
||||
{
|
||||
return $this->url ? config('app.shop_url')."/".$this->url : "";
|
||||
}
|
||||
|
||||
public function getLang($key, $default = true)
|
||||
{
|
||||
$lang = \App::getLocale();
|
||||
if ($lang == 'de') {
|
||||
return $this->{$key};
|
||||
}
|
||||
return $this->getTrans($key, $lang, $default);
|
||||
}
|
||||
|
||||
public function getTrans($key, $lang, $default = true)
|
||||
{
|
||||
if ($lang == 'de') {
|
||||
return $this->{$key};
|
||||
}
|
||||
if(!empty($this->trans[$lang][$key])){
|
||||
return $this->trans[$lang][$key];
|
||||
}
|
||||
if($default){
|
||||
return !empty($this->{$key}) ? $this->{$key} : '';
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public function isActive(){
|
||||
if($this->active){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getSubdomain(){
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -8,7 +8,6 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* App\Models\UserUpdateEmail
|
||||
*
|
||||
* @property-read \App\User $user
|
||||
* @mixin \Eloquent
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserUpdateEmail newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserUpdateEmail newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserUpdateEmail query()
|
||||
|
|
@ -20,6 +19,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserUpdateEmail whereEmail($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserUpdateEmail whereToken($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserUpdateEmail whereUserId($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class UserUpdateEmail extends Model
|
||||
{
|
||||
|
|
|
|||
79
app/Models/UserWhitelabelProduct.php
Normal file
79
app/Models/UserWhitelabelProduct.php
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class UserWhitelabelProduct
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property int $product_id
|
||||
* @property string|null $info
|
||||
* @property string|null $attributes
|
||||
* @property string|null $options
|
||||
* @property bool $active
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property Product $product
|
||||
* @property User $user
|
||||
* @package App\Models
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ProductImage> $whitelabel_images
|
||||
* @property-read int|null $whitelabel_images_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserWhitelabelProduct newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserWhitelabelProduct newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserWhitelabelProduct query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserWhitelabelProduct whereActive($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserWhitelabelProduct whereAttributes($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserWhitelabelProduct whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserWhitelabelProduct whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserWhitelabelProduct whereInfo($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserWhitelabelProduct whereOptions($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserWhitelabelProduct whereProductId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserWhitelabelProduct whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserWhitelabelProduct whereUserId($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class UserWhitelabelProduct extends Model
|
||||
{
|
||||
protected $table = 'user_whitelabel_products';
|
||||
|
||||
protected $casts = [
|
||||
'user_id' => 'int',
|
||||
'product_id' => 'int',
|
||||
'active' => 'bool',
|
||||
'attributes' => 'object',
|
||||
'options' => 'object'
|
||||
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'product_id',
|
||||
'info',
|
||||
'attributes',
|
||||
'options',
|
||||
'active'
|
||||
];
|
||||
|
||||
public function product()
|
||||
{
|
||||
return $this->belongsTo(Product::class);
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function whitelabel_images(){
|
||||
return $this->hasMany(ProductImage::class, 'user_wl_product_id', 'id')->where('type','=', 'uwllogo')->orderBy('pos');
|
||||
}
|
||||
}
|
||||
|
|
@ -5,21 +5,24 @@ namespace App\Repositories;
|
|||
use Yard;
|
||||
use App\Services\Shop;
|
||||
use App\Services\Util;
|
||||
use App\Models\UserShop;
|
||||
use App\Models\ShoppingUser;
|
||||
use App\Models\PromotionUser;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Models\ShoppingOrderItem;
|
||||
use App\Services\CustomerPriority;
|
||||
use Illuminate\Support\Collection;
|
||||
use App\Models\ShoppingOrderMargin;
|
||||
use Illuminate\Session\SessionManager;
|
||||
use App\Http\Controllers\Pay\PayController;
|
||||
|
||||
|
||||
|
||||
class CheckoutRepository {
|
||||
|
||||
private $payment_for;
|
||||
private $PromotionUser;
|
||||
private $UserShop;
|
||||
|
||||
private $is_for;
|
||||
private $session;
|
||||
private $instance;
|
||||
private $shopping_user;
|
||||
|
|
@ -38,6 +41,14 @@ class CheckoutRepository {
|
|||
{
|
||||
$this->payment_for = $payment_for;
|
||||
$this->PromotionUser = $PromotionUser;
|
||||
$this->is_for = 'pr';
|
||||
}
|
||||
|
||||
public function setUserShop($payment_for, UserShop $UserShop)
|
||||
{
|
||||
$this->payment_for = $payment_for;
|
||||
$this->UserShop = $UserShop;
|
||||
$this->is_for = 'shop';
|
||||
}
|
||||
|
||||
public function init($identifier, $data)
|
||||
|
|
@ -51,7 +62,7 @@ class CheckoutRepository {
|
|||
|
||||
$shopping_data = Yard::instance('shopping')->getYardExtra('shopping_data');
|
||||
$this->data['is_from'] = isset($shopping_data['is_from']) ? $shopping_data['is_from'] : 'shopping'; //shopping
|
||||
$this->data['is_from'] = isset($shopping_data['is_for']) ? $shopping_data['is_for'] : 'pr'; //promotion
|
||||
$this->data['is_for'] = isset($shopping_data['is_for']) ? $shopping_data['is_for'] : 'pr'; //promotion //us shop
|
||||
|
||||
$this->shopping_user = $this->makeShoppingUser($data);
|
||||
$this->shopping_order = $this->makeShoppingOrder($this->shopping_user);
|
||||
|
|
@ -94,7 +105,7 @@ class CheckoutRepository {
|
|||
$data['accepted_data'] = isset($data['accepted_data']) ? true : false;
|
||||
$data['billing_country_id'] = Shop::getShippingCountryCountryId($data['billing_state']);
|
||||
$data['shipping_country_id'] = $data['billing_country_id'];
|
||||
$data['member_id'] = $this->PromotionUser->user_id;
|
||||
$data['member_id'] = $this->is_for === 'shop' ? $this->UserShop->user_id : $this->PromotionUser->user_id; //pr
|
||||
|
||||
if(isset($data['shipping_state'])){
|
||||
$data['shipping_country_id'] = Shop::getShippingCountryCountryId($data['shipping_state']);
|
||||
|
|
@ -119,7 +130,8 @@ class CheckoutRepository {
|
|||
$data = [
|
||||
'shopping_user_id' => $shopping_user->id,
|
||||
'auth_user_id' => $shopping_user->auth_user_id,
|
||||
'promotion_user_id' => $this->PromotionUser->id,
|
||||
'promotion_user_id' => $this->is_for === 'pr' ? $this->PromotionUser->id : null,
|
||||
'user_shop_id' => $this->is_for === 'shop' ? $this->UserShop->id : null,
|
||||
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
|
||||
'payment_for' => $this->payment_for,
|
||||
'total' => Yard::instance('shopping')->total(2, '.', ''),
|
||||
|
|
@ -152,7 +164,7 @@ class CheckoutRepository {
|
|||
if(!$shopping_order){
|
||||
$shopping_order = ShoppingOrder::create($data);
|
||||
}
|
||||
//$this->makeOrderMargin($shopping_order);
|
||||
$this->makeOrderMargin($shopping_order);
|
||||
|
||||
$this->putPayments('shopping_order_id', $shopping_order->id);
|
||||
$items = Yard::instance('shopping')->getContentByOrder();
|
||||
|
|
@ -197,6 +209,43 @@ class CheckoutRepository {
|
|||
return $shopping_order;
|
||||
}
|
||||
|
||||
private function makeOrderMargin(ShoppingOrder $shopping_order)
|
||||
{
|
||||
if ($this->is_for === 'pr' || $this->is_for === 'shop' ) {
|
||||
|
||||
$userMargin = Shop::calculateUserShopMargins($this->UserShop, $this->PromotionUser);
|
||||
$data = [
|
||||
'shopping_order_id' => $shopping_order->id,
|
||||
'user_id' => $shopping_order->shopping_user->member_id,
|
||||
'net_price' => $userMargin->yard_margin->net_price,
|
||||
'net_discount' => $userMargin->yard_margin->net_discount,
|
||||
'net_amount' => $userMargin->yard_margin->net_amount,
|
||||
'from_payment_credit' =>0,
|
||||
'from' => now(),
|
||||
'status' => $this->payment_for, //7 => 'from promotion', 8 => 'from shop',
|
||||
'content' => serialize($userMargin->yard_margin->toArray())
|
||||
];
|
||||
if($userMargin->yard_margin->net_partner_commission > 0){
|
||||
if(isset($shopping_order->auth_user->m_sponsor)){
|
||||
if($shopping_order->auth_user->user_sponsor && $shopping_order->auth_user->user_sponsor->isActiveAccount())
|
||||
$data['m_sponsor_id'] = $shopping_order->auth_user->m_sponsor;
|
||||
$data['net_partner_commission'] = $userMargin->yard_margin->net_partner_commission;
|
||||
}
|
||||
}
|
||||
$shopping_order_margin = false;
|
||||
if ($this->getPayments('shopping_order_margin_id')) {
|
||||
$shopping_order_margin = ShoppingOrderMargin::find($this->getPayments('shopping_order_margin_id'));
|
||||
if ($shopping_order_margin) {
|
||||
$shopping_order_margin->fill($data);
|
||||
$shopping_order_margin->save();}
|
||||
}
|
||||
if (!$shopping_order_margin) {
|
||||
$shopping_order_margin = ShoppingOrderMargin::create($data);
|
||||
}
|
||||
$this->putPayments('shopping_order_margin_id', $shopping_order_margin->id);
|
||||
}
|
||||
}
|
||||
|
||||
private function putPayments($key, $value){
|
||||
$content = $this->getContent();
|
||||
$content->put($key, $value);
|
||||
|
|
|
|||
|
|
@ -80,8 +80,10 @@ class ContractPDFRepository extends BaseRepository {
|
|||
$y += $nl;
|
||||
$pdf->SetXY($x1, $y);
|
||||
$pdf->Write(0, $this->convert($this->model->account->address));
|
||||
if($this->model->account->birthday){
|
||||
$pdf->SetXY($x2, $y);
|
||||
$pdf->Write(0, $this->convert($this->model->account->birthday));
|
||||
}
|
||||
|
||||
$y += $nl;
|
||||
$pdf->SetXY($x1, $y);
|
||||
|
|
|
|||
|
|
@ -83,31 +83,47 @@ class CreditRepository extends BaseRepository {
|
|||
return true;
|
||||
}
|
||||
|
||||
//beendet die Gutschrift
|
||||
private function finishUserCredit($user_credit){
|
||||
//next number
|
||||
Credit::makeNextCreditNumber();
|
||||
//mark as payed
|
||||
$ShoppingOrderMargins = UserMarign::getOrderFromPartnerCommissionByID($this->model->id);
|
||||
//Partner Provision
|
||||
$ShoppingOrderMargins = UserMarign::getPartnerCommissionItems($this->model->id, false);
|
||||
foreach($ShoppingOrderMargins as $ShoppingOrderMargin){
|
||||
$ShoppingOrderMargin->partner_commission_paid = true;
|
||||
$ShoppingOrderMargin->out_paid = true;
|
||||
$ShoppingOrderMargin->user_credit_id = $user_credit->id;
|
||||
$ShoppingOrderMargin->save();
|
||||
}
|
||||
|
||||
$UserCreditMargins = UserMarign::getUserCreditMarginByID($this->model->id);
|
||||
//Shop Provision
|
||||
$ShoppingOrderMargins = UserMarign::getShopCommissionItems($this->model->id, false);
|
||||
foreach($ShoppingOrderMargins as $ShoppingOrderMargin){
|
||||
$ShoppingOrderMargin->margin_paid = true;
|
||||
$ShoppingOrderMargin->out_paid = true;
|
||||
$ShoppingOrderMargin->user_credit_id = $user_credit->id;
|
||||
$ShoppingOrderMargin->save();
|
||||
}
|
||||
|
||||
//Hinzugefügte Provision
|
||||
$UserCreditMargins = UserMarign::getUserCreditMarginByUserID($this->model->id);
|
||||
foreach($UserCreditMargins as $UserCreditMargin){
|
||||
$UserCreditMargin->paid = true;
|
||||
$UserCreditMargin->paid = true; //wurde ausgezahlt
|
||||
$UserCreditMargin->user_credit_id = $user_credit->id;
|
||||
$UserCreditMargin->save();
|
||||
}
|
||||
}
|
||||
|
||||
//erstellt der Gutschrift
|
||||
private function makeUserCredit(){
|
||||
|
||||
$ret = new \stdClass();
|
||||
$ret->net = 0;
|
||||
$ret->margins = [];
|
||||
$ret->credits = [];
|
||||
$ShoppingOrderMargins = UserMarign::getOrderFromPartnerCommissionByID($this->model->id);
|
||||
|
||||
//Partner Provision
|
||||
$ShoppingOrderMargins = UserMarign::getPartnerCommissionItems($this->model->id, false);
|
||||
foreach($ShoppingOrderMargins as $ShoppingOrderMargin){
|
||||
$margin = new \stdClass();
|
||||
$margin->id = $ShoppingOrderMargin->id;
|
||||
|
|
@ -120,7 +136,22 @@ class CreditRepository extends BaseRepository {
|
|||
$ret->net += $ShoppingOrderMargin->net_partner_commission;
|
||||
}
|
||||
|
||||
$UserCreditMargins = UserMarign::getUserCreditMarginByID($this->model->id);
|
||||
//Shop Provision
|
||||
$ShoppingOrderMargins = UserMarign::getShopCommissionItems($this->model->id, false);
|
||||
foreach($ShoppingOrderMargins as $ShoppingOrderMargin){
|
||||
$margin = new \stdClass();
|
||||
$margin->id = $ShoppingOrderMargin->id;
|
||||
$margin->net = $ShoppingOrderMargin->net_discount;
|
||||
$margin->reference = $ShoppingOrderMargin->shopping_order->getLastShoppingPayment('reference');
|
||||
$margin->firstname = $ShoppingOrderMargin->shopping_order->shopping_user->billing_firstname;
|
||||
$margin->lastname = $ShoppingOrderMargin->shopping_order->shopping_user->billing_lastname;
|
||||
$margin->created_at = $ShoppingOrderMargin->shopping_order->created_at->format("d.m.Y");
|
||||
$ret->margins[] = $margin;
|
||||
$ret->net += $ShoppingOrderMargin->net_discount;
|
||||
}
|
||||
|
||||
//Hinzugefügte Provision
|
||||
$UserCreditMargins = UserMarign::getUserCreditMarginByUserID($this->model->id);
|
||||
foreach($UserCreditMargins as $UserCreditMargin){
|
||||
$credit = new \stdClass();
|
||||
$credit->id = $UserCreditMargin->id;
|
||||
|
|
@ -138,7 +169,7 @@ class CreditRepository extends BaseRepository {
|
|||
if($this->model->account){
|
||||
$ret->taxable = $this->model->account->taxable_sales == 2 ? false : true;
|
||||
if($ret->taxable){
|
||||
$ret->tax_rate = config('app.main_tax_number');
|
||||
$ret->tax_rate = config('app.main_tax_rate');
|
||||
$ret->total = round($ret->net * config('app.main_tax'), 2);
|
||||
$ret->tax = $ret->total - $ret->net;
|
||||
|
||||
|
|
@ -146,7 +177,6 @@ class CreditRepository extends BaseRepository {
|
|||
$ret->tax_rate = 0;
|
||||
$ret->total = $ret->net;
|
||||
$ret->tax = 0;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,13 @@ namespace App\Repositories;
|
|||
|
||||
use PDF;
|
||||
use Storage;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Models\Attribute;
|
||||
use App\Services\Invoice;
|
||||
use App\Libraries\InvoicePDF;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Services\MyPDFMerger;
|
||||
use App\Services\UserService;
|
||||
use App\Repositories\BaseRepository;
|
||||
|
||||
class InvoiceRepository extends BaseRepository {
|
||||
|
||||
|
|
@ -15,6 +19,9 @@ class InvoiceRepository extends BaseRepository {
|
|||
private $filename;
|
||||
private $dir;
|
||||
|
||||
private $delivery_dir;
|
||||
private $delivery_filename;
|
||||
|
||||
public function __construct(ShoppingOrder $model)
|
||||
{
|
||||
$this->model = $model;
|
||||
|
|
@ -29,17 +36,28 @@ class InvoiceRepository extends BaseRepository {
|
|||
$this->invoice_number = Invoice::createInvoiceNumber($number, $this->invoice_date);
|
||||
$this->dir = Invoice::getInvoiceStorageDir($this->invoice_date);
|
||||
$this->filename = Invoice::makeInvoiceFilename($this->invoice_number);
|
||||
$this->delivery_dir = Invoice::getDeliveryStorageDir($this->invoice_date);
|
||||
$this->delivery_filename = Invoice::makeDeliveryFilename($this->invoice_number);
|
||||
|
||||
$this->makePDF();
|
||||
|
||||
$data_file = [
|
||||
$invoice_file = [
|
||||
'filename' => $this->filename,
|
||||
'dir' => $this->dir,
|
||||
'disk' => 'public',
|
||||
'invoice_number' => $this->invoice_number,
|
||||
'invoice_date' => $this->invoice_date,
|
||||
];
|
||||
$this->model->invoice = $data_file;
|
||||
|
||||
$delivery_file = [
|
||||
'filename' => $this->delivery_filename,
|
||||
'dir' => $this->delivery_dir,
|
||||
'disk' => 'public',
|
||||
'number' => $this->invoice_number,
|
||||
'date' => $this->invoice_date,
|
||||
];
|
||||
$this->model->invoice = $invoice_file;
|
||||
$this->model->delivery = $delivery_file;
|
||||
$this->model->invoice_number = $this->invoice_number;
|
||||
$this->model->save();
|
||||
Invoice::makeNextInvoiceNumber();
|
||||
|
|
@ -58,16 +76,29 @@ class InvoiceRepository extends BaseRepository {
|
|||
$this->dir = Invoice::getDir($this->model);
|
||||
$this->filename = Invoice::getFilename($this->model);
|
||||
|
||||
|
||||
$this->delivery_dir = Invoice::getDeliveryDir($this->model);
|
||||
$this->delivery_filename = Invoice::getDeliveryFilename($this->model);
|
||||
|
||||
$this->makePDF();
|
||||
|
||||
$data_file = [
|
||||
$invoice_file = [
|
||||
'filename' => $this->filename,
|
||||
'dir' => $this->dir,
|
||||
'disk' => 'public',
|
||||
'invoice_number' => $this->invoice_number,
|
||||
'invoice_date' => $this->invoice_date,
|
||||
];
|
||||
$this->model->invoice = $data_file;
|
||||
$delivery_file = [
|
||||
'filename' => $this->delivery_filename,
|
||||
'dir' => $this->delivery_dir,
|
||||
'disk' => 'public',
|
||||
'number' => $this->invoice_number,
|
||||
'date' => $this->invoice_date,
|
||||
];
|
||||
|
||||
$this->model->invoice = $invoice_file;
|
||||
$this->model->delivery = $delivery_file;
|
||||
$this->model->invoice_number = $this->invoice_number;
|
||||
$this->model->save();
|
||||
|
||||
|
|
@ -85,19 +116,123 @@ class InvoiceRepository extends BaseRepository {
|
|||
'invoice_date' => $this->invoice_date,
|
||||
'invoice_number' => $this->invoice_number,
|
||||
];
|
||||
$pdf = PDF::loadView('pdf.invoice', $data);
|
||||
$pdf->setPaper('A4', 'portrait');
|
||||
|
||||
if($this->model->auth_user_id){
|
||||
UserService::checkUserTaxShippingCountry($this->model->auth_user, $this->model->country_id);
|
||||
$data = array_merge($data, UserService::getYardInfo());
|
||||
}
|
||||
|
||||
$data['delivery_items'] = $this->prepairForDelivery();
|
||||
|
||||
if(!Storage::disk('public')->exists( $this->dir )){
|
||||
Storage::disk('public')->makeDirectory($this->dir); //creates directory
|
||||
}
|
||||
if(!Storage::disk('public')->exists( $this->delivery_dir )){
|
||||
Storage::disk('public')->makeDirectory($this->delivery_dir); //creates directory
|
||||
}
|
||||
$path = Storage::disk('public')->getAdapter()->getPathPrefix();
|
||||
|
||||
$pdf->save($path.$this->dir.$this->filename);
|
||||
|
||||
$pdf_file = new InvoicePDF('pdf.invoice');
|
||||
$pdf_file->create($data, $this->filename, 'save', $path.$this->dir);
|
||||
$pdfMerger = new MyPDFMerger();
|
||||
$pdfMerger->addPDF($path.$this->dir.$this->filename);
|
||||
$file = $pdfMerger->myMerge('string', $this->filename, 'template_invoice_de');
|
||||
Storage::disk('public')->put($this->dir.$this->filename, $file);
|
||||
|
||||
$pdf_file = new InvoicePDF('pdf.delivery');
|
||||
$pdf_file->create($data, $this->delivery_filename, 'save', $path.$this->delivery_dir);
|
||||
$pdfMerger = new MyPDFMerger();
|
||||
$pdfMerger->addPDF($path.$this->delivery_dir.$this->delivery_filename);
|
||||
$file = $pdfMerger->myMerge('string', $this->delivery_filename, 'template_delivery_de');
|
||||
Storage::disk('public')->put($this->delivery_dir.$this->delivery_filename, $file);
|
||||
|
||||
}
|
||||
//sort white label products
|
||||
private function prepairForDelivery(){
|
||||
$shopping_order = $this->model;
|
||||
$wl_items = [];
|
||||
$items = [];
|
||||
$counter = 1;
|
||||
$count = 10000;
|
||||
foreach($shopping_order->shopping_order_items as $shopping_order_item){
|
||||
$labels = [];
|
||||
$sorter = 0;
|
||||
if($shopping_order_item->product->whitelabel){
|
||||
|
||||
//get white label default etikett (s)
|
||||
//ist ausschlaggebend für die etikettierung, ob 1 oder mehr etiketten
|
||||
if($shopping_order_item->product->whitelabel_images){
|
||||
foreach($shopping_order_item->product->whitelabel_images as $whitelabel_image){
|
||||
$labels[] = $whitelabel_image;
|
||||
}
|
||||
}
|
||||
//has white label user etikett
|
||||
if($shopping_order->auth_user){
|
||||
$whitelabel_product = $shopping_order->auth_user->whitelabel_products()->where('product_id', '=', $shopping_order_item->product->id)->first();
|
||||
if($whitelabel_product && $whitelabel_product->whitelabel_images){
|
||||
foreach($whitelabel_product->whitelabel_images as $whitelabel_image){
|
||||
if($whitelabel_image->attributes && is_array($whitelabel_image->attributes)){
|
||||
foreach($labels as $key => $label){
|
||||
foreach($whitelabel_image->attributes as $attribute){
|
||||
if(in_array($attribute, $label->attributes)){
|
||||
//found and overwrite
|
||||
$labels[$key] = $whitelabel_image;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach($labels as $key=>$label){
|
||||
//label hat attribue
|
||||
$varinats = [];
|
||||
if($label->attributes && is_array($label->attributes)){
|
||||
foreach($label->attributes as $attribute){
|
||||
if($attribute = Attribute::find($attribute)){
|
||||
if(!isset($varinats[$attribute->value])){
|
||||
$temp = explode('#', $attribute->value);
|
||||
$sorter = $temp[1] > $sorter ? $temp[1] : $sorter;
|
||||
$label->varinat = [
|
||||
'key' => $attribute->value,
|
||||
'id' => $attribute->id,
|
||||
'vol' => (float) $temp[0],
|
||||
'size' => (float) $temp[1],
|
||||
'name' => $label->product_id ? 'Standard' : $attribute->name,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
//sonst auf standard zurückgreifen
|
||||
if($shopping_order_item->product->attribute_variants){
|
||||
foreach($shopping_order_item->product->attribute_variants as $attribute_variant){
|
||||
if(!isset($varinats[$attribute_variant->attribute->value])){
|
||||
$temp = explode('#', $attribute_variant->attribute->value);
|
||||
$sorter = $temp[1] > $sorter ? $temp[1] : $sorter;
|
||||
$label->varinat = [
|
||||
'key' => $attribute_variant->attribute->value,
|
||||
'id' => $attribute_variant->attribute->id,
|
||||
'vol' => (float) $temp[0],
|
||||
'size' => (float) $temp[1],
|
||||
'name' => 'Standard',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//sorten of white label products
|
||||
$sorter = intval((float) $sorter * 100 + $counter++);
|
||||
$shopping_order_item->labels = $labels;
|
||||
$wl_items[$sorter] = $shopping_order_item;
|
||||
}else{
|
||||
$items[$count++] = $shopping_order_item;
|
||||
}
|
||||
}
|
||||
//kleine zuerst
|
||||
ksort($wl_items);
|
||||
return array_merge($wl_items, $items);
|
||||
}
|
||||
}
|
||||
|
|
@ -5,12 +5,14 @@ namespace App\Repositories;
|
|||
|
||||
|
||||
use App\Models\CountryPrice;
|
||||
use App\Models\Attribute;
|
||||
use App\Models\Product;
|
||||
use App\Models\ProductAttribute;
|
||||
use App\Models\ProductCategory;
|
||||
use App\Models\ProductImage;
|
||||
use App\Models\ProductIngredient;
|
||||
|
||||
|
||||
class ProductRepository extends BaseRepository {
|
||||
|
||||
|
||||
|
|
@ -29,6 +31,8 @@ class ProductRepository extends BaseRepository {
|
|||
$data['active'] = isset($data['active']) ? 1 : 0;
|
||||
$data['single_commission'] = isset($data['single_commission']) ? 1 : 0;
|
||||
$data['amount_commission'] = isset($data['amount_commission']) ? 1 : 0;
|
||||
$data['exclude_stats_sales'] = isset($data['exclude_stats_sales']) ? 1 : 0;
|
||||
$data['whitelabel'] = isset($data['whitelabel']) ? 1 : 0;
|
||||
$data['shipping_addon'] = isset($data['shipping_addon']) ? 1 : 0;
|
||||
$data['max_buy'] = isset($data['max_buy']) ? 1 : 0;
|
||||
$data['show_on'] = isset($data['show_on']) ? $data['show_on'] : null;
|
||||
|
|
@ -42,9 +46,14 @@ class ProductRepository extends BaseRepository {
|
|||
$this->model->save();
|
||||
}
|
||||
|
||||
$this->updateCategories(isset($data['categories']) ? $data['categories'] : array());
|
||||
$this->updateAttributes(isset($data['attributes']) ? $data['attributes'] : array());
|
||||
$this->updateIngredients(isset($data['product_ingredients']) ? $data['product_ingredients'] : array());
|
||||
|
||||
$this->updateCategories(isset($data['categories']) ? $data['categories'] : []);
|
||||
$this->updateAttributes(isset($data['attributes']) ? $data['attributes'] : []);
|
||||
|
||||
$this->updateWLVariants(isset($data['whitelabel_variants']) ? $data['whitelabel_variants'] : []);
|
||||
$this->updateWLImageAttributs(isset($data['image_wl_attributes']) ? $data['image_wl_attributes'] : [] , isset($data['whitelabel_variants']) ? $data['whitelabel_variants'] : []);
|
||||
|
||||
$this->updateIngredients(isset($data['product_ingredients']) ? $data['product_ingredients'] : []);
|
||||
$this->updateCountryPrices($data);
|
||||
|
||||
|
||||
|
|
@ -103,15 +112,62 @@ class ProductRepository extends BaseRepository {
|
|||
//set attr
|
||||
if(is_array($data)){
|
||||
foreach ($data as $id) {
|
||||
$attribute = Attribute::findOrFail($id);
|
||||
ProductAttribute::create([
|
||||
'product_id' => $this->model->id,
|
||||
'attribute_id' => $id,
|
||||
'type_id' => $attribute->attribute_type_id,
|
||||
'attribute_id' => $attribute->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function updateWLVariants($data = array())
|
||||
{
|
||||
foreach ($this->model->attribute_variants as $variant) {
|
||||
if(($pos = array_search($variant->attribute_id, $data)) !== FALSE){
|
||||
unset($data[$pos]);
|
||||
}else{
|
||||
$variant->delete();
|
||||
}
|
||||
}
|
||||
//set attr
|
||||
if(is_array($data)){
|
||||
foreach ($data as $id) {
|
||||
$attribute = Attribute::findOrFail($id);
|
||||
ProductAttribute::create([
|
||||
'product_id' => $this->model->id,
|
||||
'type_id' => $attribute->attribute_type_id,
|
||||
'attribute_id' => $attribute->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function updateWLImageAttributs($attributes = [], $variants = [])
|
||||
{
|
||||
//abgleich der attributes gegen die variants
|
||||
foreach ($attributes as $image => $value) {
|
||||
foreach ($value as $k => $val) {
|
||||
if(!is_array($variants) || !in_array($val, $variants)){
|
||||
unset($attributes[$image][$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($this->model->whitelabel_images as $image) {
|
||||
$image->update([
|
||||
'attributes' => isset($attributes[$image->id]) ? $attributes[$image->id] : NULL,
|
||||
]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function updateCountryPrices($data)
|
||||
{
|
||||
if(!isset($data['country_prices']) || !is_array($data['country_prices'])){
|
||||
|
|
@ -128,7 +184,6 @@ class ProductRepository extends BaseRepository {
|
|||
'c_price_old' => isset($data['c_price_old'][$country_id]) ? reFormatNumber($data['c_price_old'][$country_id]) : null,
|
||||
'c_currency' => isset($data['c_currency'][$country_id]) ? reFormatNumber($data['c_currency'][$country_id]) : null,
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -156,6 +211,7 @@ class ProductRepository extends BaseRepository {
|
|||
foreach ($model->attributes as $attribute){
|
||||
ProductAttribute::create([
|
||||
'product_id' => $this->model->id,
|
||||
'type_id' => $this->model->attribute_type_id,
|
||||
'attribute_id' => $attribute->attribute_id,
|
||||
]);
|
||||
}
|
||||
|
|
@ -182,30 +238,26 @@ class ProductRepository extends BaseRepository {
|
|||
'images/product/'.$this->model->id.'/'.$name
|
||||
);
|
||||
|
||||
|
||||
ProductImage::create([
|
||||
'product_id' => $this->model->id,
|
||||
'type' => $image->type,
|
||||
'filename' => $name,
|
||||
'original_name' => $image->original_name,
|
||||
'ext' => $image->ext,
|
||||
'mine' => $image->mine,
|
||||
'size' => $image->size
|
||||
'size' => $image->size,
|
||||
'attributes' => $image->attributes
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
return $this->model;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function delete()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -2,13 +2,17 @@
|
|||
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Models\PaymentMethod;
|
||||
use App\Models\UserAccount;
|
||||
use Str;
|
||||
use App\User;
|
||||
use stdClass;
|
||||
use Validator;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\UserAccount;
|
||||
use App\Models\UserRegister;
|
||||
use App\Models\PaymentMethod;
|
||||
use App\Services\UserService;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
|
||||
|
||||
class UserRepository extends BaseRepository {
|
||||
|
||||
|
||||
|
|
@ -30,8 +34,6 @@ class UserRepository extends BaseRepository {
|
|||
]);
|
||||
$this->model->payment_methods = PaymentMethod::getDefaultAsArray();
|
||||
$this->model->save();
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
$this->model = $this->getById($data['user_id']);
|
||||
|
|
@ -47,8 +49,9 @@ class UserRepository extends BaseRepository {
|
|||
|
||||
$data['birthday_day'] = isset($data['birthday_day']) ? $data['birthday_day'] : 1;
|
||||
$data['birthday_month'] = isset($data['birthday_month']) ? $data['birthday_month'] : 1;
|
||||
$data['birthday_year'] = isset($data['birthday_year']) ? $data['birthday_year'] : 1970;
|
||||
$data['birthday_year'] = isset($data['birthday_year']) ? $data['birthday_year'] : 1900;
|
||||
$data['birthday'] = $data['birthday_day'].".".$data['birthday_month'].".".$data['birthday_year'];
|
||||
$data['birthday'] = $data['birthday'] == "1.1.1900" ? null : $data['birthday'];
|
||||
|
||||
$account->fill($data)->save();
|
||||
|
||||
|
|
@ -60,29 +63,80 @@ class UserRepository extends BaseRepository {
|
|||
return true;
|
||||
}
|
||||
|
||||
public function create($data){
|
||||
public function createUserRegister($data){
|
||||
|
||||
$this->model = User::create([
|
||||
'email' => $data['email'],
|
||||
'password' => Hash::make($data['password']),
|
||||
$obj = new stdClass();
|
||||
|
||||
$obj->email = $data['email'];
|
||||
$obj->password = Hash::make($data['password']);
|
||||
$obj->m_salutation = $data['salutation'];
|
||||
$obj->m_first_name = $data['first_name'];
|
||||
$obj->m_last_name = $data['last_name'];
|
||||
$obj->salutation = $data['salutation'];
|
||||
$obj->first_name = $data['first_name'];
|
||||
$obj->last_name = $data['last_name'];
|
||||
$obj->data_protection = now()->toDateTimeString();
|
||||
|
||||
$obj->confirmation_code_to = date('Y-m-d H:i:s', strtotime('+1 week'));
|
||||
$obj->confirmation_code_remider = 0;
|
||||
$obj->m_sponsor = config('app.main_user_id');
|
||||
if(isset($data['from_member_id'])){
|
||||
$obj->m_sponsor = (int) str_replace('gs', '', $data['from_member_id']) - config('main.add_number_id');
|
||||
}
|
||||
$confirmation_code = UserService::createConfirmationCode();
|
||||
$obj->confirmation_code = $confirmation_code;
|
||||
UserRegister::create([
|
||||
'identifier' => $data['email'],
|
||||
'instance' => $confirmation_code,
|
||||
'content' => $obj
|
||||
]);
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public function clearUserRegister(){
|
||||
$cleartime = date('Y-m-d H:i:s', strtotime('-1 day')); //gestern -24h
|
||||
UserRegister::where('created_at', '<', $cleartime)->delete();
|
||||
}
|
||||
|
||||
public function create($UserRegister){
|
||||
|
||||
|
||||
$userObj = $UserRegister->content;
|
||||
|
||||
$user = User::create([
|
||||
'email' => $userObj->email,
|
||||
'password' =>$userObj->password,
|
||||
]);
|
||||
|
||||
$account = UserAccount::create([
|
||||
'm_salutation' => $data['salutation'],
|
||||
'm_first_name' => $data['first_name'],
|
||||
'm_last_name' => $data['last_name'],
|
||||
'salutation' => $data['salutation'],
|
||||
'first_name' => $data['first_name'],
|
||||
'last_name' => $data['last_name'],
|
||||
'data_protection' => now(),
|
||||
'm_salutation' => $userObj->salutation,
|
||||
'm_first_name' => $userObj->first_name,
|
||||
'm_last_name' => $userObj->last_name,
|
||||
'salutation' => $userObj->salutation,
|
||||
'first_name' => $userObj->first_name,
|
||||
'last_name' => $userObj->last_name,
|
||||
'data_protection' => $userObj->data_protection,
|
||||
]);
|
||||
$user->confirmed = 1;
|
||||
$user->confirmation_code = null;
|
||||
$user->confirmation_code_to = null;
|
||||
$user->confirmation_code_remider = 0;
|
||||
$user->confirmation_date = now();
|
||||
$user->lang = !empty(\App::getLocale()) ? \App::getLocale() : "de";
|
||||
$user->m_sponsor = $userObj->m_sponsor;
|
||||
|
||||
$this->model->account_id = $account->id;
|
||||
$this->model->payment_methods = PaymentMethod::getDefaultAsArray();
|
||||
$this->model->save();
|
||||
$user->account_id = $account->id;
|
||||
$user->payment_methods = PaymentMethod::getDefaultAsArray();
|
||||
|
||||
$user->save();
|
||||
|
||||
return $this->model;
|
||||
$user = User::find($user->id);
|
||||
|
||||
//clear
|
||||
$identifier = $UserRegister->identifier;
|
||||
UserRegister::where('identifier', $identifier)->delete();
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
public function deleteUser(User $user)
|
||||
|
|
@ -108,5 +162,119 @@ class UserRepository extends BaseRepository {
|
|||
return true;
|
||||
}
|
||||
|
||||
public function reverse_charge_validate($data, $user, $route){
|
||||
|
||||
if(isset($data['action']) && $data['action'] == 'reverse_charge_validate'){
|
||||
$rules = array(
|
||||
'tax_identification_number' => 'required',
|
||||
);
|
||||
$validator = Validator::make($data, $rules);
|
||||
if ($validator->fails()) {
|
||||
$data = [
|
||||
'user' => $user,
|
||||
];
|
||||
return redirect($route)->withErrors($validator)->withInput($data);
|
||||
}
|
||||
$ret = $this->reverse_charge_activate($data, $user);
|
||||
if($ret === 'error'){
|
||||
$validator = Validator::make($data, []);
|
||||
$validator->errors()->add('tax_identification_number_validated', __('msg.VATID_could_not_be_validated'));
|
||||
$data['reverse_charge'] = 0;
|
||||
$data = [
|
||||
'user' => $user,
|
||||
];
|
||||
return redirect($route.'#user-vat-validation')->withErrors($validator)->withInput($data);
|
||||
}
|
||||
if($ret === 'valid'){
|
||||
\Session()->flash('alert-success', __('msg.VATID_successfully_entered'));
|
||||
return redirect($route.'#user-vat-validation')->withInput($data);
|
||||
|
||||
return redirect($route.'#user-vat-validation')->withInput($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function reverse_charge_delete($data, $user, $route){
|
||||
if(isset($data['action']) && $data['action'] == 'reverse_charge_delete'){
|
||||
$user->account->tax_identification_number = '';
|
||||
$user->account->reverse_charge = 0;
|
||||
$user->account->reverse_charge_code = null;
|
||||
$user->account->reverse_charge_valid = null;
|
||||
$user->account->save();
|
||||
$data['tax_identification_number'] = '';
|
||||
\Session()->flash('alert-success', __('msg.reverse_charge_procedure_and_VATID_deleted'));
|
||||
return redirect($route.'#user-vat-validation')->withInput($data);
|
||||
}
|
||||
}
|
||||
|
||||
public function reverse_charge_activate($data, $user){
|
||||
|
||||
/* 'AT' => 'AT-Oesterreich',
|
||||
'BE' => 'BE-Belgien',
|
||||
'BG' => 'BG-Bulgarien',
|
||||
'CY' => 'CY-Zypern',
|
||||
'CZ' => 'CZ-Tschechische Republik',
|
||||
'DE' => 'DE-Deutschland',
|
||||
'DK' => 'DK-Dänemark',
|
||||
'EE' => 'EE-Estland',
|
||||
'EL' => 'EL-Griechenland',
|
||||
'ES' => 'ES-Spanien',
|
||||
'FI' => 'FI-Finnland',
|
||||
'FR' => 'FR-Frankreich ',
|
||||
'HR' => 'HR-Kroatien ',
|
||||
'HU' => 'HU-Ungarn',
|
||||
'IE' => 'IE-Irland',
|
||||
'IT' => 'IT-Italien',
|
||||
'LT' => 'LT-Litauen',
|
||||
'LU' => 'LU-Luxemburg',
|
||||
'LV' => 'LV-Lettland',
|
||||
'MT' => 'MT-Malta',
|
||||
'NL' => 'NL-Niederlande',
|
||||
'PL' => 'PL-Polen',
|
||||
'PT' => 'PT-Portugal',
|
||||
'RO' => 'RO-Rumänien',
|
||||
'SE' => 'SE-Schweden',
|
||||
'SI' => 'SI-Slowenien',
|
||||
'SK' => 'SK-Slowakei',
|
||||
'XI' => 'XI-Nordirland', */
|
||||
$countryCode = 'DE';
|
||||
|
||||
if($user->account->country_id){
|
||||
$countryCode = $user->account->country->code;
|
||||
}
|
||||
|
||||
$vatid = str_replace(array(' ', '.', '-', ',', ', '), '', trim($data['tax_identification_number']));
|
||||
$cc = substr($vatid, 0, 2);
|
||||
$vatNo = substr($vatid, 2);
|
||||
|
||||
$options = [
|
||||
'cache_wsdl' => WSDL_CACHE_NONE,
|
||||
'trace' => 1,
|
||||
'stream_context' => stream_context_create(
|
||||
[
|
||||
'ssl' => [
|
||||
'verify_peer' => false,
|
||||
'verify_peer_name' => false,
|
||||
'allow_self_signed' => true
|
||||
]
|
||||
]
|
||||
)
|
||||
];
|
||||
|
||||
$client = new \SoapClient("https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl", $options);
|
||||
$result = $client->checkVat(['countryCode' => $countryCode, 'vatNumber' => $vatNo]);
|
||||
|
||||
if($result->valid == true) {
|
||||
$user->account->tax_identification_number = $data['tax_identification_number'];
|
||||
$user->account->reverse_charge = 1;
|
||||
$user->account->reverse_charge_code = $countryCode;
|
||||
$user->account->reverse_charge_valid = now();
|
||||
$user->account->save();
|
||||
return 'valid';
|
||||
} else {
|
||||
return 'error';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
71
app/Repositories/UserShopRepository.php
Normal file
71
app/Repositories/UserShopRepository.php
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\User;
|
||||
use App\Services\Util;
|
||||
use App\Models\UserShop;
|
||||
use App\Models\PromotionUserProduct;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Models\PromotionAdminProduct;
|
||||
|
||||
class UserShopRepository extends BaseRepository {
|
||||
|
||||
|
||||
public function __construct(UserShop $model){
|
||||
|
||||
$this->model = $model;
|
||||
}
|
||||
|
||||
public function update($id, $data)
|
||||
{
|
||||
|
||||
$data['active'] = isset($data['active']) ? 1 : 0;
|
||||
$data['pick_up'] = isset($data['pick_up']) ? 1 : 0;
|
||||
$data['url'] = Util::sanitize($data['user_shop_url'], true, false, true, true);
|
||||
|
||||
$this->model = $this->getById($id);
|
||||
$this->model->fill($data);
|
||||
$this->model->save();
|
||||
|
||||
return $this->model;
|
||||
}
|
||||
|
||||
public function create(User $user){
|
||||
|
||||
$user_name = $user->getFullName(false);
|
||||
$url = Util::sanitize($user_name, true, false, true, true);
|
||||
$url = $this->makeUniqueURL($url);
|
||||
UserShop::create([
|
||||
'user_id' => $user->id,
|
||||
'url' => $url,
|
||||
'name' => __('shop.greetings')." ".$user_name,
|
||||
'description' => __('shop.default_description'),
|
||||
'about_you' => $user->account->about_you,
|
||||
'user_address' => Auth::user()->getFullAddress()."\n".__('shop.default_user_open'),
|
||||
'pick_up' => false,
|
||||
'active' => true,
|
||||
'active_date' => now(),
|
||||
|
||||
]);
|
||||
return User::find($user->id);
|
||||
}
|
||||
|
||||
public function makeUniqueURL($url){
|
||||
|
||||
$bool = true;
|
||||
$count = 1;
|
||||
$unique_url = $url;
|
||||
while($bool){
|
||||
if(UserShop::where('url', $unique_url)->count()){
|
||||
$unique_url = $url."_".$count;
|
||||
$count ++;
|
||||
}else{
|
||||
$bool = false;
|
||||
}
|
||||
}
|
||||
return $unique_url;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,36 +1,40 @@
|
|||
<?php
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Attribute;
|
||||
use App\Models\Category;
|
||||
use App\Models\Country;
|
||||
use App\Models\Ingredient;
|
||||
use App\Models\Product;
|
||||
use App\Models\ShippingCountry;
|
||||
use App\Models\ShoppingUser;
|
||||
use App\Models\UserLevel;
|
||||
use App\User;
|
||||
use App\Models\Country;
|
||||
use App\Models\Product;
|
||||
use App\Models\Category;
|
||||
use App\Models\LeadType;
|
||||
use App\Models\Attribute;
|
||||
use App\Models\UserLevel;
|
||||
use App\Models\Ingredient;
|
||||
use App\Models\ShoppingUser;
|
||||
use App\Models\AttributeType;
|
||||
use App\Models\ShippingCountry;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class HTMLHelper
|
||||
{
|
||||
|
||||
|
||||
private static $months = [
|
||||
1 => 'Januar',
|
||||
2 => 'Februar',
|
||||
3 => 'März',
|
||||
public static $months = [
|
||||
1 => 'January',
|
||||
2 => 'February',
|
||||
3 => 'March',
|
||||
4 => 'April',
|
||||
5 => 'Mai',
|
||||
6 => 'Juni',
|
||||
7 => 'Juli',
|
||||
5 => 'May',
|
||||
6 => 'June',
|
||||
7 => 'July',
|
||||
8 => 'August',
|
||||
9 => 'September',
|
||||
10 => 'Oktober',
|
||||
10 => 'October',
|
||||
11 => 'November',
|
||||
12 => 'Dezember',
|
||||
12 => 'December'
|
||||
];
|
||||
|
||||
|
||||
|
||||
private static $roles = [
|
||||
0 => 'Kunde',
|
||||
1 => 'Redakteur',
|
||||
|
|
@ -45,6 +49,23 @@ class HTMLHelper
|
|||
return self::$months[intval($i)];
|
||||
}
|
||||
|
||||
public static function getTransMonths($full = false){
|
||||
$ret = [];
|
||||
foreach(self::$months as $key=>$val){
|
||||
$ret[$key] = trans('cal.months.'.$val);
|
||||
}
|
||||
if($full){ //ganzes Jahr
|
||||
$ret[13] = trans('cal.months.full_year');
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getYearRange($start = 2021)
|
||||
{
|
||||
$end = date("Y");
|
||||
return array_reverse(range($start, $end));
|
||||
}
|
||||
|
||||
public static function getRoleLabel($role_id = 0){
|
||||
return '<span class="badge badge-pill '.self::getLabel($role_id).'">'.self::$roles[$role_id].'</span>';
|
||||
}
|
||||
|
|
@ -150,22 +171,68 @@ class HTMLHelper
|
|||
return $ret;
|
||||
}
|
||||
|
||||
public static function getAttributesWithoutParents($id = false, $sameId = false, $all = true){
|
||||
$values = Attribute::where('parent_id', null)->get();
|
||||
|
||||
public static function getAttributeTypes($id = false){
|
||||
$values = AttributeType::where('parent_id', null)->where('active', 1)->orderBy('pos', 'asc')->get();
|
||||
$ret = "";
|
||||
if($id === false){
|
||||
$val = $values->first();
|
||||
$id = $val->id;
|
||||
}
|
||||
foreach ($values as $value){
|
||||
|
||||
$attr = ($value->id == $id) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
public static function getProductsWhiteLabelOptions($ids = [], $unsets = [], $type_id = false){
|
||||
$values = Product::where('whitelabel', 1)->where('active', 1)->get();
|
||||
$ret = "";
|
||||
foreach ($values as $value){
|
||||
if(is_array($unsets) && in_array($value->id, $unsets)){
|
||||
continue;
|
||||
}
|
||||
$attr = (is_array($ids) && in_array($value->id, $ids)) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
public static function getAttributesOptions($ids = array(), $all = true, $type_id = false){
|
||||
if($type_id){
|
||||
$values = Attribute::where('active', 1)->where('attribute_type_id', $type_id)->get();
|
||||
}else{
|
||||
$values = Attribute::where('active', 1)->get();
|
||||
}
|
||||
$ret = "";
|
||||
if($all){
|
||||
$ret .= '<option value="">'.__('no').'</option>\n';
|
||||
}
|
||||
foreach ($values as $value){
|
||||
if($sameId == $value->id){
|
||||
continue;
|
||||
}
|
||||
$attr = ($value->id == $id) ? 'selected="selected"' : '';
|
||||
$attr = in_array($value->id, $ids) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getProductAttributesOptions($product_attributes, $ids = [], $all = true, $type_id = false){
|
||||
$ret = "";
|
||||
if($all){
|
||||
$ret .= '<option value="">'.__('no').'</option>\n';
|
||||
}
|
||||
foreach ($product_attributes as $product_attribute){
|
||||
if($product_attribute->attribute){
|
||||
$attr = (is_array($ids) && in_array($product_attribute->attribute_id, $ids)) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$product_attribute->attribute_id.'" '.$attr.'>'.$product_attribute->attribute->name.'</option>\n';
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function getCategoriesWithoutParents($id = false, $sameId = false, $all = true){
|
||||
$values = Category::where('parent_id', null)->get();
|
||||
$ret = "";
|
||||
|
|
@ -211,6 +278,14 @@ class HTMLHelper
|
|||
return $ret;
|
||||
}
|
||||
|
||||
public static function getCategoriesByShowOn($show_on = []){
|
||||
$values = Category::where('active', true)->whereJsonContains('show_on', $show_on)->orderBy('pos', 'ASC')->get();
|
||||
$ret = [];
|
||||
foreach ($values as $value){
|
||||
$ret[$value->id] = ['name' => $value->name, 'count' => $value->getProductsCountOn($show_on)];
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
public static function getCategoriesOptionsByShowOn($ids = array(), $all = false, $show_on = []){
|
||||
$values = Category::where('active', true)->whereJsonContains('show_on', $show_on)->orderBy('pos', 'ASC')->get();
|
||||
$ret = "";
|
||||
|
|
@ -219,7 +294,8 @@ class HTMLHelper
|
|||
}
|
||||
foreach ($values as $value){
|
||||
$attr = in_array($value->id, $ids) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
|
||||
$count = $value->getProductsCountOn($show_on);
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.' ('.$count.')</option>\n';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
|
@ -236,14 +312,14 @@ class HTMLHelper
|
|||
return $ret;
|
||||
}
|
||||
|
||||
public static function getAttributesOptions($ids = array(), $all = true){
|
||||
$values = Attribute::where('active', 1)->get();
|
||||
public static function getLeadTypeOptions($id = false, $all = true){
|
||||
$values = LeadType::where('active', 1)->get();
|
||||
$ret = "";
|
||||
if($all){
|
||||
$ret .= '<option value="">'.__('no').'</option>\n';
|
||||
}
|
||||
foreach ($values as $value){
|
||||
$attr = in_array($value->id, $ids) ? 'selected="selected"' : '';
|
||||
$attr = ($value->id == $id) ? 'selected="selected"' : '';
|
||||
$ret .= '<option value="'.$value->id.'" '.$attr.'>'.$value->name.'</option>\n';
|
||||
}
|
||||
return $ret;
|
||||
|
|
|
|||
|
|
@ -31,10 +31,18 @@ class Invoice
|
|||
return "/invoice/".\Carbon::parse($invoice_date)->format('Y/m/');
|
||||
}
|
||||
|
||||
public static function getDeliveryStorageDir($invoice_date){
|
||||
return "/delivery/".\Carbon::parse($invoice_date)->format('Y/m/');
|
||||
}
|
||||
|
||||
public static function makeInvoiceFilename($invoice_number){
|
||||
return "Rechnung-".$invoice_number.".pdf";
|
||||
}
|
||||
|
||||
public static function makeDeliveryFilename($invoice_number){
|
||||
return "Lieferschein-".$invoice_number.".pdf";
|
||||
}
|
||||
//invoice
|
||||
public static function isInvoice(ShoppingOrder $shopping_order){
|
||||
return isset($shopping_order->invoice['filename']) ? true : false;
|
||||
}
|
||||
|
|
@ -54,10 +62,27 @@ class Invoice
|
|||
public static function getNumber($shopping_order){
|
||||
return isset($shopping_order->invoice['invoice_number']) ? $shopping_order->invoice['invoice_number'] : false;
|
||||
}
|
||||
|
||||
public static function getDownloadURL(ShoppingOrder $shopping_order, $do = false){
|
||||
// return route('storage_file', [$shopping_order->id, 'cms_download_file', $do]);
|
||||
//delivery
|
||||
public static function isDelivery(ShoppingOrder $shopping_order){
|
||||
return isset($shopping_order->delivery['filename']) ? true : false;
|
||||
}
|
||||
public static function getDeliveryFilename($shopping_order){
|
||||
return isset($shopping_order->delivery['filename']) ? $shopping_order->delivery['filename'] : self::makeDeliveryFilename(self::getDeliveryNumber($shopping_order));
|
||||
}
|
||||
|
||||
public static function getDeliveryDir($shopping_order){
|
||||
return isset($shopping_order->delivery['dir']) ? $shopping_order->delivery['dir'] : self::getDeliveryStorageDir(self::getDeliveryDate($shopping_order));
|
||||
}
|
||||
|
||||
public static function getDeliveryDate($shopping_order){
|
||||
return isset($shopping_order->delivery['date']) ? $shopping_order->delivery['date'] : self::getDate($shopping_order);
|
||||
}
|
||||
|
||||
public static function getDeliveryNumber($shopping_order){
|
||||
return isset($shopping_order->delivery['number']) ? $shopping_order->delivery['number'] : self::getNumber($shopping_order);
|
||||
}
|
||||
|
||||
|
||||
public static function getDownloadPath(ShoppingOrder $shopping_order, $full = false){
|
||||
$dir = self::getDir($shopping_order);
|
||||
$filename = self::getFilename($shopping_order);
|
||||
|
|
@ -67,6 +92,15 @@ class Invoice
|
|||
return \Storage::disk('public')->path($dir.$filename);
|
||||
}
|
||||
|
||||
public static function getDownloadPathDelivery(ShoppingOrder $shopping_order, $full = false){
|
||||
$dir = self::getDeliveryDir($shopping_order);
|
||||
$filename = self::getDeliveryFilename($shopping_order);
|
||||
if(!$full){
|
||||
return $dir.$filename;
|
||||
}
|
||||
return \Storage::disk('public')->path($dir.$filename);
|
||||
}
|
||||
|
||||
public static function sendInvoiceMail($shopping_order){
|
||||
$bcc = [];
|
||||
$billing_email = $shopping_order->shopping_user->billing_email;
|
||||
|
|
|
|||
34
app/Services/MyLog.php
Normal file
34
app/Services/MyLog.php
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
namespace App\Services;
|
||||
|
||||
use App\Mail\MailLog;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
|
||||
class MyLog
|
||||
{
|
||||
|
||||
|
||||
|
||||
public static function writeLog($channel = 'payment', $context = 'error', $message = '', $data = []){
|
||||
|
||||
switch ($context) {
|
||||
case 'notice':
|
||||
\Log::channel($channel)->notice($message.' : '.json_encode($data));
|
||||
break;
|
||||
case 'warning':
|
||||
\Log::channel($channel)->warning($message.' : '.json_encode($data));
|
||||
break;
|
||||
case 'info':
|
||||
\Log::channel($channel)->info($message.' : '.json_encode($data));
|
||||
break;
|
||||
default:
|
||||
\Log::channel($channel)->error($message.' : '.json_encode($data));
|
||||
break;
|
||||
}
|
||||
Mail::to(config('app.exception_mail'))->send(new MailLog($channel, $context, $message, $data));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
245
app/Services/PDFMerger.php
Normal file
245
app/Services/PDFMerger.php
Normal file
|
|
@ -0,0 +1,245 @@
|
|||
<?php
|
||||
namespace App\Services;
|
||||
|
||||
|
||||
use setasign\Fpdi\Fpdi as FPDI;
|
||||
use setasign\Fpdi\PdfParser\StreamReader;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Str;
|
||||
use Response;
|
||||
|
||||
|
||||
class PDFMerger {
|
||||
|
||||
/**
|
||||
* Access the filesystem on an oop base
|
||||
*
|
||||
* @var Filesystem
|
||||
*/
|
||||
protected $oFilesystem = Filesystem::class;
|
||||
|
||||
/**
|
||||
* Hold all the files which will be merged
|
||||
*
|
||||
* @var Collection
|
||||
*/
|
||||
protected $aFiles = Collection::class;
|
||||
|
||||
/**
|
||||
* Holds every tmp file so they can be removed during the deconstruction
|
||||
*
|
||||
* @var Collection
|
||||
*/
|
||||
protected $tmpFiles = Collection::class;
|
||||
|
||||
/**
|
||||
* The actual PDF Service
|
||||
*
|
||||
* @var FPDI
|
||||
*/
|
||||
protected $oFPDI = FPDI::class;
|
||||
|
||||
/**
|
||||
* The final file name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $fileName = 'undefined.pdf';
|
||||
|
||||
/**
|
||||
* Construct and initialize a new instance
|
||||
* @param Filesystem $oFilesystem
|
||||
*/
|
||||
public function __construct(Filesystem $oFilesystem = null){
|
||||
$this->oFilesystem = $oFilesystem;
|
||||
$this->oFPDI = new FPDI();
|
||||
$this->tmpFiles = collect([]);
|
||||
|
||||
$this->init();
|
||||
}
|
||||
|
||||
/**
|
||||
* The class deconstructor method
|
||||
*/
|
||||
public function __destruct() {
|
||||
$oFilesystem = $this->oFilesystem;
|
||||
$this->tmpFiles->each(function($filePath) use($oFilesystem){
|
||||
$oFilesystem->delete($filePath);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize a new internal instance of FPDI in order to prevent any problems with shared resources
|
||||
* Please visit https://www.setasign.com/products/fpdi/manual/#p-159 for more information on this issue
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function init(){
|
||||
$this->oFPDI = new FPDI();
|
||||
$this->aFiles = collect([]);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stream the merged PDF content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function stream(){
|
||||
return $this->oFPDI->Output($this->fileName, 'I');
|
||||
}
|
||||
|
||||
/**
|
||||
* Download the merged PDF content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function download(){
|
||||
$output = $this->output();
|
||||
return new Response($output, 200, [
|
||||
'Content-Type' => 'application/pdf',
|
||||
'Content-Disposition' => 'attachment; filename="' . $this->fileName . '"',
|
||||
'Content-Length' => strlen($output),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the merged PDF content to the filesystem
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function save($filePath = null){
|
||||
return $this->oFilesystem->put($filePath?$filePath:$this->fileName, $this->output());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the merged PDF content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function output(){
|
||||
return $this->oFPDI->Output($this->fileName, 'S');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the final filename
|
||||
* @param string $fileName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function setFileName($fileName){
|
||||
$this->fileName = $fileName;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the final filename
|
||||
* @param string $string
|
||||
* @param mixed $pages
|
||||
* @param mixed $orientation
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function addString($string, $pages = 'all', $orientation = null){
|
||||
|
||||
$filePath = storage_path('tmp/'.Str::random(16).'.pdf');
|
||||
$this->oFilesystem->put($filePath, $string);
|
||||
$this->tmpFiles->push($filePath);
|
||||
|
||||
return $this->addPDF($filePath, $pages, $orientation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a PDF for inclusion in the merge with a valid file path. Pages should be formatted: 1,3,6, 12-16.
|
||||
* @param string $filePath
|
||||
* @param string $pages
|
||||
* @param string $orientation
|
||||
*
|
||||
* @return self
|
||||
*
|
||||
* @throws \Exception if the given pages aren't correct
|
||||
*/
|
||||
public function addPDF($filePath, $pages = 'all', $orientation = null) {
|
||||
if (file_exists($filePath)) {
|
||||
if (!is_array($pages) && strtolower($pages) != 'all') {
|
||||
throw new \Exception($filePath."'s pages could not be validated");
|
||||
}
|
||||
|
||||
$this->aFiles->push([
|
||||
'name' => $filePath,
|
||||
'pages' => $pages,
|
||||
'orientation' => $orientation
|
||||
]);
|
||||
} else {
|
||||
throw new \Exception("Could not locate PDF on '$filePath'");
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges your provided PDFs and outputs to specified location.
|
||||
* @param string $orientation
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \Exception if there are now PDFs to merge
|
||||
*/
|
||||
public function merge($orientation = null) {
|
||||
$this->doMerge($orientation, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges your provided PDFs and adds blank pages between documents as needed to allow duplex printing
|
||||
* @param string $orientation
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \Exception if there are now PDFs to merge
|
||||
*/
|
||||
public function duplexMerge($orientation = 'P') {
|
||||
$this->doMerge($orientation, true);
|
||||
}
|
||||
|
||||
protected function doMerge($orientation, $duplexSafe) {
|
||||
|
||||
if ($this->aFiles->count() == 0) {
|
||||
throw new \Exception("No PDFs to merge.");
|
||||
}
|
||||
|
||||
$oFPDI = $this->oFPDI;
|
||||
|
||||
$this->aFiles->each(function($file) use($oFPDI, $orientation, $duplexSafe){
|
||||
$file['orientation'] = is_null($file['orientation'])?$orientation:$file['orientation'];
|
||||
$count = $oFPDI->setSourceFile(StreamReader::createByString(file_get_contents($file['name'])));
|
||||
|
||||
if ($file['pages'] == 'all') {
|
||||
|
||||
for ($i = 1; $i <= $count; $i++) {
|
||||
$template = $oFPDI->importPage($i);
|
||||
$size = $oFPDI->getTemplateSize($template);
|
||||
$autoOrientation = isset($file['orientation']) ? $file['orientation'] : $size['orientation'];
|
||||
|
||||
$oFPDI->AddPage($autoOrientation, [$size['width'], $size['height']]);
|
||||
$oFPDI->useTemplate($template);
|
||||
}
|
||||
} else {
|
||||
foreach ($file['pages'] as $page) {
|
||||
if (!$template = $oFPDI->importPage($page)) {
|
||||
throw new \Exception("Could not load page '$page' in PDF '" . $file['name'] . "'. Check that the page exists.");
|
||||
}
|
||||
$size = $oFPDI->getTemplateSize($template);
|
||||
$autoOrientation = isset($file['orientation']) ? $file['orientation'] : $size['orientation'];
|
||||
|
||||
$oFPDI->AddPage($autoOrientation, [$size['width'], $size['height']]);
|
||||
$oFPDI->useTemplate($template);
|
||||
}
|
||||
}
|
||||
|
||||
if ($duplexSafe && $oFPDI->page % 2) {
|
||||
$oFPDI->AddPage($file['orientation'], [$size['width'], $size['height']]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -89,6 +89,11 @@ class Payment
|
|||
return '<span class="badge badge-pill badge-'.self::getFormattedTxactionColor($shopping_order->txaction).'">'.self::getFormattedTxaction($shopping_order->txaction).'</span>';
|
||||
}
|
||||
|
||||
public static function getPaymentForTypeBadge(ShoppingOrder $shopping_order){
|
||||
return '<span class="badge badge-pill badge-'.$shopping_order->getPaymentForColor().'">'.$shopping_order->getPaymentForType().'</span>';
|
||||
|
||||
}
|
||||
|
||||
public static function getShoppingPaymentBadge(ShoppingPayment $shopping_payment){
|
||||
if($shopping_payment->mode === 'test'){
|
||||
return '<span class="badge badge-pill badge-default">'.strtoupper($shopping_payment->mode).' - '.self::getFormattedTxaction($shopping_payment->txaction).'</span>';
|
||||
|
|
@ -207,13 +212,12 @@ class Payment
|
|||
}
|
||||
|
||||
}
|
||||
//if the order has action
|
||||
if($shopping_order->shopping_user->is_from === 'user_order' && $shopping_order->shopping_order_margin){
|
||||
//is margin -> set paid
|
||||
$shopping_order->shopping_order_margin->paid = true;
|
||||
$shopping_order->shopping_order_margin->save();
|
||||
}
|
||||
|
||||
//if the order has action
|
||||
if(($shopping_order->shopping_user->is_from === 'user_order' || $shopping_order->shopping_user->is_from === 'shopping') && $shopping_order->shopping_order_margin){
|
||||
//is margin -> set paid
|
||||
$shopping_order->shopping_order_margin->order_paid = true;
|
||||
$shopping_order->shopping_order_margin->save();
|
||||
}
|
||||
return $send_link;
|
||||
}
|
||||
|
|
@ -326,6 +330,14 @@ class Payment
|
|||
}
|
||||
}
|
||||
|
||||
public static function handelUserShopOrder(ShoppingOrder $shopping_order){
|
||||
//no user shop
|
||||
if($shopping_order->payment_for !== 8 || !$shopping_order->user_shop){
|
||||
return;
|
||||
}
|
||||
// need something to do?
|
||||
}
|
||||
|
||||
//add or remove form credit,
|
||||
//when done, put it back SalesController
|
||||
public static function handelUserPayCreditsPromotion(PromotionUserOrder $promotion_user_order, $do){
|
||||
|
|
|
|||
269
app/Services/Payment/Credits.php
Normal file
269
app/Services/Payment/Credits.php
Normal file
|
|
@ -0,0 +1,269 @@
|
|||
<?php
|
||||
namespace App\Services\Stats;
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use App\Services\Util;
|
||||
use App\Models\ShoppingOrder;
|
||||
|
||||
class Sales
|
||||
{
|
||||
private $month;
|
||||
private $year;
|
||||
private $products;
|
||||
private $objects;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->month = 0;
|
||||
$this->year = 0;
|
||||
$this->products = [];
|
||||
$this->objects = [];
|
||||
}
|
||||
|
||||
public function setFilterVars($month = null, $year = null, $products = null){
|
||||
$this->month = $month ? $month : intval(date('m'));
|
||||
$this->year = $year ? $year : intval(date('Y'));
|
||||
$this->products = $products;
|
||||
}
|
||||
|
||||
public function setFilterProducts(){
|
||||
|
||||
$ShoppingOrders = $this->getShoppingOrdersBy($this->month, $this->year);
|
||||
$products = [];
|
||||
foreach($ShoppingOrders as $ShoppingOrder){
|
||||
foreach($ShoppingOrder->shopping_order_items as $shopping_order_item){
|
||||
if($shopping_order_item->product && !$shopping_order_item->product->exclude_stats_sales && !isset($products[$shopping_order_item->product->id])){
|
||||
$products[$shopping_order_item->product->id] = $shopping_order_item->product->name.' # '.
|
||||
($shopping_order_item->product->single_commission ? $shopping_order_item->product->value_commission.' / '.$shopping_order_item->product->partner_commission : 'Staffelrabatt');
|
||||
}
|
||||
}
|
||||
}
|
||||
return $products;
|
||||
}
|
||||
|
||||
private function getShoppingOrdersBy($month, $year){
|
||||
if($month == '13'){ //all the year
|
||||
$date_start = Carbon::parse('01.01.'.$year)->format('Y-m-d H:i:s');
|
||||
$date_end = Carbon::parse('31.12.'.$year)->endOfMonth()->format('Y-m-d H:i:s');
|
||||
}else{
|
||||
$date_start = Carbon::parse('01.'.$month.'.'.$year)->format('Y-m-d H:i:s');
|
||||
$date_end = Carbon::parse('01.'.$month.'.'.$year)->endOfMonth()->format('Y-m-d H:i:s');
|
||||
}
|
||||
return ShoppingOrder::where('paid', 1)->where('mode', 'live')->whereBetween('created_at', [$date_start, $date_end])->get();
|
||||
}
|
||||
|
||||
public function getCollection(){
|
||||
|
||||
$this->getObjects();
|
||||
$collection = collect();
|
||||
|
||||
foreach($this->objects as $key => $obj){
|
||||
$collection->push([
|
||||
'id' => $key,
|
||||
'name' => $obj['name'],
|
||||
'number' => $obj['number'],
|
||||
'qty' => $obj['qty'],
|
||||
'total' => $obj['total'],
|
||||
'pre_qty' => $obj['pre_qty'],
|
||||
'pre_total' => $obj['pre_total'],
|
||||
'single_commission' => $obj['single_commission'],
|
||||
'value_commission' => $obj['value_commission'],
|
||||
'partner_commission' => $obj['partner_commission'],
|
||||
|
||||
]);
|
||||
}
|
||||
return $collection;
|
||||
}
|
||||
|
||||
public function getObjects(){
|
||||
$this->readObjects();
|
||||
$this->readObjectsPreview();
|
||||
return $this->objects;
|
||||
}
|
||||
|
||||
private function readObjects()
|
||||
{
|
||||
$shoppingOrders = $this->getShoppingOrdersBy($this->month, $this->year);
|
||||
$this->objects = [];
|
||||
|
||||
$subtotal_full = 0; // gesamtumsatz
|
||||
$subtotal = 0; // gesamtumsatz ohne rabatte
|
||||
$discount = 0; // gesamtrabatte
|
||||
$subtotal_hide = 0; // ausgeschlossene Produkte
|
||||
|
||||
foreach($shoppingOrders as $ShoppingOrder){
|
||||
$subtotal_full += $ShoppingOrder->subtotal_full;
|
||||
$subtotal += $ShoppingOrder->subtotal;
|
||||
$discount += $ShoppingOrder->discount;
|
||||
|
||||
foreach($ShoppingOrder->shopping_order_items as $shopping_order_item){
|
||||
|
||||
if($shopping_order_item->product){
|
||||
if(!in_array($shopping_order_item->product->id, $this->products) && !$shopping_order_item->product->exclude_stats_sales){ //ausschließen der Produkte über filter und exclude_stats_sales
|
||||
if(isset($this->objects[$shopping_order_item->product->id])){
|
||||
$qty = intval($this->objects[$shopping_order_item->product->id]['qty'] + $shopping_order_item->qty);
|
||||
$total = round($this->objects[$shopping_order_item->product->id]['total'] + ($shopping_order_item->price_net * $shopping_order_item->qty), 3);
|
||||
$this->objects[$shopping_order_item->product->id]['qty'] = $qty;
|
||||
$this->objects[$shopping_order_item->product->id]['total'] = $total;
|
||||
}else{
|
||||
$this->objects[$shopping_order_item->product->id] = [
|
||||
'name' => $shopping_order_item->product->name,
|
||||
'number' => $shopping_order_item->product->number,
|
||||
'qty' => $shopping_order_item->qty,
|
||||
'total' => round($shopping_order_item->price_net * $shopping_order_item->qty, 3),
|
||||
'pre_qty' => 0,
|
||||
'pre_total' => 0,
|
||||
'single_commission' => $shopping_order_item->product->single_commission ? 'Ja' : 'Nein',
|
||||
'value_commission' => $shopping_order_item->product->single_commission ? $shopping_order_item->product->value_commission : '',
|
||||
'partner_commission' => $shopping_order_item->product->single_commission ? $shopping_order_item->product->partner_commission : '',
|
||||
|
||||
];
|
||||
}
|
||||
}else{
|
||||
$subtotal_hide += $shopping_order_item->price_net * $shopping_order_item->qty;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$this->objects[9990] = [
|
||||
'name' => 'Angezeigter Umsatz netto €',
|
||||
'number' => '',
|
||||
'qty' => '',
|
||||
'total' => round($subtotal_full - $subtotal_hide, 2),
|
||||
'pre_qty' => 0,
|
||||
'pre_total' => 0,
|
||||
'single_commission' => '',
|
||||
'value_commission' => '',
|
||||
'partner_commission' => '',
|
||||
|
||||
];
|
||||
|
||||
$this->objects[9991] = [
|
||||
'name' => 'Ausgeblendeter Umsatz netto €',
|
||||
'number' => '',
|
||||
'qty' => '',
|
||||
'total' => $subtotal_hide,
|
||||
'pre_qty' => 0,
|
||||
'pre_total' => 0,
|
||||
'single_commission' => '',
|
||||
'value_commission' => '',
|
||||
'partner_commission' => '',
|
||||
|
||||
];
|
||||
|
||||
$this->objects[9992] = [
|
||||
'name' => 'Gesamter Umsatz netto € (alle Verkäufe)',
|
||||
'number' => '',
|
||||
'qty' => '',
|
||||
'total' => $subtotal_full,
|
||||
'pre_qty' => 0,
|
||||
'pre_total' => 0,
|
||||
'single_commission' => '',
|
||||
'value_commission' => '',
|
||||
'partner_commission' => '',
|
||||
|
||||
];
|
||||
|
||||
$this->objects[9998] = [
|
||||
'name' => 'Gesamte Rabatte netto € (alle Verkäufe)',
|
||||
'number' => '',
|
||||
'qty' => '',
|
||||
'total' => ($discount),
|
||||
'pre_qty' => 0,
|
||||
'pre_total' => 0,
|
||||
'single_commission' => '',
|
||||
'value_commission' => '',
|
||||
'partner_commission' => '',
|
||||
|
||||
];
|
||||
|
||||
$this->objects[9999] = [
|
||||
'name' => 'Gesamt netto € (alle Verkäufe)',
|
||||
'number' => '',
|
||||
'qty' => '',
|
||||
'total' => ($subtotal),
|
||||
'pre_qty' => 0,
|
||||
'pre_total' => 0,
|
||||
'single_commission' => '',
|
||||
'value_commission' => '',
|
||||
'partner_commission' => '',
|
||||
|
||||
];
|
||||
|
||||
//format total
|
||||
foreach($this->objects as $key => $obj){
|
||||
$this->objects[$key]['total'] = formatNumber($obj['total']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function readObjectsPreview(){
|
||||
|
||||
|
||||
$shoppingOrders = $this->getShoppingOrdersBy($this->month, $this->year-1);
|
||||
|
||||
$subtotal_full = 0; // gesamtumsatz
|
||||
$subtotal = 0; // gesamtumsatz ohne rabatte
|
||||
$discount = 0; // gesamtrabatte
|
||||
$subtotal_hide = 0; // ausgeschlossene Produkte
|
||||
|
||||
foreach($shoppingOrders as $ShoppingOrder){
|
||||
$subtotal_full += $ShoppingOrder->subtotal_full;
|
||||
$subtotal += $ShoppingOrder->subtotal;
|
||||
$discount += $ShoppingOrder->discount;
|
||||
|
||||
foreach($ShoppingOrder->shopping_order_items as $shopping_order_item){
|
||||
|
||||
if($shopping_order_item->product){
|
||||
if(!in_array($shopping_order_item->product->id, $this->products) && !$shopping_order_item->product->exclude_stats_sales){ //ausschließen der Produkte über filter und exclude_stats_sales
|
||||
if(isset($this->objects[$shopping_order_item->product->id])){ //einsetzen der Zahlen, wenn vorhanden
|
||||
$qty = intval($this->objects[$shopping_order_item->product->id]['pre_qty'] + $shopping_order_item->qty);
|
||||
$total = round($this->objects[$shopping_order_item->product->id]['pre_total'] + ($shopping_order_item->price_net * $shopping_order_item->qty), 3);
|
||||
$this->objects[$shopping_order_item->product->id]['pre_qty'] = $qty;
|
||||
$this->objects[$shopping_order_item->product->id]['pre_total'] = $total;
|
||||
}else{ // nicht vorhanden, anlegen
|
||||
$this->objects[$shopping_order_item->product->id] = [
|
||||
'name' => $shopping_order_item->product->name,
|
||||
'number' => $shopping_order_item->product->number,
|
||||
'qty' => 0,
|
||||
'total' => 0,
|
||||
'pre_qty' => $shopping_order_item->qty,
|
||||
'pre_total' => round($shopping_order_item->price_net * $shopping_order_item->qty, 3),
|
||||
'single_commission' => $shopping_order_item->product->single_commission ? 'Ja' : 'Nein',
|
||||
'value_commission' => $shopping_order_item->product->single_commission ? $shopping_order_item->product->value_commission : '',
|
||||
'partner_commission' => $shopping_order_item->product->single_commission ? $shopping_order_item->product->partner_commission : '',
|
||||
|
||||
];
|
||||
}
|
||||
}else{
|
||||
//ausgeschlossene Produkte
|
||||
$subtotal_hide += $shopping_order_item->price_net * $shopping_order_item->qty;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$this->objects[9990]['pre_total'] = round($subtotal_full - $subtotal_hide, 2);
|
||||
$this->objects[9991]['pre_total'] = $subtotal_hide;
|
||||
$this->objects[9992]['pre_total'] = $subtotal_full;
|
||||
$this->objects[9998]['pre_total'] = ($discount);
|
||||
$this->objects[9999]['pre_total'] = ($subtotal);
|
||||
|
||||
//format total
|
||||
foreach($this->objects as $key => $obj){
|
||||
$this->objects[$key]['pre_total'] = formatNumber($obj['pre_total']);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
303
app/Services/Payment/UserBot.php
Normal file
303
app/Services/Payment/UserBot.php
Normal file
|
|
@ -0,0 +1,303 @@
|
|||
<?php
|
||||
namespace App\Services\Payment;
|
||||
|
||||
|
||||
use App\Models\ShoppingOrderMargin;
|
||||
use App\Models\UserCreditMargin;
|
||||
use App\Services\Payment\UserCredits;
|
||||
use App\Services\UserHelper;
|
||||
use App\Services\UserMarign;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class UserBot
|
||||
{
|
||||
|
||||
public $users;
|
||||
public $users_pending;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->users = [];
|
||||
$this->users_pending = [];
|
||||
}
|
||||
|
||||
|
||||
public function readUserHasCredits(){
|
||||
|
||||
//user by m_sponsor_id die Partner Provisionen haben
|
||||
$usersWithPartnerCommission = $this->getUsersWithPartnerCommission(false);
|
||||
|
||||
//user die manuelle Gutschriften haben
|
||||
$usersWithCreditMargin = $this->getUsersWithCreditMargin();
|
||||
//user die Shop Provisionen haben
|
||||
$usersWithShopCommission = $this->getUsersWithShopCommission(false);
|
||||
|
||||
// Alle Benutzer zum Array hinzufügen
|
||||
$allUsers = $usersWithPartnerCommission->concat($usersWithCreditMargin)->concat($usersWithShopCommission);
|
||||
foreach ($allUsers as $user) {
|
||||
//prüfe ob der User Account noch aktiv ist
|
||||
if(UserHelper::isActiveAccountByID($user->user_id)){
|
||||
$this->addUser($user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function readUserHasPendingCredit(){
|
||||
//sponsor Users von Provisionen die bezahlt wurden die noch im pending sind
|
||||
$usersWithPartnerCommissionPending = $this->getUsersWithPartnerCommission(true);
|
||||
|
||||
$usersWithShopCommissionPending = $this->getUsersWithShopCommission(true);
|
||||
|
||||
// Alle Benutzer zum Array hinzufügen
|
||||
$allUsers = $usersWithPartnerCommissionPending->concat($usersWithShopCommissionPending);
|
||||
|
||||
foreach ($allUsers as $user) {
|
||||
//prüfe ob der User Account noch aktiv ist
|
||||
if(UserHelper::isActiveAccountByID($user->user_id)){
|
||||
$this->addUserPending($user);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public function getUsers(){
|
||||
return $this->users;
|
||||
}
|
||||
public function getUsersPending(){
|
||||
return $this->users_pending;
|
||||
}
|
||||
|
||||
private function addUser($user){
|
||||
// Prüfen, ob Benutzer bereits existiert
|
||||
if (!isset($this->users[$user->user_id])) {
|
||||
$this->users[$user->user_id] = $this->createUserCredit($user);
|
||||
$this->addCreditItems($user->user_id, false);
|
||||
}
|
||||
}
|
||||
|
||||
private function addUserPending($user){
|
||||
// Prüfen, ob Benutzer bereits existiert
|
||||
if (!isset($this->users_pending[$user->user_id])) {
|
||||
$this->users_pending[$user->user_id] = $this->createUserCredit($user);
|
||||
$this->addCreditItems($user->user_id, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private function addCreditItems($user_id, $isPending){
|
||||
// Partner Provisionen hinzufügen
|
||||
$this->addPartnerCommissionItems($user_id, $isPending);
|
||||
|
||||
// Shop Provisionen hinzufügen
|
||||
$this->addShopCommissionItems($user_id, $isPending);
|
||||
|
||||
// Wenn es nicht ausstehende Credits sind, füge manuelle Gutschriften hinzu
|
||||
if (!$isPending) {
|
||||
$this->addCreditMarginItems($user_id);
|
||||
}
|
||||
}
|
||||
|
||||
private function addPartnerCommissionItems($user_id, $isPending){
|
||||
|
||||
$shoppingOrderMargins = UserMarign::getPartnerCommissionItems($user_id, $isPending);
|
||||
|
||||
if ($isPending) {
|
||||
$targetArray = 'users_pending';
|
||||
} else {
|
||||
$targetArray = 'users';
|
||||
}
|
||||
|
||||
foreach ($shoppingOrderMargins as $shoppingOrderMargin) {
|
||||
$entry = $this->createCreditEntry($shoppingOrderMargin);
|
||||
|
||||
if ($shoppingOrderMargin->net_partner_commission) {
|
||||
$entry->price_formatted = $shoppingOrderMargin->getFormattedNetPartnerCommission();
|
||||
$entry->price = $shoppingOrderMargin->net_partner_commission;
|
||||
}
|
||||
|
||||
$this->{$targetArray}[$user_id]->addItem($entry);
|
||||
|
||||
if (!empty($entry->price)) {
|
||||
$this->{$targetArray}[$user_id]->total += $entry->price;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function addShopCommissionItems($user_id, $isPending){
|
||||
|
||||
$shoppingOrderMargins = UserMarign::getShopCommissionItems($user_id, $isPending);
|
||||
|
||||
if ($isPending) {
|
||||
$targetArray = 'users_pending';
|
||||
} else {
|
||||
$targetArray = 'users';
|
||||
}
|
||||
|
||||
foreach ($shoppingOrderMargins as $shoppingOrderMargin) {
|
||||
$entry = $this->createCreditEntry($shoppingOrderMargin);
|
||||
|
||||
$entry->delete = $this->addDeleteButton($shoppingOrderMargin->id, 'shopping_order_margin');
|
||||
if ($shoppingOrderMargin->net_discount) {
|
||||
$entry->price_formatted = $shoppingOrderMargin->getFormattedNetDiscount();
|
||||
$entry->price = $shoppingOrderMargin->net_discount;
|
||||
}
|
||||
|
||||
$this->{$targetArray}[$user_id]->addItem($entry);
|
||||
|
||||
if (!empty($entry->price)) {
|
||||
$this->{$targetArray}[$user_id]->total += $entry->price;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function addCreditMarginItems($user_id){
|
||||
|
||||
$creditMargins = UserMarign::getUserCreditMarginByUserID($user_id);
|
||||
|
||||
foreach ($creditMargins as $creditMargin) {
|
||||
$entry = new \stdClass();
|
||||
$entry->badge = '<i class="fa fa-plus-circle text-secondary"></i> ';
|
||||
$entry->link = '';//route('admin_credits_detail', [$creditMargin->id]);
|
||||
$entry->name = nl2br($creditMargin->message);
|
||||
$entry->reference = '';
|
||||
$entry->total = '';
|
||||
$entry->date = $creditMargin->created_at->format("d.m.Y");
|
||||
$entry->price_formatted = formatNumber($creditMargin->credit);
|
||||
$entry->price = $creditMargin->credit;
|
||||
$entry->delete = $this->addDeleteButton($creditMargin->id, 'user_credit_margin', $creditMargin->deleteTime());
|
||||
|
||||
$this->users[$user_id]->addItem($entry);
|
||||
|
||||
if (!empty($entry->price)) {
|
||||
$this->users[$user_id]->total += $entry->price;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function createCreditEntry($shoppingOrderMargin){
|
||||
$entry = new \stdClass();
|
||||
$entry->badge = \App\Services\Payment::getPaymentForTypeBadge($shoppingOrderMargin->shopping_order);
|
||||
|
||||
if ($shoppingOrderMargin->shopping_order->payment_for === 7 || $shoppingOrderMargin->shopping_order->payment_for === 8) {
|
||||
$entry->link = route('admin_sales_customers_detail', [$shoppingOrderMargin->shopping_order->id]);
|
||||
} else {
|
||||
$entry->link = route('admin_sales_users_detail', [$shoppingOrderMargin->shopping_order->id]);
|
||||
}
|
||||
|
||||
$entry->name = $shoppingOrderMargin->shopping_order->shopping_user->billing_firstname . " " .
|
||||
$shoppingOrderMargin->shopping_order->shopping_user->billing_lastname;
|
||||
$entry->reference = $shoppingOrderMargin->shopping_order->getLastShoppingPayment('reference');
|
||||
$entry->total = $shoppingOrderMargin->shopping_order->getFormattedTotalWithoutCredit() . " €";
|
||||
$entry->date = $shoppingOrderMargin->shopping_order->created_at->format("d.m.Y");
|
||||
|
||||
return $entry;
|
||||
}
|
||||
|
||||
private function addDeleteButton($id, $type, $deleteTime = false){
|
||||
if($type === 'shopping_order_margin'){
|
||||
return '<span class="no-line-break">
|
||||
<a class="btn btn-danger btn-xs" href="'.route('admin_payments_credit_delete', [$id, $type]).'" onclick="return confirm(\'Wirklich löschen?\');">
|
||||
<i class="ion ion-ios-trash"></i>
|
||||
</a>
|
||||
</span>';
|
||||
}
|
||||
if($type === 'user_credit_margin'){
|
||||
if($deleteTime){
|
||||
return '<span class="no-line-break">
|
||||
<a class="btn btn-danger btn-xs" href="'.route('admin_payments_credit_delete', [$id, $type]).'" onclick="return confirm(\'Wirklich löschen?\');">
|
||||
<i class="ion ion-ios-trash"></i>
|
||||
</a> noch '. $deleteTime .' min.
|
||||
</span>';
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt User mit Partner Provisionen zurück
|
||||
*
|
||||
* @param bool $isPending True für künftige Provisionen, False für fällige Provisionen
|
||||
* @return \Illuminate\Database\Eloquent\Collection
|
||||
*/
|
||||
private function getUsersWithPartnerCommission(bool $isPending)
|
||||
{
|
||||
$query = ShoppingOrderMargin::join('users', 'm_sponsor_id', '=', 'users.id')
|
||||
->groupBy('m_sponsor_id')
|
||||
->join('user_accounts', 'account_id', '=', 'user_accounts.id')
|
||||
->select('users.id as user_id', 'users.email', 'user_accounts.first_name', 'user_accounts.last_name')
|
||||
->whereOrderPaid(true)
|
||||
->whereOutPaid(false)
|
||||
->whereCancellation(false)
|
||||
->wherePartnerCommissionPaid(false)
|
||||
->whereNotNull('partner_commission_pending_to');
|
||||
|
||||
if ($isPending) {
|
||||
$query->where('partner_commission_pending_to', '>=', Carbon::now());
|
||||
} else {
|
||||
$query->where('partner_commission_pending_to', '<', Carbon::now());
|
||||
}
|
||||
|
||||
return $query->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt User mit Shop Provisionen zurück
|
||||
*
|
||||
* @param bool $isPending True für künftige Provisionen, False für fällige Provisionen
|
||||
* @return \Illuminate\Database\Eloquent\Collection
|
||||
*/
|
||||
private function getUsersWithShopCommission(bool $isPending)
|
||||
{
|
||||
$query = ShoppingOrderMargin::join('users', 'user_id', '=', 'users.id')
|
||||
->groupBy('user_id')
|
||||
->join('user_accounts', 'account_id', '=', 'user_accounts.id')
|
||||
->select('users.id as user_id', 'users.email', 'user_accounts.first_name', 'user_accounts.last_name')
|
||||
->whereOrderPaid(true)
|
||||
->whereOutPaid(false)
|
||||
->whereCancellation(false)
|
||||
->whereMarginPaid(false)
|
||||
->whereNotNull('margin_pending_to');
|
||||
|
||||
if ($isPending) {
|
||||
$query->where('margin_pending_to', '>=', Carbon::now());
|
||||
} else {
|
||||
$query->where('margin_pending_to', '<', Carbon::now());
|
||||
}
|
||||
|
||||
return $query->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt User mit manuellen Gutschriften zurück
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Collection
|
||||
*/
|
||||
private function getUsersWithCreditMargin()
|
||||
{
|
||||
return UserCreditMargin::join('users', 'user_id', '=', 'users.id')
|
||||
->join('user_accounts', 'account_id', '=', 'user_accounts.id')
|
||||
->select('user_id', 'users.email', 'user_accounts.first_name', 'user_accounts.last_name')
|
||||
->wherePaid(false)
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Erstellt ein neues UserCredits-Objekt
|
||||
*
|
||||
* @param object $user Benutzerdaten
|
||||
* @return UserCredits
|
||||
*/
|
||||
private function createUserCredit($user)
|
||||
{
|
||||
$userCredit = new UserCredits();
|
||||
$userCredit->email = $user->email;
|
||||
$userCredit->first_name = $user->first_name;
|
||||
$userCredit->last_name = $user->last_name;
|
||||
$userCredit->user_id = $user->user_id;
|
||||
$userCredit->total = 0;
|
||||
|
||||
return $userCredit;
|
||||
}
|
||||
}
|
||||
33
app/Services/Payment/UserCredits.php
Normal file
33
app/Services/Payment/UserCredits.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
namespace App\Services\Payment;
|
||||
|
||||
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Models\ShoppingOrderMargin;
|
||||
use App\Models\UserCreditMargin;
|
||||
use App\Services\Util;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class UserCredits
|
||||
{
|
||||
public $email;
|
||||
public $first_name;
|
||||
public $last_name;
|
||||
public $user_id;
|
||||
public $items;
|
||||
public $total;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->items = [];
|
||||
}
|
||||
|
||||
|
||||
public function addItem($entry){
|
||||
$this->items[] = $entry;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue